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.
|
2024-07-28 16:31:59 +00:00
|
|
|
CACHE_EPOCH: '1'
|
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
|
2024-07-28 16:31:59 +00:00
|
|
|
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
|
2020-12-11 14:16:29 +00:00
|
|
|
|
2024-08-01 19:22:55 +00:00
|
|
|
- name: Setup Python
|
|
|
|
uses: actions/setup-python@v5
|
|
|
|
with:
|
|
|
|
python-version: '3.12'
|
|
|
|
|
2024-07-19 19:25:09 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2024-08-19 18:17:14 +00:00
|
|
|
set -x
|
2024-08-01 19:22:55 +00:00
|
|
|
python3 -m pip install --disable-pip-version-check meson ruamel.yaml
|
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-08-19 18:17:14 +00:00
|
|
|
# Install brew packages.
|
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
|
|
|
)
|
2024-08-19 18:17:14 +00:00
|
|
|
# Don't auto-update.
|
|
|
|
export HOMEBREW_NO_AUTO_UPDATE=1
|
|
|
|
# Don't upgrade already installed formulas.
|
|
|
|
export HOMEBREW_NO_INSTALL_UPGRADE=1
|
|
|
|
# Remove some installed packages to prevent brew
|
|
|
|
# from attempting (and failing) to upgrade them.
|
|
|
|
brew uninstall gradle maven
|
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
|
2024-07-30 23:55:36 +00:00
|
|
|
run: make TARGET= cache-key
|
2024-05-13 19:33:54 +00:00
|
|
|
|
|
|
|
- name: Restore build directory
|
|
|
|
id: build-restore
|
|
|
|
uses: actions/cache/restore@v4
|
|
|
|
with:
|
2024-07-30 23:55:36 +00:00
|
|
|
path: build
|
|
|
|
key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-build-${{ hashFiles('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-07-30 23:55:36 +00:00
|
|
|
key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-ccache-${{ hashFiles('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-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-07-30 23:55:36 +00:00
|
|
|
rm -rf 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:
|
2024-07-30 23:55:36 +00:00
|
|
|
path: build
|
2024-05-13 19:33:54 +00:00
|
|
|
key: ${{ steps.build-restore.outputs.cache-primary-key }}
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
|
2024-08-01 19:24:28 +00:00
|
|
|
# Dump & check binaries. {{{
|
|
|
|
|
|
|
|
- name: Dump binaries runtime path & dependencies
|
|
|
|
run: make bininfo
|
|
|
|
|
|
|
|
- name: Checking binaries for missing dependencies
|
|
|
|
run: make bincheck
|
|
|
|
|
|
|
|
# }}}
|
|
|
|
|
2024-05-13 19:33:54 +00:00
|
|
|
# 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
|