git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 11/11] ci: wire up Visual Studio build with Meson

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 22, 2025, 12:05 UTC
Message-ID
<20250122-b4-pks-meson-additions-v3-11-5a51eb5d3dcd@pks.im>
In-Reply-To
<20250122-b4-pks-meson-additions-v3-0-5a51eb5d3dcd@pks.im>

Add a new job to GitHub Actions and GitLab CI that builds and tests Meson-based builds with Visual Studio.

A couple notes:
  - While the build job is mandatory, the test job is marked as "manual"
    on GitLab 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.
    The same isn't true for GitHub as I could not find a way to make a
    subset of jobs manually triggered.
  - 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.
  - We don't process test artifacts for failed CI jobs. This is done to
    keep down prerequisites to a minimum.
All tests are passing.
[1]: https://github.com/mesonbuild/meson/pull/14092
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 .github/workflows/main.yml | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 .gitlab-ci.yml             | 38 +++++++++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 900be9957a..7f55f8b3a9 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -248,6 +248,58 @@ jobs:
       with:
         name: failed-tests-windows-vs-${{ matrix.nr }}
         path: ${{env.FAILED_TEST_ARTIFACTS}}
+
+  windows-meson-build:
+    name: win+Meson build
+    needs: ci-config
+    if: needs.ci-config.outputs.enabled == 'yes'
+    runs-on: windows-latest
+    concurrency:
+      group: windows-meson-build-${{ github.ref }}
+      cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
+    steps:
+    - uses: actions/checkout@v4
+    - uses: actions/setup-python@v5
+    - name: Set up dependencies
+      shell: pwsh
+      run: pip install meson ninja
+    - name: Setup
+      shell: pwsh
+      run: meson setup build -Dperl=disabled
+    - name: Compile
+      shell: pwsh
+      run: meson compile -C build
+    - name: Upload build artifacts
+      uses: actions/upload-artifact@v4
+      with:
+        name: windows-meson-artifacts
+        path: build
+  windows-meson-test:
+    name: win+Meson test
+    runs-on: windows-latest
+    needs: [ci-config, windows-meson-build]
+    strategy:
+      fail-fast: false
+      matrix:
+        nr: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+    concurrency:
+      group: windows-meson-test-${{ matrix.nr }}-${{ github.ref }}
+      cancel-in-progress: ${{ needs.ci-config.outputs.skip_concurrent == 'yes' }}
+    steps:
+    - uses: actions/checkout@v4
+    - uses: actions/setup-python@v5
+    - name: Set up dependencies
+      shell: pwsh
+      run: pip install meson ninja
+    - name: Download build artifacts
+      uses: actions/download-artifact@v4
+      with:
+        name: windows-meson-artifacts
+        path: build
+    - name: Test
+      shell: pwsh
+      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 --print-errorlogs $_.Group }
+
   regular:
     name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})
     needs: ci-config
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9254e01583..4976e18a05 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -149,6 +149,44 @@ test:mingw64:
     - git-sdk/usr/bin/bash.exe -l -c 'ci/print-test-failures.sh'
   parallel: 10
 
+.msvc-meson:
+  tags:
+    - saas-windows-medium-amd64
+  before_script:
+    - choco install -y git meson ninja openssl
+    - Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
+    - refreshenv
+    # The certificate store for Python on Windows is broken and fails to fetch
+    # certificates, see https://bugs.python.org/issue36011. This seems to
+    # mostly be an issue with how the GitLab image is set up as it is a
+    # non-issue on GitHub Actions. Work around the issue by importing
+    # cetrificates manually.
+    - Invoke-WebRequest https://curl.haxx.se/ca/cacert.pem -OutFile cacert.pem
+    - openssl pkcs12 -export -nokeys -in cacert.pem -out certs.pfx -passout "pass:"
+    - Import-PfxCertificate -CertStoreLocation Cert:\LocalMachine\Root -FilePath certs.pfx
+
+build:msvc-meson:
+  extends: .msvc-meson
+  stage: build
+  script:
+    - meson setup build -Dperl=disabled
+    - meson compile -C build
+  artifacts:
+    paths:
+      - build
+
+test:msvc-meson:
+  extends: .msvc-meson
+  stage: test
+  when: manual
+  timeout: 6h
+  needs:
+    - job: "build:msvc-meson"
+      artifacts: true
+  script:
+    - 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 --print-errorlogs $_.Group }
+  parallel: 10
+
 test:fuzz-smoke-tests:
   image: ubuntu:latest
   stage: test
