• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: windows
2
3on: [push, pull_request]
4
5permissions:
6  contents: read
7
8jobs:
9  build:
10    runs-on: ${{matrix.os}}
11    strategy:
12      matrix:
13        # windows-2019 has MSVC 2019 installed;
14        # windows-2022 has MSVC 2022 installed:
15        # https://github.com/actions/virtual-environments.
16        os: [windows-2019]
17        platform: [Win32, x64]
18        toolset: [v141, v142]
19        standard: [14, 17, 20]
20        shared: ["", -DBUILD_SHARED_LIBS=ON]
21        build_type: [Debug, Release]
22        exclude:
23          - { toolset: v141, standard: 20 }
24          - { toolset: v142, standard: 14 }
25          - { platform: Win32, toolset: v141 }
26          - { platform: Win32, standard: 14 }
27          - { platform: Win32, standard: 20 }
28          - { platform: x64, toolset: v141, shared: -DBUILD_SHARED_LIBS=ON }
29          - { platform: x64, standard: 14, shared: -DBUILD_SHARED_LIBS=ON }
30          - { platform: x64, standard: 20, shared: -DBUILD_SHARED_LIBS=ON }
31        include:
32          - os: windows-2022
33            platform: x64
34            toolset: v143
35            build_type: Debug
36            standard: 20
37
38    steps:
39    - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
40
41    - name: Set timezone
42      run: tzutil /s "Ekaterinburg Standard Time"
43
44    - name: Create Build Environment
45      run: cmake -E make_directory ${{runner.workspace}}/build
46
47    - name: Configure
48      # Use a bash shell for $GITHUB_WORKSPACE.
49      shell: bash
50      working-directory: ${{runner.workspace}}/build
51      run: |
52        cmake -A ${{matrix.platform}} -T ${{matrix.toolset}} \
53              -DCMAKE_CXX_STANDARD=${{matrix.standard}} \
54              ${{matrix.shared}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
55              $GITHUB_WORKSPACE
56
57    - name: Build
58      working-directory: ${{runner.workspace}}/build
59      run: |
60        $threads = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
61        cmake --build . --config ${{matrix.build_type}} --parallel $threads
62
63    - name: Test
64      working-directory: ${{runner.workspace}}/build
65      run: ctest -C ${{matrix.build_type}} -V
66      env:
67        CTEST_OUTPUT_ON_FAILURE: True
68
69  mingw:
70    runs-on: windows-latest
71    defaults:
72      run:
73        shell: msys2 {0}
74    strategy:
75      matrix:
76        sys: [ mingw64, ucrt64 ]
77    steps:
78    - name: Set timezone
79      run: tzutil /s "Ekaterinburg Standard Time"
80      shell: cmd
81    - uses: msys2/setup-msys2@5df0ca6cbf14efcd08f8d5bd5e049a3cc8e07fd2 # v2.24.0
82      with:
83        release: false
84        msystem: ${{matrix.sys}}
85        pacboy: cc:p cmake:p ninja:p lld:p
86    - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
87    - name: Configure
88      run: cmake -B ../build -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Debug
89      env: { LDFLAGS: -fuse-ld=lld }
90    - name: Build
91      run: cmake --build ../build
92    - name: Test
93      run: ctest -j `nproc` --test-dir ../build
94      env:
95        CTEST_OUTPUT_ON_FAILURE: True
96