forked from dosbox-staging/dosbox-staging
-
Notifications
You must be signed in to change notification settings - Fork 0
278 lines (240 loc) · 8.46 KB
/
macos.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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
name: macOS builds
on:
push:
paths-ignore:
- '.clang-format'
- '.mdl-styles'
- '*.md'
- 'docs/**'
- 'licenses/**'
- 'website/**'
pull_request:
paths-ignore:
- '.clang-format'
- '.mdl-styles'
- '*.md'
- 'docs/**'
- 'licenses/**'
- 'website/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_macos:
name: ${{ matrix.conf.name }} (${{ matrix.conf.arch }})
runs-on: ${{ matrix.conf.host }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
conf:
- name: Clang
host: macos-12
arch: x86_64
needs_deps: true
build_flags: -Denable_debugger=normal
brew_path: /usr/local/homebrew
max_warnings: 80
- name: Clang
host: macos-14
arch: arm64
needs_deps: true
build_flags: -Dbuildtype=debug
brew_path: /opt/homebrew
max_warnings: 60
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: false
- name: Install C++ compiler and libraries
if: matrix.conf.needs_deps
run: |
arch -arch=${{ matrix.conf.arch }} brew unlink [email protected] || true
rm -f /usr/local/bin/openssl || true
arch -arch=${{ matrix.conf.arch }} brew install --overwrite openssl@3 || true
arch -arch=${{ matrix.conf.arch }} brew link --overwrite openssl@3 || true
arch -arch=${{ matrix.conf.arch }} brew install --overwrite \
${{ matrix.conf.packages }} \
$(cat packages/macos-12-brew.txt) || true
- name: Cache subprojects
id: cache-subprojects
uses: actions/cache@v4
with:
path: subprojects.tar
key: subprojects-${{ hashFiles('subprojects/*.wrap') }}-1
enableCrossOsArchive: true
- if: steps.cache-subprojects.outputs.cache-hit != 'true'
name: Generate subprojects cache
run: scripts/fetch-and-tar-subprojects.sh
- name: Extract subprojects cache
run: scripts/extract-subprojects-tar.sh
- name: Setup and build
run: |
set -xo pipefail
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
eval "$(${{ matrix.conf.brew_path }}/bin/brew shellenv)"
./scripts/log-env.sh
./scripts/retry_command.sh 3 meson setup ${{ matrix.conf.build_flags }} build
meson compile -C build 2>&1 | tee build.log
- name: Run tests
if: matrix.conf.run_tests
run: |
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
eval "$(${{ matrix.conf.brew_path }}/bin/brew shellenv)"
meson test --num-processes 128 -t 0 -C build --print-errorlogs
- name: Summarize warnings
if: matrix.conf.run_tests != true
env:
MAX_WARNINGS: ${{ matrix.conf.max_warnings }}
run: python3 ./scripts/count-warnings.py -lf build.log
build_macos_release:
name: Release build (${{ matrix.runner.arch }})
runs-on: ${{ matrix.runner.host }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.runner.minimum_deployment }}
strategy:
matrix:
runner:
- host: macos-12
arch: x86_64
build_flags: -Db_lto=true
brew_path: /usr/local/homebrew
minimum_deployment: '10.15'
needs_deps: true
needs_libintl_workaround: false
- host: macos-14
arch: arm64
build_flags: -Db_lto=true
brew_path: /opt/homebrew
minimum_deployment: '11.0'
needs_deps: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: false
- name: Install C++ compiler and libraries
if: matrix.runner.needs_deps
run: |
brew install librsvg tree libpng ninja opusfile speexdsp meson python-setuptools
- name: Cache subprojects
id: cache-subprojects
uses: actions/cache@v4
with:
path: subprojects.tar
key: subprojects-${{ hashFiles('subprojects/*.wrap') }}-1
enableCrossOsArchive: true
- if: steps.cache-subprojects.outputs.cache-hit != 'true'
name: Generate subprojects cache
run: scripts/fetch-and-tar-subprojects.sh
- name: Extract subprojects cache
run: scripts/extract-subprojects-tar.sh
- name: Log environment
run: arch -arch=${{ matrix.runner.arch }} ./scripts/log-env.sh
- name: Inject version string
run: |
set -x
git fetch --prune --unshallow
git fetch --all --tags --force
export VERSION=$(git describe --abbrev=5)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Setup and build release
run: |
set -x
eval "$(${{ matrix.runner.brew_path }}/bin/brew shellenv)"
meson setup \
${{ matrix.runner.build_flags }} \
-Ddefault_library=static \
-Dwrap_mode=forcefallback \
-Dtry_static_libs=sdl2,sdl2_net \
-Duse_zlib_ng=sse2,ssse3,neon \
build
meson compile -C build
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: dosbox-${{ matrix.runner.arch }}
path: build/dosbox
overwrite: true
- name: Upload resources
uses: actions/upload-artifact@v4
with:
name: Resources
path: Resources
overwrite: true
publish_universal_build:
name: Publish universal build
needs: build_macos_release
runs-on: macos-14
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: false
- name: Inject version string
run: |
set -x
git fetch --prune --unshallow
git fetch --all --tags --force
export VERSION=$(git describe --abbrev=5)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Install brew depedencies
run: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install --overwrite librsvg
- name: Download binaries
uses: actions/download-artifact@v4
- name: Package
run: |
mv Resources ../
./scripts/create-package.sh \
-p macos \
-v "${{ env.VERSION }}" \
-f \
"$(pwd)" \
"$(pwd)"
- name: Create dmg
run: |
ln -s /Applications dist/
codesign -s "-" "dist/DOSBox Staging.app" --force --deep -v
hdiutil create \
-volname "DOSBox Staging" \
-srcfolder dist \
-ov -format UDZO "dosbox-staging-macOS-${{ env.VERSION }}.dmg"
- name: Upload disk image
uses: actions/upload-artifact@v4
# GitHub automatically zips the artifacts, and there's no option
# to skip it or upload a file only.
with:
name: dosbox-staging-macOS-universal
path: dosbox-staging-macOS-${{ env.VERSION }}.dmg
overwrite: true
# This job exists only to publish an artifact with version info when building
# from main branch, so snapshot build version will be visible on:
# https://dosbox-staging.github.io/downloads/devel/
#
publish_additional_artifacts:
name: Publish additional artifacts
needs: build_macos_release
runs-on: macos-14
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
submodules: false
- name: Generate changelog
run: |
set +x
git fetch --unshallow
git fetch --all --tags --force
VERSION=$(git describe --abbrev=4)
echo "VERSION=$VERSION" >> $GITHUB_ENV
NEWEST_TAG=$(git describe --abbrev=0)
git log "$NEWEST_TAG..HEAD" > changelog-$VERSION.txt
- uses: actions/upload-artifact@v4
with:
# Keep exactly this artifact name; it's being used to propagate
# version info via GitHub REST API
name: changelog-${{ env.VERSION }}.txt
path: changelog-${{ env.VERSION }}.txt
overwrite: true