|
| 1 | +name: CMake on multiple platforms |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + test_linux: |
| 8 | + description: 'Test on Linux' |
| 9 | + type: boolean |
| 10 | + default: true |
| 11 | + test_macos: |
| 12 | + description: 'Test on MacOS' |
| 13 | + type: boolean |
| 14 | + default: true |
| 15 | + test_windows: |
| 16 | + description: 'Test on Windows' |
| 17 | + type: boolean |
| 18 | + default: true |
| 19 | + |
| 20 | +jobs: |
| 21 | + build: |
| 22 | + name: ${{ matrix.config.name }} |
| 23 | + runs-on: ${{ matrix.config.os }} |
| 24 | + strategy: |
| 25 | + # 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. |
| 26 | + fail-fast: false |
| 27 | + matrix: |
| 28 | + config: |
| 29 | + - { |
| 30 | + name: "Windows Latest MSVC", |
| 31 | + os: windows-latest, |
| 32 | + build_type: "Release", |
| 33 | + cc: "cl", |
| 34 | + cxx: "cl", |
| 35 | + generators: "Visual Studio 16 2019" |
| 36 | + } |
| 37 | + - { |
| 38 | + name: "Ubuntu_Latest", |
| 39 | + os: ubuntu-latest, |
| 40 | + build_type: "Release", |
| 41 | + cc: "gcc", |
| 42 | + cxx: "g++", |
| 43 | + generators: "Ninja" |
| 44 | + } |
| 45 | + - { |
| 46 | + name: "macOS Latest", |
| 47 | + os: macos-latest, |
| 48 | + build_type: "Release", |
| 49 | + cc: "clang", |
| 50 | + cxx: "clang++", |
| 51 | + generators: "Ninja" |
| 52 | + } |
| 53 | + steps: |
| 54 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Print env |
| 58 | + run: | |
| 59 | + echo github.event.action: ${{ github.event.action }} |
| 60 | + echo github.event_name: ${{ github.event_name }} |
| 61 | +
|
| 62 | + - name: Setting MSBuild on windows |
| 63 | + if: startsWith(matrix.config.os, 'windows') |
| 64 | + uses: microsoft/setup-msbuild@v2 |
| 65 | + |
| 66 | + - name: Build on windows |
| 67 | + if: startsWith(matrix.config.os, 'windows') |
| 68 | + run: | |
| 69 | + mkdir ${{ github.workspace }}/build |
| 70 | + cd ${{ github.workspace }}/build |
| 71 | + cmake ${{ github.workspace }} |
| 72 | + MSBuild DTL.sln /p:Configuration=${{ matrix.config.build_type }} |
| 73 | +
|
| 74 | + - name: Build on ${{ matrix.config.os }} |
| 75 | + if: ${{ !startsWith(matrix.config.os, 'windows') }} |
| 76 | + run: | |
| 77 | + mkdir ${{ github.workspace }}/build |
| 78 | + cd ${{ github.workspace }}/build |
| 79 | + cmake ${{ github.workspace }} |
| 80 | + make ci |
0 commit comments