2024-05-13 19:33:54 +00:00
|
|
|
name: macos
|
2020-12-11 14:16:29 +00:00
|
|
|
|
2024-05-13 19:33:53 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-12-11 14:16:29 +00:00
|
|
|
on: [push, pull_request]
|
|
|
|
|
2024-05-13 19:33:54 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
2020-12-11 14:16:29 +00:00
|
|
|
jobs:
|
2024-05-13 19:33:54 +00:00
|
|
|
|
|
|
|
macos:
|
2022-07-04 10:17:33 +00:00
|
|
|
|
2024-06-01 05:07:52 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
platform: ['arm64', 'x86_64']
|
2022-07-04 10:17:33 +00:00
|
|
|
|
2024-06-01 05:07:52 +00:00
|
|
|
runs-on: ${{ matrix.platform == 'arm64' && 'macos-14' || 'macos-13' }}
|
2020-12-11 14:16:29 +00:00
|
|
|
|
2024-05-13 19:33:54 +00:00
|
|
|
env:
|
|
|
|
# Bump number to reset all caches.
|
|
|
|
CACHE_EPOCH: '0'
|
2024-05-13 19:33:54 +00:00
|
|
|
CLICOLOR_FORCE: '1'
|
2024-06-01 05:07:52 +00:00
|
|
|
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.platform == 'arm64' && '11.0' || '10.15' }}
|
2024-05-13 19:33:54 +00:00
|
|
|
MAKEFLAGS: 'OUTPUT_DIR=build INSTALL_DIR=install TARGET=macos'
|
|
|
|
|
2020-12-11 14:16:29 +00:00
|
|
|
steps:
|
2024-07-19 19:25:09 +00:00
|
|
|
|
|
|
|
# Install dependencies. {{{
|
|
|
|
|
2020-12-11 14:16:29 +00:00
|
|
|
- name: XCode version
|
|
|
|
run: xcode-select -p
|
|
|
|
|
2024-07-19 19:25:09 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2024-07-19 19:25:11 +00:00
|
|
|
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*
|
2024-07-19 19:25:09 +00:00
|
|
|
packages=(
|
|
|
|
autoconf
|
|
|
|
automake
|
|
|
|
binutils
|
|
|
|
cmake
|
|
|
|
coreutils
|
2024-07-19 19:25:10 +00:00
|
|
|
findutils
|
2024-07-19 19:25:09 +00:00
|
|
|
libtool
|
|
|
|
make
|
|
|
|
nasm
|
|
|
|
ninja
|
|
|
|
p7zip
|
|
|
|
pkg-config
|
|
|
|
sdl2
|
2024-07-19 19:25:10 +00:00
|
|
|
util-linux
|
2024-07-19 19:25:09 +00:00
|
|
|
)
|
|
|
|
brew install --formula --quiet "${packages[@]}"
|
|
|
|
|
|
|
|
- name: Update PATH
|
|
|
|
run: >
|
|
|
|
printf '%s\n'
|
2024-07-19 19:25:10 +00:00
|
|
|
"$(brew --prefix)/opt/findutils/libexec/gnubin"
|
2024-07-19 19:25:09 +00:00
|
|
|
"$(brew --prefix)/opt/make/libexec/gnubin"
|
2024-07-19 19:25:10 +00:00
|
|
|
"$(brew --prefix)/opt/util-linux/bin"
|
2024-07-19 19:25:09 +00:00
|
|
|
| tee "${GITHUB_PATH}"
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
|
2024-05-13 19:33:54 +00:00
|
|
|
# Checkout / fetch. {{{
|
|
|
|
|
|
|
|
- name: Checkout
|
2023-09-11 14:49:39 +00:00
|
|
|
uses: actions/checkout@v4
|
2020-12-11 14:16:29 +00:00
|
|
|
with:
|
2024-04-10 22:11:10 +00:00
|
|
|
clean: false
|
2020-12-11 14:16:29 +00:00
|
|
|
fetch-depth: 0
|
2024-04-10 22:11:10 +00:00
|
|
|
filter: tree:0
|
|
|
|
show-progress: false
|
2020-12-11 14:16:29 +00:00
|
|
|
|
2024-05-13 19:33:54 +00:00
|
|
|
- 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
|
2024-06-01 05:07:52 +00:00
|
|
|
key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-build-${{ hashFiles('base/cache-key') }}
|
2024-05-13 19:33:54 +00:00
|
|
|
|
|
|
|
- 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
|
2024-06-01 05:07:52 +00:00
|
|
|
key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-ccache-${{ hashFiles('base/cache-key') }}
|
2024-07-20 06:01:05 +00:00
|
|
|
restore-keys: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-ccache-
|
2024-05-13 19:33:54 +00:00
|
|
|
|
|
|
|
- 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
|
2024-07-19 19:25:11 +00:00
|
|
|
id: build
|
2024-05-13 19:33:54 +00:00
|
|
|
if: steps.build-restore.outputs.cache-hit != 'true'
|
|
|
|
run: make base
|
|
|
|
|
2024-07-19 19:25:11 +00:00
|
|
|
- name: Dump build timings
|
|
|
|
if: contains('failure success', steps.build.conclusion) && !cancelled()
|
|
|
|
run: make buildstats
|
|
|
|
|
2024-05-29 21:40:08 +00:00
|
|
|
- name: Dump binaries runtime path & dependencies
|
|
|
|
run: make bindeps
|
|
|
|
|
2024-05-13 19:33:54 +00:00
|
|
|
# }}}
|
|
|
|
|
|
|
|
# Clean / save caches. {{{
|
|
|
|
|
|
|
|
- name: Clean caches
|
2024-07-19 19:25:11 +00:00
|
|
|
if: contains('failure success', steps.build.conclusion) && !cancelled()
|
2024-04-14 20:29:13 +00:00
|
|
|
run: |
|
2024-05-13 19:33:54 +00:00
|
|
|
set -x
|
|
|
|
# Trim the build directory.
|
2024-05-29 18:15:30 +00:00
|
|
|
rm -rf base/build/{cmake,staging,thirdparty}
|
2024-05-13 19:33:54 +00:00
|
|
|
ccache --cleanup >/dev/null
|
|
|
|
ccache --show-stats --verbose
|
2020-12-11 14:16:29 +00:00
|
|
|
|
2024-05-13 19:33:54 +00:00
|
|
|
- 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
|
2023-12-18 10:13:00 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2020-12-11 14:16:29 +00:00
|
|
|
with:
|
2024-06-01 05:07:52 +00:00
|
|
|
name: koreader-macos-${{ matrix.platform }}
|
2020-12-11 14:16:29 +00:00
|
|
|
path: '*.7z'
|
2024-05-13 19:33:54 +00:00
|
|
|
|
|
|
|
# }}}
|
|
|
|
|
|
|
|
# vim: foldmethod=marker foldlevel=0
|