• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Test on Windows
2on:
3  push:
4    branches:
5    - master
6  pull_request:
7  workflow_dispatch:
8    inputs:
9      debug_enabled:
10        description: 'Run the tests with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
11        required: false
12        default: false
13  schedule:
14    # Run at 8:13 on the 1st day of each month
15    - cron:  '13 8 1 * *'
16jobs:
17  MSVC:
18    runs-on: ${{matrix.config.runs_on}}
19    strategy:
20      fail-fast: false
21      matrix:
22        config:
23          - {runs_on: windows-2022, msvc_version_year: 2022, msvc_version: 17, multi_config: true, python_path: "C:\\Python39", msvc_program_files: "C:\\Program Files", config: Debug, cxx_standard: 17}
24          - {runs_on: windows-2022, msvc_version_year: 2022, msvc_version: 17, multi_config: true, python_path: "C:\\Python39", msvc_program_files: "C:\\Program Files", config: Release, cxx_standard: 17}
25          - {runs_on: windows-2022, msvc_version_year: 2022, msvc_version: 17, multi_config: false, python_path: "C:\\Python39", msvc_program_files: "C:\\Program Files", config: Debug, cxx_standard: 17}
26          - {runs_on: windows-2022, msvc_version_year: 2022, msvc_version: 17, multi_config: false, python_path: "C:\\Python39", msvc_program_files: "C:\\Program Files", config: Release, cxx_standard: 17}
27          - {runs_on: windows-2022, msvc_version_year: 2022, msvc_version: 17, multi_config: false, python_path: "C:\\Python39", msvc_program_files: "C:\\Program Files", config: Debug}
28          - {runs_on: windows-2022, msvc_version_year: 2022, msvc_version: 17, multi_config: false, python_path: "C:\\Python39", msvc_program_files: "C:\\Program Files", config: Release}
29          - {runs_on: windows-2019, msvc_version_year: 2019, msvc_version: 16, multi_config: false, python_path: "C:\\Python36", msvc_program_files: "C:\\Program Files (x86)", config: Debug, cxx_standard: 17}
30          - {runs_on: windows-2019, msvc_version_year: 2019, msvc_version: 16, multi_config: false, python_path: "C:\\Python36", msvc_program_files: "C:\\Program Files (x86)", config: Release, cxx_standard: 17}
31          - {runs_on: windows-2019, msvc_version_year: 2019, msvc_version: 16, multi_config: false, python_path: "C:\\Python36", msvc_program_files: "C:\\Program Files (x86)", config: Debug}
32          - {runs_on: windows-2019, msvc_version_year: 2019, msvc_version: 16, multi_config: false, python_path: "C:\\Python36", msvc_program_files: "C:\\Program Files (x86)", config: Release}
33    env:
34      PYTHON3_PATH: ${{matrix.config.python_path}}
35      CMAKE_GENERATOR: "Visual Studio ${{matrix.config.msvc_version}} ${{matrix.config.msvc_version_year}}"
36      ADDITIONAL_CMAKE_ARGS: -DFRUIT_USES_BOOST=False -T host=x64
37      CONFIGURATION: ${{matrix.config.config}}
38      VCVARSALL_DIR: "${{matrix.config.msvc_program_files}}\\Microsoft Visual Studio\\${{matrix.config.msvc_version_year}}\\Enterprise\\VC\\Auxiliary\\Build"
39      FRUIT_ALLOW_MULTI_CONFIG: ${{matrix.config.multi_config}}
40    steps:
41      - name: Add msbuild to PATH
42        uses: microsoft/setup-msbuild@v1.1
43      - name: set-cmake-debug-cxx-flags
44        if: matrix.config.config == 'Debug'
45        shell: bash
46        run: echo "ADDITIONAL_CMAKE_ARGS=$ADDITIONAL_CMAKE_ARGS -DCMAKE_CXX_FLAGS=\"/WX /DFRUIT_DEBUG /DFRUIT_EXTRA_DEBUG /D_ITERATOR_DEBUG_LEVEL=2\"" >> $GITHUB_ENV
47      - name: set-cmake-release-cxx-flags
48        if: matrix.config.config == 'Release'
49        shell: bash
50        run: echo "ADDITIONAL_CMAKE_ARGS=$ADDITIONAL_CMAKE_ARGS -DCMAKE_CXX_FLAGS=\"/WX\"" >> $GITHUB_ENV
51      - name: set-cmake-cxx-standard-flag
52        if: matrix.config.cxx_standard != ''
53        shell: bash
54        run: echo "ADDITIONAL_CMAKE_ARGS=$ADDITIONAL_CMAKE_ARGS -DCMAKE_CXX_STANDARD=${{matrix.config.cxx_standard}}" >> $GITHUB_ENV
55      - name: set-cmake-generator-arch-old-style
56        if: matrix.config.msvc_version < 16
57        shell: bash
58        run: echo "CMAKE_GENERATOR=$CMAKE_GENERATOR Win64" >> $GITHUB_ENV
59      - name: set-cmake-generator-arch-new-style
60        if: matrix.config.msvc_version >= 16
61        shell: bash
62        run: echo "ADDITIONAL_CMAKE_ARGS=$ADDITIONAL_CMAKE_ARGS -A x64" >> $GITHUB_ENV
63      - name: set-fruit-allow-multi-config
64        if: matrix.config.multi_config
65        shell: bash
66        run: echo "ADDITIONAL_CMAKE_ARGS=$ADDITIONAL_CMAKE_ARGS -DFRUIT_ALLOW_MULTI_CONFIG=True" >> $GITHUB_ENV
67      - uses: actions/checkout@v3
68      - name: install
69        shell: cmd
70        run: cmd /c extras\scripts\postsubmit.bat
71      - name: Setup tmate session
72        uses: mxschmitt/action-tmate@v3
73        if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled && failure() }}
74
75  MinGW:
76    runs-on: windows-2022
77    strategy:
78      fail-fast: false
79      matrix:
80        config:
81          - {use_boost: false, config: Debug, extra_debug: true}
82          - {use_boost: false, config: Release}
83          - {use_boost: true, config: Release}
84          - {use_boost: true, config: Release, disable_shared_libs: true}
85    env:
86      PYTHON3_PATH: "C:\\Python39"
87      CMAKE_GENERATOR: 'MinGW Makefiles'
88      ADDITIONAL_CMAKE_ARGS: -DBUILD_SHARED_LIBS=${{!matrix.config.disable_shared_libs}} -DFRUIT_ADD_WNO_UNKNOWN_WARNING_OPTION=OFF
89      CONFIGURATION: ${{matrix.config.config}}
90    steps:
91      - name: Set up MinGW
92        uses: egor-tensin/setup-mingw@v2
93      - name: Build Boost
94        uses: egor-tensin/build-boost@v1
95        if: matrix.config.use_boost
96        with:
97          version: 1.80.0
98          libraries: headers
99          configuration: ${{matrix.config.config}}
100      - name: set-cmake-boost-flags
101        if: matrix.config.use_boost
102        shell: bash
103        run: echo "ADDITIONAL_CMAKE_ARGS=$ADDITIONAL_CMAKE_ARGS -DBoost_INCLUDE_DIR=D:\a\fruit\boost" >> $GITHUB_ENV
104      - name: set-cmake-non-boost-flags
105        if: ${{ !matrix.config.use_boost }}
106        shell: bash
107        run: echo "ADDITIONAL_CMAKE_ARGS=$ADDITIONAL_CMAKE_ARGS -DFRUIT_USES_BOOST=False" >> $GITHUB_ENV
108      - name: set-cmake-extra-debug-flags
109        if: matrix.config.extra_debug
110        shell: bash
111        run: echo "ADDITIONAL_CMAKE_ARGS=$ADDITIONAL_CMAKE_ARGS -DCMAKE_CXX_FLAGS=\"-Werror -DFRUIT_DEBUG=1 -DFRUIT_EXTRA_DEBUG=1 -D_GLIBCXX_DEBUG=1\"" >> $GITHUB_ENV
112      - name: set-cmake-no-extra-debug-flags
113        if: ${{ !matrix.config.extra_debug }}
114        shell: bash
115        run: echo "ADDITIONAL_CMAKE_ARGS=$ADDITIONAL_CMAKE_ARGS -DCMAKE_CXX_FLAGS=\"-Werror\"" >> $GITHUB_ENV
116      - uses: actions/checkout@v3
117      - name: install
118        shell: cmd
119        run: cmd /c extras\scripts\postsubmit.bat
120      - name: Setup tmate session
121        uses: mxschmitt/action-tmate@v3
122        if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled && failure() }}
123