|
| 1 | +--- |
1 | 2 | # This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
|
2 | 3 | # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
|
3 | 4 | name: CMake on multiple platforms
|
4 |
| - |
5 | 5 | on:
|
6 | 6 | push:
|
7 |
| - branches: [ "develop" ] |
8 |
| - pull_request: |
9 |
| - branches: [ "main" ] |
| 7 | + branches: ["develop"] |
| 8 | + paths: |
| 9 | + - "**.cpp" |
| 10 | + - "**.hpp" |
| 11 | + - "**.py" |
10 | 12 |
|
| 13 | + pull_request: |
| 14 | + branches: ["main"] |
11 | 15 | jobs:
|
12 | 16 | build:
|
13 | 17 | runs-on: ${{ matrix.os }}
|
14 |
| - |
15 | 18 | strategy:
|
16 | 19 | # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
|
17 | 20 | fail-fast: false
|
18 |
| - |
19 | 21 | # Set up a matrix to run the following 3 configurations:
|
20 | 22 | # 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
|
21 | 23 | # 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
|
22 | 24 | # 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
|
23 | 25 | #
|
24 | 26 | # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
|
25 | 27 | matrix:
|
26 |
| - os: [ ubuntu-latest, windows-latest, macos-12, macos-13, macos-14 ] |
27 |
| - build_type: [ Release ] |
28 |
| - c_compiler: [ clang, cl ] |
29 |
| - python_version: [ '3.10', '3.11', '3.12' ] |
| 28 | + os: [ubuntu-latest, windows-latest, macos-12, macos-13, macos-14] |
| 29 | + build_type: [Release] |
| 30 | + c_compiler: [clang, cl] |
| 31 | + python_version: ['3.10', '3.11', '3.12'] |
30 | 32 | include:
|
31 |
| - - os: windows-latest |
32 |
| - c_compiler: cl |
33 |
| - cpp_compiler: cl |
34 |
| - cmake_extra_options: '' |
35 |
| - - os: ubuntu-latest |
36 |
| - c_compiler: clang |
37 |
| - cpp_compiler: clang++ |
38 |
| - cmake_extra_options: '-GNinja' |
| 33 | + - os: windows-latest |
| 34 | + c_compiler: cl |
| 35 | + cpp_compiler: cl |
| 36 | + cmake_extra_options: '' |
| 37 | + - os: ubuntu-latest |
| 38 | + c_compiler: clang |
| 39 | + cpp_compiler: clang++ |
| 40 | + cmake_extra_options: '-GNinja' |
39 | 41 | # - os: macos-latest
|
40 | 42 | # c_compiler: gcc
|
41 | 43 | # cpp_compiler: g++
|
42 |
| - - os: macos-12 |
43 |
| - c_compiler: clang |
44 |
| - cpp_compiler: clang++ |
45 |
| - cmake_extra_options: '-GNinja' |
46 |
| - - os: macos-13 |
47 |
| - c_compiler: clang |
48 |
| - cpp_compiler: clang++ |
49 |
| - cmake_extra_options: '-GNinja' |
50 |
| - - os: macos-14 |
51 |
| - c_compiler: clang |
52 |
| - cpp_compiler: clang++ |
53 |
| - cmake_extra_options: '-GNinja' |
54 |
| - |
| 44 | + - os: macos-12 |
| 45 | + c_compiler: clang |
| 46 | + cpp_compiler: clang++ |
| 47 | + cmake_extra_options: '-GNinja' |
| 48 | + - os: macos-13 |
| 49 | + c_compiler: clang |
| 50 | + cpp_compiler: clang++ |
| 51 | + cmake_extra_options: '-GNinja' |
| 52 | + - os: macos-14 |
| 53 | + c_compiler: clang |
| 54 | + cpp_compiler: clang++ |
| 55 | + cmake_extra_options: '-GNinja' |
55 | 56 | exclude:
|
56 |
| - - os: windows-latest |
57 |
| - c_compiler: clang |
58 |
| - - os: ubuntu-latest |
59 |
| - c_compiler: cl |
60 |
| - - os: macos-12 |
61 |
| - c_compiler: cl |
62 |
| - - os: macos-13 |
63 |
| - c_compiler: cl |
64 |
| - - os: macos-14 |
65 |
| - c_compiler: cl |
66 |
| - |
| 57 | + - os: windows-latest |
| 58 | + c_compiler: clang |
| 59 | + - os: ubuntu-latest |
| 60 | + c_compiler: cl |
| 61 | + - os: macos-12 |
| 62 | + c_compiler: cl |
| 63 | + - os: macos-13 |
| 64 | + c_compiler: cl |
| 65 | + - os: macos-14 |
| 66 | + c_compiler: cl |
67 | 67 | steps:
|
68 |
| - - uses: actions/checkout@v4 |
| 68 | + - uses: actions/checkout@v4 |
| 69 | + |
| 70 | + - name: Set reusable strings |
| 71 | + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. |
| 72 | + id: strings |
| 73 | + shell: bash |
| 74 | + run: | |
| 75 | + echo "build-output-dir=${{ github.workspace }}/cmake-build" >> "$GITHUB_OUTPUT" |
| 76 | + echo "py-build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" |
| 77 | + echo "CMAKE_C_COMPILER=${{ matrix.c_compiler }}" >> "$GITHUB_ENV" |
| 78 | + echo "CMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}" >> "$GITHUB_ENV" |
| 79 | + echo "CMAKE_OPTIONS=${{ matrix.cmake_extra_options }}" >> "$GITHUB_ENV" |
| 80 | +
|
| 81 | + - name: Set up Homebrew |
| 82 | + if: ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'ubuntu-latest'}} |
| 83 | + id: set-up-homebrew |
| 84 | + uses: Homebrew/actions/setup-homebrew@master |
69 | 85 |
|
70 |
| - - name: Set reusable strings |
71 |
| - # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. |
72 |
| - id: strings |
73 |
| - shell: bash |
74 |
| - run: | |
75 |
| - echo "build-output-dir=${{ github.workspace }}/cmake-build" >> "$GITHUB_OUTPUT" |
76 |
| - echo "py-build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" |
77 |
| - echo "CMAKE_C_COMPILER=${{ matrix.c_compiler }}" >> "$GITHUB_ENV" |
78 |
| - echo "CMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}" >> "$GITHUB_ENV" |
79 |
| - echo "CMAKE_OPTIONS=${{ matrix.cmake_extra_options }}" >> "$GITHUB_ENV" |
| 86 | + - name: Install LLVM |
| 87 | + if: ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'ubuntu-latest' }} |
| 88 | + run: | |
| 89 | + brew install llvm ninja |
| 90 | + echo "PATH=$(brew --prefix llvm)/bin:$PATH" >> "$GITHUB_ENV" |
80 | 91 |
|
81 |
| - - name: Set up Homebrew |
82 |
| - if: ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'ubuntu-latest'}} |
83 |
| - id: set-up-homebrew |
84 |
| - uses: Homebrew/actions/setup-homebrew@master |
| 92 | + - name: Set up Python |
| 93 | + uses: actions/setup-python@v5 |
| 94 | + with: |
| 95 | + cache: 'pip' |
| 96 | + python-version: ${{ matrix.python_version }} |
85 | 97 |
|
86 |
| - - name: Install LLVM |
87 |
| - if: ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13' || matrix.os == 'macos-14' || matrix.os == 'ubuntu-latest' }} |
88 |
| - run: | |
89 |
| - brew install llvm ninja |
90 |
| - echo "PATH=$(brew --prefix llvm)/bin:$PATH" >> "$GITHUB_ENV" |
| 98 | + - name: Install dependencies |
| 99 | + run: pip install . |
| 100 | + shell: bash |
91 | 101 |
|
92 |
| - - name: Set up Python |
93 |
| - uses: actions/setup-python@v5 |
94 |
| - with: |
95 |
| - cache: 'pip' |
96 |
| - python-version: ${{ matrix.python_version }} |
| 102 | + - name: Python Build |
| 103 | + run: python setup.py build |
| 104 | + shell: bash |
97 | 105 |
|
98 |
| - - name: Install packages |
99 |
| - run: pip install -r requirements.txt |
100 |
| - |
101 |
| - - name: Python Build |
102 |
| - run: python setup.py build |
103 |
| - |
104 |
| - - name: Upload Build Artifact (Python) |
105 |
| - |
106 |
| - with: |
107 |
| - # Artifact name |
108 |
| - name: PyBuild ${{ matrix.os }}-cp${{ matrix.python_version }} |
109 |
| - # A file, directory or wildcard pattern that describes what to upload |
110 |
| - path: ${{ steps.strings.outputs.py-build-output-dir }} |
| 106 | + - name: Upload Build Artifact (Python) |
| 107 | + |
| 108 | + with: |
| 109 | + # Artifact name |
| 110 | + name: PyBuild ${{ matrix.os }}-cp${{ matrix.python_version }} |
| 111 | + # A file, directory or wildcard pattern that describes what to upload |
| 112 | + path: ${{ steps.strings.outputs.py-build-output-dir }} |
0 commit comments