forked from dosbox-staging/dosbox-staging
-
Notifications
You must be signed in to change notification settings - Fork 4
298 lines (261 loc) · 10.4 KB
/
windows-meson-msys2.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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
name: MSYS2 builds
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CCACHE_DIR: "/c/ccache"
CCACHE_MAXSIZE: "64M"
CCACHE_COMPRESS: "true"
BUILD_FLAGS: "-Dbuildtype=release -Db_asneeded=true --force-fallback-for=fluidsynth,mt32emu,slirp -Dtry_static_libs=fluidsynth,mt32emu,opusfile,png,slirp"
BUILD_RELEASE_DIR: build/release
BUILD_DEBUGGER_DIR: build/debugger
jobs:
build_msys2:
name: ${{ matrix.conf.name }}
runs-on: windows-latest
if: github.event_name != 'pull_request' || contains('dreamer,kcgen,ant-222,Wengier,shermp', github.actor) == false
strategy:
matrix:
conf:
- name: GCC (MinGW) x86
toolchain: ""
arch: i686
sys: MINGW32
#max_warnings: 1
- name: GCC (MinGW) x86_64
toolchain: ""
arch: x86_64
sys: MINGW64
#max_warnings: 1
# - name: Clang x86
# toolchain: clang-
# arch: i686
# sys: CLANG32
# #max_warnings: 19
- name: Clang x86_64
toolchain: clang-
arch: x86_64
sys: CLANG64
#max_warnings: 5
- name: GCC +tests
toolchain: ""
arch: x86_64
sys: MINGW64
run_tests: true
#max_warnings: -0
- name: GCC +debugger
toolchain: ""
arch: x86_64
sys: MINGW64
#max_warnings: 3
build_flags: -Denable_debugger=normal
defaults:
run:
shell: msys2 {0}
steps:
- name: Disable git line ending conversion
shell: powershell
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.conf.sys}}
update: true
install: >-
git
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-meson
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-gcc
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-ccache
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-pkgconf
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-python
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-ntldd
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-ncurses
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-glib2
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-fluidsynth
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-munt-mt32emu
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-libpng
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-libslirp
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-opusfile
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-SDL2
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-SDL2_net
mingw-w64-${{matrix.conf.toolchain}}${{matrix.conf.arch}}-zlib
- name: Prepare compiler cache
id: prep-ccache
run: |
mkdir -p "${CCACHE_DIR}"
echo "::set-output name=dir::$(cygpath -w $CCACHE_DIR)"
echo "::set-output name=today::$(date -I)"
echo "::set-output name=yesterday::$(date --date=yesterday -I)"
echo "::set-output name=name_hash::$(echo '${{ matrix.conf.name }}' | shasum | cut -b-8)"
- uses: actions/cache@v2
id: cache-ccache
with:
path: ${{ steps.prep-ccache.outputs.dir }}
key: ccache-msys2-${{ matrix.conf.sys }}-${{ steps.prep-ccache.outputs.name_hash }}-${{ steps.prep-ccache.outputs.today }}-2
restore-keys: |
ccache-msys2-${{ matrix.conf.sys }}-${{ steps.prep-ccache.outputs.name_hash }}-${{ steps.prep-ccache.outputs.yesterday }}-2
- name: Cache subprojects
uses: actions/cache@v2
with:
path: subprojects/packagecache
key: subprojects-${{ hashFiles('subprojects/*.wrap') }}
- name: Log environment
run: ./scripts/log-env.sh
- name: Setup build
run: |
meson setup ${{ matrix.conf.build_flags }} build
- name: Build
run: |
set -xo pipefail
ninja -C build |& tee build.log
ccache -s
- name: Run tests
if: matrix.conf.run_tests
run: meson test -C build --print-errorlogs
- name: Summarize warnings
if: matrix.conf.run_tests != true
#env:
# max_warnings: ${{ matrix.conf.max_warnings }}
run: python ./scripts/count-warnings.py -lf build.log
build_msys2_release:
name: ${{ matrix.conf.name }} Release
runs-on: windows-latest
if: github.event_name != 'pull_request' || contains('dreamer,kcgen,ant-222,Wengier,shermp', github.actor) == false
strategy:
matrix:
conf:
- name: GCC (MinGW) x86
arch: i686
sys: MINGW32
- name: GCC (MinGW) x86_64
arch: x86_64
sys: MINGW64
defaults:
run:
shell: msys2 {0}
steps:
- name: Disable git line ending conversion
shell: powershell
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout repository and submodules
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.conf.sys}}
update: true
install: >-
git
mingw-w64-${{matrix.conf.arch}}-meson
mingw-w64-${{matrix.conf.arch}}-gcc
mingw-w64-${{matrix.conf.arch}}-ccache
mingw-w64-${{matrix.conf.arch}}-pkgconf
mingw-w64-${{matrix.conf.arch}}-ntldd
mingw-w64-${{matrix.conf.arch}}-ncurses
mingw-w64-${{matrix.conf.arch}}-glib2
mingw-w64-${{matrix.conf.arch}}-fluidsynth
mingw-w64-${{matrix.conf.arch}}-munt-mt32emu
mingw-w64-${{matrix.conf.arch}}-libpng
mingw-w64-${{matrix.conf.arch}}-libslirp
mingw-w64-${{matrix.conf.arch}}-opusfile
mingw-w64-${{matrix.conf.arch}}-SDL2
mingw-w64-${{matrix.conf.arch}}-SDL2_net
mingw-w64-${{matrix.conf.arch}}-zlib
- name: Prepare compiler cache
id: prep-ccache
run: |
mkdir -p "${CCACHE_DIR}"
echo "::set-output name=dir::$(cygpath -w $CCACHE_DIR)"
echo "::set-output name=today::$(date -I)"
echo "::set-output name=yesterday::$(date --date=yesterday -I)"
- uses: actions/cache@v2
id: cache-ccache
with:
path: ${{ steps.prep-ccache.outputs.dir }}
key: ccache-msys2-${{matrix.conf.sys}}-release-${{ steps.prep-ccache.outputs.today }}-2
restore-keys: |
ccache-msys2-${{matrix.conf.sys}}-release-${{ steps.prep-ccache.outputs.yesterday }}-2
- name: Cache subprojects
uses: actions/cache@v2
with:
path: subprojects/packagecache
key: subprojects-${{ hashFiles('subprojects/*.wrap') }}-1
- name: Log environment
run: ./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: Inject package name
run: |
set -x
echo "PKG_RELEASE=dosbox-staging-windows-msys2-${{ matrix.conf.arch }}-${{ env.VERSION }}" >> $GITHUB_ENV
- name: Setup release build
run: meson setup $BUILD_FLAGS $BUILD_RELEASE_DIR
- name: Setup debugger build
run: meson setup $BUILD_FLAGS -Denable_debugger=normal $BUILD_DEBUGGER_DIR
- name: Build release
run: ninja -C $BUILD_RELEASE_DIR
- name: Build debugger
run: ninja -C $BUILD_DEBUGGER_DIR
- name: Package
run: |
# Package the debug build to bring in required dependencies such as ncurses
./scripts/create-package.sh \
-p msys2 \
"$BUILD_DEBUGGER_DIR" \
"$PKG_RELEASE"
mv "${PKG_RELEASE}/dosbox.exe" "${PKG_RELEASE}/dosbox_with_debugger.exe"
install -DT "${BUILD_RELEASE_DIR}/dosbox.exe" "${PKG_RELEASE}/dosbox.exe"
- name: Windows Defender AV Scan
shell: powershell
run: |
$ErrorActionPreference = 'Stop'
$dosboxDir = "${{ github.workspace }}\${{ env.PKG_RELEASE }}"
& 'C:\Program Files\Windows Defender\MpCmdRun.exe' -Scan -ScanType 3 -DisableRemediation -File $dosboxDir
if( $LASTEXITCODE -ne 0 ) {
Get-Content -Path $env:TEMP\MpCmdRun.log
Throw "Exit $LASTEXITCODE : Windows Defender found an issue"
}
- name: Upload package
uses: actions/upload-artifact@v2
with:
name: ${{ env.PKG_RELEASE }}
path: ${{ env.PKG_RELEASE }}
# 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_msys2_release
runs-on: windows-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v2
- name: Generate changelog
shell: bash
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@v2
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