-- 
2.48.1.321.gbf1f004a4a.dirty
Previous: Patrick SteinhardtNext: Junio C Hamano
Message 34 of 35 in “meson: a couple of additions”
  1. 0/9 meson: a couple of additionsPatrick Steinhardt, Jan 13, 2025
  2. 1/9 GIT-VERSION-GEN: simplify computing the dirty markerPatrick Steinhardt, Jan 13, 2025
  3. 2/9 GIT-VERSION-GEN: move default version into a separate filePatrick Steinhardt, Jan 13, 2025
  4. Junio C HamanoJan 13, 2025
  5. Eli SchwartzJan 13, 2025
  6. Patrick SteinhardtJan 14, 2025
  7. 3/9 meson: fix dependencies for generated headersPatrick Steinhardt, Jan 13, 2025
  8. 4/9 meson: wire up development environmentsPatrick Steinhardt, Jan 13, 2025
  9. 6/9 meson: wire up fuzzersPatrick Steinhardt, Jan 13, 2025
  10. Junio C HamanoJan 13, 2025
  11. Patrick SteinhardtJan 14, 2025
  12. 5/9 meson: wire up generation of distribution archivePatrick Steinhardt, Jan 13, 2025
  13. Junio C HamanoJan 13, 2025
  14. Patrick SteinhardtJan 14, 2025
  15. 7/9 meson: make the CSPRNG backend configurablePatrick Steinhardt, Jan 13, 2025
  16. Patrick SteinhardtJan 13, 2025
  17. Junio C HamanoJan 13, 2025
  18. Patrick SteinhardtJan 14, 2025
  19. Junio C HamanoJan 14, 2025
  20. 8/9 meson: fix compilation with Visual StudioPatrick Steinhardt, Jan 13, 2025
  21. M HickfordJan 13, 2025
  22. 9/9 ci: wire up Visual Studio build with MesonPatrick Steinhardt, Jan 13, 2025
  23. 00/11 meson: a couple of additionsPatrick Steinhardt, Jan 22, 2025
  24. 01/11 GIT-VERSION-GEN: simplify computing the dirty markerPatrick Steinhardt, Jan 22, 2025
  25. 02/11 GIT-VERSION-GEN: allow running without input and output filesPatrick Steinhardt, Jan 22, 2025
  26. 03/11 meson: populate project version via GIT-VERSION-GENPatrick Steinhardt, Jan 22, 2025
  27. 04/11 meson: fix dependencies for generated headersPatrick Steinhardt, Jan 22, 2025
  28. 05/11 meson: wire up development environmentsPatrick Steinhardt, Jan 22, 2025
  29. 06/11 meson: wire up generation of distribution archivePatrick Steinhardt, Jan 22, 2025
  30. 07/11 meson: wire up fuzzersPatrick Steinhardt, Jan 22, 2025
  31. 08/11 meson: make the CSPRNG backend configurablePatrick Steinhardt, Jan 22, 2025
  32. 09/11 meson: fix compilation with Visual StudioPatrick Steinhardt, Jan 22, 2025
  33. 10/11 ci: raise error when Meson generates warningsPatrick Steinhardt, Jan 22, 2025
  34. 11/11 ci: wire up Visual Studio build with MesonPatrick Steinhardt, Jan 22, 2025
  35. Junio C HamanoJan 22, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.