Skip to content

Commit 7a4f1fc

Browse files
committed
ci: wire up Visual Studio build with Meson
Add a new job to GitHub Actions and GitLab CI that builds and tests Meson-based builds with Visual Studio. While the build job is mandatory, the test job is marked as "manual" so that it doesn't run by default. We already have a bunch of Windows-based jobs, and the computational overhead that these cause is simply out of proportion to run the test suite twice. A couple notes: - We disable Perl. This is because we pick up Perl from Git for Windows, which outputs different paths ("/c/" instead of "C:\") than what we expect in our tests. - We don't use the Git for Windows SDK. Instead, the build only depends on Visual Studio, Meson and Git for Windows. All the other dependencies like curl, pcre2 and zlib get pulled in and compiled automatically by Meson and thus do not have to be provided by the system. - We open-code "ci/run-test-slice.sh". This is because we only have direct access to PowerShell, so we manually implement the logic. There is an upstream pull request for the Meson build system [1] to implement test slicing in Meson directly. All tests are passing. [1]: mesonbuild/meson#14092 Signed-off-by: Patrick Steinhardt <ps@pks.im>
1 parent 2e0e074 commit 7a4f1fc

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/main.yml

+52
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,58 @@ jobs:
248248
with:
249249
name: failed-tests-windows-vs-${{ matrix.nr }}
250250
path: ${{env.FAILED_TEST_ARTIFACTS}}
251+
252+
windows-meson-build:
253+
name: win+Meson build
254+
needs: ci-config
255+
if: needs.ci-config.outputs.enabled == 'yes'
256+
runs-on: windows-latest
257+
concurrency:
258+
group: windows-meson-build-${{ github.ref }}
259+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
260+
steps:
261+
- uses: actions/checkout@v4
262+
- uses: actions/setup-python@v5
263+
- name: Set up dependencies
264+
shell: pwsh
265+
run: pip install meson ninja
266+
- name: Setup
267+
shell: pwsh
268+
run: meson setup build -Dperl=disabled
269+
- name: Compile
270+
shell: pwsh
271+
run: meson compile -C build
272+
- name: Upload build artifacts
273+
uses: actions/upload-artifact@v4
274+
with:
275+
name: windows-meson-artifacts
276+
path: build
277+
windows-meson-test:
278+
name: win+Meson test
279+
runs-on: windows-latest
280+
needs: [ci-config, windows-meson-build]
281+
strategy:
282+
fail-fast: false
283+
matrix:
284+
nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
285+
concurrency:
286+
group: windows-meson-test-${{ matrix.nr }}-${{ github.ref }}
287+
cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
288+
steps:
289+
- uses: actions/checkout@v4
290+
- uses: actions/setup-python@v5
291+
- name: Set up dependencies
292+
shell: pwsh
293+
run: pip install meson ninja
294+
- name: Download build artifacts
295+
uses: actions/download-artifact@v4
296+
with:
297+
name: windows-meson-artifacts
298+
path: build
299+
- name: Test
300+
shell: pwsh
301+
run: meson test -C build --list | Select-Object -Skip 1 | Select-String .* | Group-Object -Property { $_.LineNumber % 10 } | Where-Object Name -EQ ${{ matrix.nr }} | ForEach-Object { meson test -C build --no-rebuild $_.Group }
302+
251303
regular:
252304
name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})
253305
needs: ci-config

.gitlab-ci.yml

+38
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,44 @@ test:mingw64:
149149
- git-sdk/usr/bin/bash.exe -l -c 'ci/print-test-failures.sh'
150150
parallel: 10
151151

152+
.msvc-meson:
153+
tags:
154+
- saas-windows-medium-amd64
155+
before_script:
156+
- choco install -y git meson ninja openssl
157+
- Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
158+
- refreshenv
159+
# The certificate store for Python on Windows is broken and fails to fetch
160+
# certificates, see https://bugs.python.org/issue36011. This seems to
161+
# mostly be an issue with how the GitLab image is set up as it is a
162+
# non-issue on GitHub Actions. Work around the issue by importing
163+
# cetrificates manually.
164+
- Invoke-WebRequest https://curl.haxx.se/ca/cacert.pem -OutFile cacert.pem
165+
- openssl pkcs12 -export -nokeys -in cacert.pem -out certs.pfx -passout "pass:"
166+
- Import-PfxCertificate -CertStoreLocation Cert:\LocalMachine\Root -FilePath certs.pfx
167+
168+
build:msvc-meson:
169+
extends: .msvc-meson
170+
stage: build
171+
script:
172+
- meson setup build -Dperl=disabled
173+
- meson compile -C build
174+
artifacts:
175+
paths:
176+
- build
177+
178+
test:msvc-meson:
179+
extends: .msvc-meson
180+
stage: test
181+
when: manual
182+
timeout: 6h
183+
needs:
184+
- job: "build:msvc-meson"
185+
artifacts: true
186+
script:
187+
- meson test -C build --list | Select-Object -Skip 1 | Select-String .* | Group-Object -Property { $_.LineNumber % $Env:CI_NODE_TOTAL + 1 } | Where-Object Name -EQ $Env:CI_NODE_INDEX | ForEach-Object { meson test -C build --no-rebuild $_.Group }
188+
parallel: 10
189+
152190
test:fuzz-smoke-tests:
153191
image: ubuntu:latest
154192
stage: test

0 commit comments

Comments
 (0)