1name: Config
2
3on:
4  workflow_dispatch:
5  pull_request:
6  push:
7    branches:
8      - master
9      - stable
10      - v*
11
12jobs:
13  # This tests various versions of CMake in various combinations, to make sure
14  # the configure step passes.
15  cmake:
16    strategy:
17      fail-fast: false
18      matrix:
19        runs-on: [ubuntu-latest, macos-latest, windows-latest]
20        arch: [x64]
21        cmake: [3.18]
22
23        include:
24        - runs-on: ubuntu-latest
25          arch: x64
26          cmake: 3.4
27
28        - runs-on: macos-latest
29          arch: x64
30          cmake: 3.7
31
32        - runs-on: windows-2016
33          arch: x86
34          cmake: 3.8
35
36        - runs-on: windows-2016
37          arch: x86
38          cmake: 3.18
39
40    name: �� 3.7 • CMake ${{ matrix.cmake }} • ${{ matrix.runs-on }}
41    runs-on: ${{ matrix.runs-on }}
42
43    steps:
44    - uses: actions/checkout@v2
45
46    - name: Setup Python 3.7
47      uses: actions/setup-python@v2
48      with:
49        python-version: 3.7
50        architecture: ${{ matrix.arch }}
51
52    - name: Prepare env
53      run: python -m pip install -r tests/requirements.txt
54
55    # An action for adding a specific version of CMake:
56    #   https://github.com/jwlawson/actions-setup-cmake
57    - name: Setup CMake ${{ matrix.cmake }}
58      uses: jwlawson/actions-setup-cmake@v1.7
59      with:
60        cmake-version: ${{ matrix.cmake }}
61
62    # These steps use a directory with a space in it intentionally
63    - name: Make build directories
64      run: mkdir "build dir"
65
66    - name: Configure
67      working-directory: build dir
68      shell: bash
69      run: >
70        cmake ..
71        -DPYBIND11_WERROR=ON
72        -DDOWNLOAD_CATCH=ON
73        -DPYTHON_EXECUTABLE=$(python -c "import sys; print(sys.executable)")
74
75    # Only build and test if this was manually triggered in the GitHub UI
76    - name: Build
77      working-directory: build dir
78      if: github.event_name == 'workflow_dispatch'
79      run: cmake --build . --config Release
80
81    - name: Test
82      working-directory: build dir
83      if: github.event_name == 'workflow_dispatch'
84      run: cmake --build . --config Release --target check
85