xref: /libuv/.github/workflows/CI-win.yml (revision 3f7191e5)
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@v2
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                matrix.config.config == 'UBSAN' && '-DUBSAN=on' || '' }}
39
40          cmake --build build --config RelWithDebInfo
41
42          ${{ matrix.config.config == 'ASAN' && 'Copy-Item -Path "build\\*.exe" -Destination "build\\RelWithDebInfo\\"' || '' }}
43
44          ${{ matrix.config.config == 'ASAN' && 'Copy-Item -Path "build\\*.dll" -Destination "build\\RelWithDebInfo\\"' || '' }}
45
46          ls -l build
47
48          ls -l build\\RelWithDebInfo
49      - name: platform_output_a
50        if: ${{ matrix.config.arch != 'arm64' }}
51        shell: cmd
52        run:
53          build\\RelWithDebInfo\\uv_run_tests_a.exe platform_output
54      - name: platform_output
55        if: ${{ matrix.config.arch != 'arm64' }}
56        shell: cmd
57        run:
58          build\\RelWithDebInfo\\uv_run_tests.exe platform_output
59      - name: Test
60        # only valid with libuv-master with the fix for
61        # https://github.com/libuv/leps/blob/master/005-windows-handles-not-fd.md
62        if: ${{ matrix.config.config != 'ASAN' && matrix.config.arch != 'arm64' }}
63        shell: cmd
64        run:
65          cd build
66
67          ctest -C RelWithDebInfo -V
68      - name: Test only static
69        if: ${{ matrix.config.config == 'ASAN' && matrix.config.arch != 'arm64' }}
70        shell: cmd
71        run:
72          build\\RelWithDebInfo\\uv_run_tests_a.exe
73
74  build-mingw:
75    runs-on: ubuntu-latest
76    name: build-mingw-${{ matrix.config.arch }}
77    strategy:
78      fail-fast: false
79      matrix:
80        config:
81          - {arch: i686,   server: 2022, libgcc: dw2 }
82          - {arch: x86_64, server: 2022, libgcc: seh }
83    steps:
84      - uses: actions/checkout@v3
85      - name: Install mingw32 environment
86        run: |
87          sudo apt update
88          sudo apt install mingw-w64 ninja-build -y
89      - name: Build
90        run: |
91          cmake -S . -B build -G Ninja -DHOST_ARCH=${{ matrix.config.arch }} -DBUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE=cmake-toolchains/cross-mingw32.cmake
92          cmake --build build
93          cmake --install build --prefix "`pwd`/build/usr"
94          mkdir -p build/usr/test build/usr/bin
95          cp -av test/fixtures build/usr/test
96          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 \
97             `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libgcc_s_${{ matrix.config.libgcc }}-1.dll` \
98             `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libwinpthread-1.dll` \
99             `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libatomic-1.dll` \
100             build/usr/bin
101      - name: Upload build artifacts
102        uses: actions/upload-artifact@v3
103        with:
104          name: mingw-${{ matrix.config.arch }}
105          path: build/usr/**/*
106          retention-days: 2
107
108  test-mingw:
109    runs-on: windows-${{ matrix.config.server }}
110    name: test-mingw-${{ matrix.config.arch }}
111    needs: build-mingw
112    strategy:
113      fail-fast: false
114      matrix:
115        config:
116          - {arch: i686,   server: 2022}
117          - {arch: x86_64, server: 2022}
118    steps:
119      - name: Download build artifacts
120        uses: actions/download-artifact@v2
121        with:
122          name: mingw-${{ matrix.config.arch }}
123      - name: Test
124        shell: cmd
125        run: |
126          bin\uv_run_tests_a.exe
127      - name: Test
128        shell: cmd
129        run: |
130          bin\uv_run_tests.exe
131