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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
name: macOS builds
on: [push, pull_request]
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: 0
- name: Clang
host: [self-hosted, macOS, arm64, debug-builds]
arch: arm64
needs_deps: false
packages: meson
build_flags: -Dbuildtype=debug
brew_path: /opt/homebrew
run_tests: true
max_warnings: 0
- name: GCC 12
host: macos-11
arch: x86_64
needs_deps: true
packages: gcc@12
build_flags: -Dbuildtype=debug -Dunit_tests=disabled --native-file=.github/meson/native-gcc-12.ini
brew_path: /usr/local/homebrew
max_warnings: 0
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: false
# Let self-hosted runners, which don't need_deps, leverage their own ccache.
- name: Add the ccache environment to GitHub-hosted runners
if: matrix.conf.needs_deps
shell: bash
run: |
set -eu
echo 'CCACHE_DIR="${{ github.workspace }}/.ccache"' >> $GITHUB_ENV
echo 'CCACHE_MAXSIZE="64M"' >> $GITHUB_ENV
echo 'CCACHE_COMPRESS="true"' >> $GITHUB_ENV
- name: Prepare brew and compiler caches
if: matrix.conf.needs_deps
id: prep-caches
shell: bash
run: |
set -eu
BREW_DIR="$(brew --cache)"
DISCARD_DIR="${{ github.workspace }}/discard"
mkdir -p "$DISCARD_DIR"
mv -f "$BREW_DIR"/* "$DISCARD_DIR"
mkdir -p "$CCACHE_DIR"
echo "brew_dir=$BREW_DIR" >> $GITHUB_OUTPUT
echo "ccache_dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
echo "today=$(date +%F)" >> $GITHUB_OUTPUT
echo "name_hash=$(echo '${{ matrix.conf.name }} ${{ matrix.conf.arch }}' | shasum | cut -b-8)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3.0.11
if: matrix.conf.needs_deps
with:
path: ${{ steps.prep-caches.outputs.brew_dir }}
key: brew-cache-${{ matrix.conf.arch }}-${{ steps.prep-caches.outputs.today }}-2
restore-keys: brew-cache-${{ matrix.conf.arch }}-
- name: Install C++ compiler and libraries
if: matrix.conf.needs_deps
run: |
arch -arch=${{ matrix.conf.arch }} brew install \
${{ matrix.conf.packages }} \
$(cat packages/macos-12-brew.txt)
- uses: actions/cache@v3.0.11
if: matrix.conf.needs_deps
with:
path: ${{ steps.prep-caches.outputs.ccache_dir }}
key: ccache-macos-debug-${{ steps.prep-caches.outputs.name_hash }}-${{ steps.prep-caches.outputs.today }}-2
restore-keys: |
ccache-macos-debug-${{ steps.prep-caches.outputs.name_hash }}-
ccache-macos-debug-
- name: Cache subprojects
uses: actions/cache@v3.0.11
with:
path: subprojects/packagecache
key: subprojects-${{ hashFiles('subprojects/*.wrap') }}-2
- 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:
MIN_SUPPORTED_MACOSX_DEPLOYMENT_TARGET: ${{ matrix.runner.minimum_deployment }}
strategy:
matrix:
runner:
- host: [self-hosted, macOS, arm64, release-builds]
arch: x86_64
build_flags: -Db_lto=true -Db_lto_threads=4 --native-file=.github/meson/macos-arm64-to-x86_64-10.15-deployment-target.ini
brew_path: /usr/local/homebrew
minimum_deployment: '10.15'
needs_deps: false
needs_libintl_workaround: false
- host: [self-hosted, macOS, arm64, release-builds]
arch: arm64
brew_path: /opt/homebrew
minimum_deployment: '11.0'
needs_deps: false
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: false
# Let self-hosted runners, which don't need_deps, leverage their own ccache.
- name: Add the ccache environment to GitHub-hosted runners
if: matrix.runner.needs_deps
shell: bash
run: |
set -eu
echo 'CCACHE_DIR="${{ github.workspace }}/.ccache"' >> $GITHUB_ENV
echo 'CCACHE_MAXSIZE="64M"' >> $GITHUB_ENV
echo 'CCACHE_COMPRESS="true"' >> $GITHUB_ENV
- name: Prepare brew and compiler caches
if: matrix.runner.needs_deps
id: prep-caches
shell: bash
run: |
set -eu
BREW_DIR="$(brew --cache)"
DISCARD_DIR="${{ github.workspace }}/discard"
mkdir -p "$DISCARD_DIR"
mv -f "$BREW_DIR"/* "$DISCARD_DIR"
mkdir -p "$CCACHE_DIR"
echo "brew_dir=$BREW_DIR" >> $GITHUB_OUTPUT
echo "ccache_dir=$CCACHE_DIR" >> $GITHUB_OUTPUT
echo "today=$(date +%F)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3.0.11
if: matrix.runner.needs_deps
with:
path: ${{ steps.prep-caches.outputs.brew_dir }}
key: brew-cache-${{ matrix.runner.arch }}-${{ steps.prep-caches.outputs.today }}-2
restore-keys: brew-cache-${{ matrix.runner.arch }}-
- name: Install C++ compiler and libraries
if: matrix.runner.needs_deps
run: >-
arch -arch=${{ matrix.runner.arch }} brew install librsvg tree
ccache libpng meson opusfile sdl2 sdl2_image sdl2_net speexdsp
# Workaround frequent HTTPS-based connectivity issues
# https://gitlab.freedesktop.org/freedesktop/freedesktop/-/issues/407
- name: Fetch the libffi subproject for Glib
run: ./scripts/fetch-libffi-subproject.sh
- uses: actions/cache@v3.0.11
if: matrix.runner.needs_deps
with:
path: ${{ steps.prep-caches.outputs.ccache_dir }}
key: ccache-macos-release-${{ matrix.runner.arch }}-${{ steps.prep-caches.outputs.today }}-2
restore-keys: ccache-macos-release-${{ matrix.runner.arch }}-
- name: Cache subprojects
uses: actions/cache@v3.0.11
with:
path: subprojects/packagecache
key: subprojects-${{ hashFiles('subprojects/*.wrap') }}-2
- name: Log environment
run: arch -arch=${{ matrix.runner.arch }} ./scripts/log-env.sh
- name: Inject version string
run: |
set -x
git fetch --prune --unshallow
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_image,sdl2_net build
meson compile -C build
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: dosbox-${{ matrix.runner.arch }}
path: build/dosbox
- name: Upload resources
uses: actions/upload-artifact@v3
with:
name: Resources
path: Resources
publish_universal_build:
name: Publish universal build
needs: build_macos_release
runs-on: macos-12
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: false
- name: Inject version string
run: |
set -x
git fetch --prune --unshallow
export VERSION=$(git describe --abbrev=5)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Install brew depedencies
run: brew install librsvg
- name: Download binaries
uses: actions/download-artifact@v3
- 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: Clam AV scan
id: prep-clamdb
shell: bash
run: |
brew install clamav
export CLAMDB_DIR="/usr/local/Cellar/clamav"
clamscan --heuristic-scan-precedence=yes --recursive --infected dist || true
- name: Upload disk image
uses: actions/upload-artifact@v3
# 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
# 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-12
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
with:
submodules: false
- name: Generate changelog
run: |
set +x
git fetch --unshallow
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@v3
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
|