forked from koreader/koreader-base
-
Notifications
You must be signed in to change notification settings - Fork 0
211 lines (169 loc) · 5.83 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
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:
include:
- image: '13'
platform: 'x86-64'
xcode_version: '15.2'
deployment_target: '10.15'
- image: '14'
platform: 'ARM64'
xcode_version: '15.4'
deployment_target: '11.0'
- image: '15'
platform: 'ARM64'
xcode_version: '16.0'
deployment_target: '14.6.1'
name: "macOS ${{ matrix.image }} ${{ matrix.platform }} 🔨${{ matrix.xcode_version }} 🎯${{ matrix.deployment_target }}"
runs-on: "macos-${{ matrix.image }}"
env:
# Bump first number to reset all caches.
CACHE_KEY: "1-macOS-${{ matrix.image }}-${{ matrix.platform }}-XC${{ matrix.xcode_version }}-DT${{ matrix.deployment_target }}"
CLICOLOR_FORCE: '1'
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target }}
MAKEFLAGS: 'OUTPUT_DIR=build'
steps:
# Install dependencies. {{{
- name: XCode version
run: |
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode_version }}.app
xcodebuild -version
xcode-select -p
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
set -x
python3 -m pip install --disable-pip-version-check meson ruamel.yaml
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*
# Install brew packages.
packages=(
autoconf
automake
bash
binutils
cmake
coreutils
findutils
libtool
make
nasm
ninja
pkg-config
util-linux
)
# 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
brew install --formula --overwrite --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 TARGET= cache-key
- name: Restore build directory
id: build-restore
uses: actions/cache/restore@v4
with:
path: build
key: ${{ env.CACHE_KEY }}-build-${{ hashFiles('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_KEY }}-ccache-${{ hashFiles('cache-key') }}
restore-keys: ${{ env.CACHE_KEY }}-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.10.2/ccache-4.10.2-darwin.tar.gz
tar xf ccache-4.10.2-darwin.tar.gz
printf '%s\n' "$PWD/ccache-4.10.2-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
- name: Dump build timings
if: contains('failure success', steps.build.conclusion) && !cancelled()
run: make buildstats
# }}}
# Clean / save caches. {{{
- name: Clean caches
if: contains('failure success', steps.build.conclusion) && !cancelled()
run: |
set -x
# Trim the build directory.
rm -rf 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: build
key: ${{ steps.build-restore.outputs.cache-primary-key }}
# }}}
# Dump & check binaries. {{{
- name: Dump binaries runtime path & dependencies
run: make bininfo
- name: Checking binaries for missing dependencies
run: make bincheck
# }}}
- name: Test
run: ./utils/fake_tty.py make --assume-old=all test
# vim: foldmethod=marker foldlevel=0