mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Avoid breakage on runner image update, like the recent update to XCode 15.4 on arm64 which breaks our (ancient) glib build.
189 lines
5.1 KiB
YAML
189 lines
5.1 KiB
YAML
name: macos
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on: [push, pull_request]
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
|
|
macos:
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform: ['arm64', 'x86_64']
|
|
|
|
runs-on: ${{ matrix.platform == 'arm64' && 'macos-14' || 'macos-13' }}
|
|
|
|
env:
|
|
# Bump number to reset all caches.
|
|
CACHE_EPOCH: '1'
|
|
CLICOLOR_FORCE: '1'
|
|
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.platform == 'arm64' && '11.0' || '10.15' }}
|
|
MAKEFLAGS: 'OUTPUT_DIR=build INSTALL_DIR=install TARGET=macos'
|
|
|
|
steps:
|
|
|
|
# Install dependencies. {{{
|
|
|
|
- name: XCode version
|
|
run: |
|
|
# NOTE: don't forget to bump `CACHE_EPOCH`
|
|
# above when changing the XCode version.
|
|
sudo xcode-select -s /Applications/Xcode_15.2.app
|
|
xcodebuild -version
|
|
xcode-select -p
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
wget -O ninjatracing.zip https://github.com/nico/ninjatracing/archive/a669e3644cf22b29cbece31dbed2cfbf34e5f48e.zip
|
|
unzip -j ninjatracing.zip '*/ninjatracing'
|
|
install -m755 ninjatracing /usr/local/bin/
|
|
rm ninjatracing*
|
|
packages=(
|
|
autoconf
|
|
automake
|
|
binutils
|
|
cmake
|
|
coreutils
|
|
findutils
|
|
libtool
|
|
make
|
|
nasm
|
|
ninja
|
|
p7zip
|
|
pkg-config
|
|
sdl2
|
|
util-linux
|
|
)
|
|
brew install --formula --quiet "${packages[@]}"
|
|
|
|
- name: Update PATH
|
|
run: >
|
|
printf '%s\n'
|
|
"$(brew --prefix)/opt/findutils/libexec/gnubin"
|
|
"$(brew --prefix)/opt/make/libexec/gnubin"
|
|
"$(brew --prefix)/opt/util-linux/bin"
|
|
| tee "${GITHUB_PATH}"
|
|
|
|
# }}}
|
|
|
|
# Checkout / fetch. {{{
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
clean: false
|
|
fetch-depth: 0
|
|
filter: tree:0
|
|
show-progress: false
|
|
|
|
- name: Fetch
|
|
run: make fetchthirdparty
|
|
|
|
# }}}
|
|
|
|
# Restore / setup caches. {{{
|
|
|
|
- name: Generate cache key
|
|
run: make -C base TARGET= cache-key
|
|
|
|
- name: Restore build directory
|
|
id: build-restore
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: base/build
|
|
key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-build-${{ hashFiles('base/cache-key') }}
|
|
|
|
- name: Restore build cache
|
|
id: ccache-restore
|
|
if: steps.build-restore.outputs.cache-hit != 'true'
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: /Users/runner/Library/Caches/ccache
|
|
key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-ccache-${{ hashFiles('base/cache-key') }}
|
|
restore-keys: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-ccache-
|
|
|
|
- name: Install ccache
|
|
if: steps.build-restore.outputs.cache-hit != 'true'
|
|
run: |
|
|
wget --progress=dot:mega https://github.com/ccache/ccache/releases/download/v4.9.1/ccache-4.9.1-darwin.tar.gz
|
|
tar xf ccache-4.9.1-darwin.tar.gz
|
|
printf '%s\n' "$PWD/ccache-4.9.1-darwin" >>"${GITHUB_PATH}"
|
|
|
|
- name: Setup build cache
|
|
if: steps.build-restore.outputs.cache-hit != 'true'
|
|
run: |
|
|
set -x
|
|
which ccache
|
|
ccache --version
|
|
ccache --zero-stats
|
|
ccache --max-size=256M
|
|
ccache --show-config
|
|
|
|
# }}}
|
|
|
|
# Build. {{{
|
|
|
|
- name: Build
|
|
id: build
|
|
if: steps.build-restore.outputs.cache-hit != 'true'
|
|
run: make base
|
|
|
|
- name: Dump build timings
|
|
if: contains('failure success', steps.build.conclusion) && !cancelled()
|
|
run: make buildstats
|
|
|
|
- name: Dump binaries runtime path & dependencies
|
|
run: make bindeps
|
|
|
|
# }}}
|
|
|
|
# Clean / save caches. {{{
|
|
|
|
- name: Clean caches
|
|
if: contains('failure success', steps.build.conclusion) && !cancelled()
|
|
run: |
|
|
set -x
|
|
# Trim the build directory.
|
|
rm -rf base/build/{cmake,staging,thirdparty}
|
|
ccache --cleanup >/dev/null
|
|
ccache --show-stats --verbose
|
|
|
|
- name: Save build cache
|
|
uses: actions/cache/save@v4
|
|
if: steps.build-restore.outputs.cache-hit != 'true' && steps.ccache-restore.outputs.cache-hit != 'true'
|
|
with:
|
|
path: /Users/runner/Library/Caches/ccache
|
|
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}
|
|
|
|
- name: Save build directory
|
|
uses: actions/cache/save@v4
|
|
if: steps.build-restore.outputs.cache-hit != 'true'
|
|
with:
|
|
path: base/build
|
|
key: ${{ steps.build-restore.outputs.cache-primary-key }}
|
|
|
|
# }}}
|
|
|
|
# Generate / upload artifact. {{{
|
|
|
|
- name: Generate artifact
|
|
run: make update --assume-old=base
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: koreader-macos-${{ matrix.platform }}
|
|
path: '*.7z'
|
|
|
|
# }}}
|
|
|
|
# vim: foldmethod=marker foldlevel=0
|