ci: build with MSVC in GHA

Message ID 20250213075010.2670431-1-david.marchand@redhat.com (mailing list archive)
State Accepted
Delegated to: David Marchand
Headers
Series ci: build with MSVC in GHA |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-compile-arm64-testing pending Testing pending
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

David Marchand Feb. 13, 2025, 7:50 a.m. UTC
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.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
  

Comments

Aaron Conole Feb. 18, 2025, 1:32 p.m. UTC | #1
David Marchand <david.marchand@redhat.com> writes:

> 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.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---

LGTM.

Acked-by: Aaron Conole <aconole@redhat.com>

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

>  .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
>
> diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
> index dcafb4a8f5..aef692ca1f 100644
> --- a/.github/workflows/build.yml
> +++ b/.github/workflows/build.yml
> @@ -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
  
David Marchand Feb. 18, 2025, 2:10 p.m. UTC | #2
On Tue, Feb 18, 2025 at 2:32 PM Aaron Conole <aconole@redhat.com> wrote:
>
> David Marchand <david.marchand@redhat.com> writes:
>
> > 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.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
>
> LGTM.
>
> Acked-by: Aaron Conole <aconole@redhat.com>
>
> 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).
  
Andre Muezerie Feb. 18, 2025, 3:35 p.m. UTC | #3
On Tue, Feb 18, 2025 at 03:10:13PM +0100, David Marchand wrote:
> On Tue, Feb 18, 2025 at 2:32 PM Aaron Conole <aconole@redhat.com> wrote:
> >
> > David Marchand <david.marchand@redhat.com> writes:
> >
> > > 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.
> > >
> > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > ---
> >
> > LGTM.
> >
> > Acked-by: Aaron Conole <aconole@redhat.com>
> >
> > 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).
> 
> 
> -- 
> David Marchand

LGTM.
--
Andre Muezerie
  
Aaron Conole Feb. 18, 2025, 7:45 p.m. UTC | #4
David Marchand <david.marchand@redhat.com> writes:

> On Tue, Feb 18, 2025 at 2:32 PM Aaron Conole <aconole@redhat.com> wrote:
>>
>> David Marchand <david.marchand@redhat.com> writes:
>>
>> > 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.
>> >
>> > Signed-off-by: David Marchand <david.marchand@redhat.com>
>> > ---
>>
>> LGTM.
>>
>> Acked-by: Aaron Conole <aconole@redhat.com>
>>
>> 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.
  
David Marchand Feb. 19, 2025, 8:09 a.m. UTC | #5
On Tue, Feb 18, 2025 at 4:36 PM Andre Muezerie
<andremue@linux.microsoft.com> wrote:
> > > > 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.

Cc: stable@dpdk.org

> > > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > Acked-by: Aaron Conole <aconole@redhat.com>
> LGTM.
> --
> Andre Muezerie

Applied, thanks.
  

Patch

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index dcafb4a8f5..aef692ca1f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -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