xref: /libuv/.github/workflows/CI-win.yml (revision 9b3b61f6)
1name: CI-win
2
3on:
4  pull_request:
5    paths:
6      - '**'
7      - '!docs/**'
8      - '!src/unix/**'
9      - '!.**'
10      - '.github/workflows/CI-win.yml'
11  push:
12    branches:
13      - v[0-9].*
14      - master
15
16jobs:
17  build-windows:
18    runs-on: windows-${{ matrix.config.server }}
19    name: build-${{ join(matrix.config.*, '-') }}
20    strategy:
21      fail-fast: false
22      matrix:
23        config:
24          - {toolchain: Visual Studio 16 2019, arch: Win32, server: 2019}
25          - {toolchain: Visual Studio 16 2019, arch: x64, server: 2019}
26          - {toolchain: Visual Studio 17 2022, arch: Win32, server: 2022}
27          - {toolchain: Visual Studio 17 2022, arch: x64, server: 2022}
28          - {toolchain: Visual Studio 17 2022, arch: x64, server: 2022, config: ASAN}
29          - {toolchain: Visual Studio 17 2022, arch: x64, server: 2022, config: UBSAN}
30          - {toolchain: Visual Studio 17 2022, arch: arm64, server: 2022}
31    steps:
32      - uses: actions/checkout@v4
33      - name: Build
34        run:
35          cmake -S . -B build -DBUILD_TESTING=ON
36            -G "${{ matrix.config.toolchain }}" -A ${{ matrix.config.arch }}
37            ${{ matrix.config.config == 'ASAN' && '-DASAN=on -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded' || '' }}
38
39          cmake --build build --config RelWithDebInfo
40
41          ${{ matrix.config.config == 'ASAN' && 'Copy-Item -Path "build\\*.exe" -Destination "build\\RelWithDebInfo\\"' || '' }}
42
43          ${{ matrix.config.config == 'ASAN' && 'Copy-Item -Path "build\\*.dll" -Destination "build\\RelWithDebInfo\\"' || '' }}
44
45          ls -l build
46
47          ls -l build\\RelWithDebInfo
48      - name: platform_output_a
49        if: ${{ matrix.config.arch != 'arm64' }}
50        shell: cmd
51        run:
52          build\\RelWithDebInfo\\uv_run_tests_a.exe platform_output
53      - name: platform_output
54        if: ${{ matrix.config.arch != 'arm64' }}
55        shell: cmd
56        run:
57          build\\RelWithDebInfo\\uv_run_tests.exe platform_output
58      - name: Test
59        # only valid with libuv-master with the fix for
60        # https://github.com/libuv/leps/blob/master/005-windows-handles-not-fd.md
61        if: ${{ matrix.config.config != 'ASAN' && matrix.config.arch != 'arm64' }}
62        shell: cmd
63        run:
64          cd build
65
66          ctest -C RelWithDebInfo -V
67      - name: Test only static
68        if: ${{ matrix.config.config == 'ASAN' && matrix.config.arch != 'arm64' }}
69        shell: cmd
70        run:
71          build\\RelWithDebInfo\\uv_run_tests_a.exe
72
73  build-mingw:
74    runs-on: ubuntu-latest
75    name: build-mingw-${{ matrix.config.arch }}
76    strategy:
77      fail-fast: false
78      matrix:
79        config:
80          - {arch: i686,   server: 2022, libgcc: dw2 }
81          - {arch: x86_64, server: 2022, libgcc: seh }
82    steps:
83      - uses: actions/checkout@v4
84      - name: Install mingw32 environment
85        run: |
86          sudo apt update
87          sudo apt install mingw-w64 ninja-build -y
88      - name: Build
89        run: |
90          cmake -S . -B build -G Ninja -DHOST_ARCH=${{ matrix.config.arch }} -DBUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE=cmake-toolchains/cross-mingw32.cmake
91          cmake --build build
92          cmake --install build --prefix "`pwd`/build/usr"
93          mkdir -p build/usr/test build/usr/bin
94          cp -av test/fixtures build/usr/test
95          cp -av build/uv_run_tests_a.exe build/uv_run_tests.exe build/uv_run_tests_a_no_ext build/uv_run_tests_no_ext \
96             `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libgcc_s_${{ matrix.config.libgcc }}-1.dll` \
97             `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libwinpthread-1.dll` \
98             `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libatomic-1.dll` \
99             build/usr/bin
100      - name: Upload build artifacts
101        uses: actions/upload-artifact@v4
102        with:
103          name: mingw-${{ matrix.config.arch }}
104          path: build/usr/**/*
105          retention-days: 2
106
107  test-mingw:
108    runs-on: windows-${{ matrix.config.server }}
109    name: test-mingw-${{ matrix.config.arch }}
110    needs: build-mingw
111    strategy:
112      fail-fast: false
113      matrix:
114        config:
115          - {arch: i686,   server: 2022}
116          - {arch: x86_64, server: 2022}
117    steps:
118      - name: Download build artifacts
119        uses: actions/download-artifact@v4
120        with:
121          name: mingw-${{ matrix.config.arch }}
122      - name: Test
123        shell: cmd
124        run: |
125          bin\uv_run_tests_a.exe
126      - name: Test
127        shell: cmd
128        run: |
129          bin\uv_run_tests.exe
130