aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/CI-win.yml
blob: 0e0a75f4dc2289954b94a2d092325947e4dd9c51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: CI-win

on:
  pull_request:
    paths:
      - '**'
      - '!docs/**'
      - '!src/unix/**'
      - '!.**'
      - '.github/workflows/CI-win.yml'
  push:
    branches:
      - v[0-9].*
      - master

jobs:
  build-windows:
    runs-on: windows-${{ matrix.config.server }}
    name: build-${{ join(matrix.config.*, '-') }}
    strategy:
      fail-fast: false
      matrix:
        config:
          - {toolchain: Visual Studio 17 2022, arch: Win32, server: 2022}
          - {toolchain: Visual Studio 17 2022, arch: x64, server: 2022}
          - {toolchain: Visual Studio 17 2022, arch: x64, server: 2022, config: ASAN}
          - {toolchain: Visual Studio 17 2022, arch: x64, server: 2022, config: UBSAN}
          - {toolchain: Visual Studio 17 2022, arch: arm64, server: 2022}
          - {toolchain: Visual Studio 17 2022, arch: x64, server: 2025}
    steps:
      - uses: actions/checkout@v4
      - name: Build
        run:
          cmake -S . -B build -DBUILD_TESTING=ON
            -G "${{ matrix.config.toolchain }}" -A ${{ matrix.config.arch }}
            ${{ matrix.config.config == 'ASAN' && '-DASAN=on -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded' || '' }}

          cmake --build build --config RelWithDebInfo

          ${{ matrix.config.config == 'ASAN' && 'Copy-Item -Path "build\\*.exe" -Destination "build\\RelWithDebInfo\\"' || '' }}

          ${{ matrix.config.config == 'ASAN' && 'Copy-Item -Path "build\\*.dll" -Destination "build\\RelWithDebInfo\\"' || '' }}

          ls -l build
          
          ls -l build\\RelWithDebInfo
      - name: platform_output_a
        if: ${{ matrix.config.arch != 'arm64' }}
        shell: cmd
        run:
          build\\RelWithDebInfo\\uv_run_tests_a.exe platform_output
      - name: platform_output
        if: ${{ matrix.config.arch != 'arm64' }}
        shell: cmd
        run:
          build\\RelWithDebInfo\\uv_run_tests.exe platform_output
      - name: Test
        # only valid with libuv-master with the fix for
        # https://github.com/libuv/leps/blob/master/005-windows-handles-not-fd.md
        if: ${{ matrix.config.config != 'ASAN' && matrix.config.arch != 'arm64' }}
        shell: cmd
        run:
          cd build

          ctest -C RelWithDebInfo -V
      - name: Test only static
        if: ${{ matrix.config.config == 'ASAN' && matrix.config.arch != 'arm64' }}
        shell: cmd
        run:
          build\\RelWithDebInfo\\uv_run_tests_a.exe

  build-mingw:
    runs-on: ubuntu-latest
    name: build-mingw-${{ matrix.config.arch }}
    strategy:
      fail-fast: false
      matrix:
        config:
          - {arch: i686,   server: 2022, libgcc: dw2 }
          - {arch: x86_64, server: 2022, libgcc: seh }
    steps:
      - uses: actions/checkout@v4
      - name: Install mingw32 environment
        run: |
          sudo apt update
          sudo apt install mingw-w64 ninja-build -y
      - name: Build
        run: |
          cmake -B build -G Ninja -DHOST_ARCH=${{ matrix.config.arch }} -DBUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE=cmake-toolchains/cross-mingw32.cmake
          cmake --build build
          cmake --install build --prefix "`pwd`/build/usr"
          mkdir -p build/usr/test build/usr/bin
          cp -av test/fixtures build/usr/test
          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 \
             `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libgcc_s_${{ matrix.config.libgcc }}-1.dll` \
             `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libwinpthread-1.dll` \
             `${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libatomic-1.dll` \
             build/usr/bin
      - name: Upload build artifacts
        uses: actions/upload-artifact@v4
        with:
          name: mingw-${{ matrix.config.arch }}
          path: build/usr/**/*
          retention-days: 2

  test-mingw:
    runs-on: windows-${{ matrix.config.server }}
    name: test-mingw-${{ matrix.config.arch }}
    needs: build-mingw
    strategy:
      fail-fast: false
      matrix:
        config:
          - {arch: i686,   server: 2022}
          - {arch: x86_64, server: 2022}
    steps:
      - name: Download build artifacts
        uses: actions/download-artifact@v4
        with:
          name: mingw-${{ matrix.config.arch }}
      - name: Test
        shell: cmd
        run: |
          bin\uv_run_tests_a.exe
      - name: Test
        shell: cmd
        run: |
          bin\uv_run_tests.exe