-
Notifications
You must be signed in to change notification settings - Fork 106
144 lines (111 loc) · 3.92 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
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: '0'
CLICOLOR_FORCE: '1'
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.platform == 'arm64' && '11.0' || '10.15' }}
MAKEFLAGS: 'OUTPUT_DIR=build'
steps:
- name: XCode version
run: xcode-select -p
# 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
# Note: if we get a hit on the primary key, then the rest of the job can be skipped:
# there's no point in building the same version, and we don't have any tests to run.
- name: Restore build cache
id: ccache-restore
uses: actions/cache/restore@v4
with:
path: /Users/runner/Library/Caches/ccache
key: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-${{ runner.arch }}-ccache-${{ hashFiles('cache-key') }}
restore-keys: ${{ env.CACHE_EPOCH }}-${{ runner.os }}-ccache-
- name: Install ccache
if: steps.ccache-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.ccache-restore.outputs.cache-hit != 'true'
run: |
set -x
which ccache
ccache --version
ccache --zero-stats
ccache --max-size=256M
ccache --show-config
# }}}
# Install dependencies. {{{
- name: Setup Python
if: steps.ccache-restore.outputs.cache-hit != 'true'
uses: actions/setup-python@v5
with:
# Note: Python 3.12 removal of `distutils` breaks GLib's build.
python-version: '3.11'
- name: Install homebrew dependencies
# Compared to the README, adds p7zip.
run: |
packages=(
nasm binutils coreutils libtool autoconf automake cmake make
sdl2 gettext pkg-config wget gnu-getopt grep p7zip ninja
)
brew install --formula --quiet "${packages[@]}"
- name: Update PATH
if: steps.ccache-restore.outputs.cache-hit != 'true'
run: >
printf '%s\n'
"$(brew --prefix)/opt/gettext/bin"
"$(brew --prefix)/opt/gnu-getopt/bin"
"$(brew --prefix)/opt/grep/libexec/gnubin"
"$(brew --prefix)/opt/make/libexec/gnubin"
| tee "${GITHUB_PATH}"
# }}}
# Build. {{{
- name: Build
if: steps.ccache-restore.outputs.cache-hit != 'true'
run: make
- name: Dump binaries runtime path & dependencies
if: steps.ccache-restore.outputs.cache-hit != 'true'
run: make bindeps
# }}}
# Clean / save caches. {{{
- name: Clean build cache
if: steps.ccache-restore.outputs.cache-hit != 'true' && always()
run: |
set -x
ccache --cleanup >/dev/null
ccache --show-stats --verbose
- name: Save build cache
uses: actions/cache/save@v4
if: steps.ccache-restore.outputs.cache-hit != 'true'
with:
path: /Users/runner/Library/Caches/ccache
key: ${{ steps.ccache-restore.outputs.cache-primary-key }}
# }}}
# vim: foldmethod=marker foldlevel=0