Skip to contentSkip to conversation

ci: build with MSVC in GHA

PATCH In review David Marchand 3 participants 6 messages Feb 13, 2025 – Feb 19, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ci: build with MSVC in GHA

Add a build target in Windows 2022 for MSVC.

Loading MSVC environment and having successive commands in a single (cmd or pwsh) shell does not seem to correctly report if one of the commands failed.
For now, load MSVC environment and run commands in separate shells.

---
 .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
.github/workflows/build.yml +38 -0
index dcafb4a8f5..aef692ca1f 100644
@@ -174,6 +174,44 @@ jobs:
           build/meson-logs/meson-log.txt
           build/meson-logs/testlog.txt
 
+  windows-vm-builds:
+    name: ${{ join(matrix.config.*, '-') }}
+    runs-on: ${{ matrix.config.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - os: windows-2022
+            compiler: msvc
+
+    steps:
+    - name: Checkout sources
+      uses: actions/checkout@v4
+    - name: Set up Python
+      uses: actions/setup-python@v5
+      with:
+        python-version: '3.x'
+    - name: Install dependencies
+      run: python -m pip install meson==1.6.1 ninja
+    - name: Configure
+      shell: cmd
+      run: |
+        call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=amd64 -arch=amd64
+        meson setup -Denable_stdatomic=true build
+    - name: Build
+      shell: cmd
+      run: |
+        call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=amd64 -arch=amd64
+        meson compile -C build
+    - name: Upload logs on failure
+      if: failure()
+      uses: actions/upload-artifact@v4
+      with:
+        name: meson-logs-${{ join(matrix.config.*, '-') }}
+        path: |
+          build/.ninja_log
+          build/meson-logs/meson-log.txt
+
   prepare-container-images:
     name: ${{ join(matrix.config.*, '-') }}
     runs-on: ubuntu-latest
Signature · 1 line
2.48.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · David Marchand

Add a build target in Windows 2022 for MSVC.

Loading MSVC environment and having successive commands in a single (cmd or pwsh) shell does not seem to correctly report if one of the commands failed.
For now, load MSVC environment and run commands in separate shells.

---

LGTM.

How far back will this work (ie: can we backport this to older branches?)

Quoted 52 lines
 .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
.github/workflows/build.yml +38 -0
index dcafb4a8f5..aef692ca1f 100644
@@ -174,6 +174,44 @@ jobs:
           build/meson-logs/meson-log.txt
           build/meson-logs/testlog.txt
 
+  windows-vm-builds:
+    name: ${{ join(matrix.config.*, '-') }}
+    runs-on: ${{ matrix.config.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        config:
+          - os: windows-2022
+            compiler: msvc
+
+    steps:
+    - name: Checkout sources
+      uses: actions/checkout@v4
+    - name: Set up Python
+      uses: actions/setup-python@v5
+      with:
+        python-version: '3.x'
+    - name: Install dependencies
+      run: python -m pip install meson==1.6.1 ninja
+    - name: Configure
+      shell: cmd
+      run: |
+        call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=amd64 -arch=amd64
+        meson setup -Denable_stdatomic=true build
+    - name: Build
+      shell: cmd
+      run: |
+        call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -host_arch=amd64 -arch=amd64
+        meson compile -C build
+    - name: Upload logs on failure
+      if: failure()
+      uses: actions/upload-artifact@v4
+      with:
+        name: meson-logs-${{ join(matrix.config.*, '-') }}
+        path: |
+          build/.ninja_log
+          build/meson-logs/meson-log.txt
+
   prepare-container-images:
     name: ${{ join(matrix.config.*, '-') }}
     runs-on: ubuntu-latest
#2 lore raw
Quoted 10 lines · Aaron Conole
Quoted 7 lines · David Marchand

Add a build target in Windows 2022 for MSVC.

Loading MSVC environment and having successive commands in a single (cmd or pwsh) shell does not seem to correctly report if one of the commands failed.
For now, load MSVC environment and run commands in separate shells.

Quoted 8 lines
Quoted 2 lines

---

LGTM.

How far back will this work (ie: can we backport this to older branches?)

MSVC was added in 23.11.
The patch applies cleanly and runs on 23.11 (where only lib/kvargs, lib/log and lib/telemetry are compiled) and 24.11.

I can add Cc: stable if you think it is worth having it in LTS (UNH provides some coverage in LTS releases).

Signature · 1 line
David Marchand
#3 lore raw
Quoted 18 lines · David Marchand
Quoted 17 lines · Aaron Conole
Quoted 9 lines · David Marchand

Add a build target in Windows 2022 for MSVC.

Loading MSVC environment and having successive commands in a single (cmd or pwsh) shell does not seem to correctly report if one of the commands failed.
For now, load MSVC environment and run commands in separate shells.

---

LGTM.

Quoted 12 lines
Quoted 1 line

How far back will this work (ie: can we backport this to older branches?)

MSVC was added in 23.11.
The patch applies cleanly and runs on 23.11 (where only lib/kvargs, lib/log and lib/telemetry are compiled) and 24.11.

I can add Cc: stable if you think it is worth having it in LTS (UNH provides some coverage in LTS releases).

Signature · 1 line
David Marchand

LGTM.
--
Andre Muezerie

author Applied
#4 lore raw
Quoted 6 lines · Andre Muezerie
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

Add a build target in Windows 2022 for MSVC.

Loading MSVC environment and having successive commands in a single (cmd or pwsh) shell does not seem to correctly report if one of the commands failed.
For now, load MSVC environment and run commands in separate shells.

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 1 line

LGTM.
--
Andre Muezerie

Applied, thanks.

Signature · 1 line
David Marchand
#5 lore raw
In reply to David Marchand
Quoted 18 lines · David Marchand
Quoted 17 lines · Aaron Conole
Quoted 9 lines · David Marchand

Add a build target in Windows 2022 for MSVC.

Loading MSVC environment and having successive commands in a single (cmd or pwsh) shell does not seem to correctly report if one of the commands failed.
For now, load MSVC environment and run commands in separate shells.

---

LGTM.

Quoted 8 lines
Quoted 1 line

How far back will this work (ie: can we backport this to older branches?)

MSVC was added in 23.11.
The patch applies cleanly and runs on 23.11 (where only lib/kvargs, lib/log and lib/telemetry are compiled) and 24.11.

I can add Cc: stable if you think it is worth having it in LTS (UNH provides some coverage in LTS releases).

I usually prefer to back-port CI related changes because it helps us catch issues / improve the stable release cycle.