|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: CTest_on_push_and_pull_request |
| 4 | + |
| 5 | +# Controls when the workflow will run |
| 6 | +on: |
| 7 | + # Triggers the workflow on push or pull request events but only for the main branch |
| 8 | + workflow_call: |
| 9 | + push: |
| 10 | + branches: [ develop ] |
| 11 | + pull_request: |
| 12 | + branches: [ develop ] |
| 13 | + |
| 14 | + # Allows you to run this workflow manually from the Actions tab |
| 15 | + workflow_dispatch: |
| 16 | + |
| 17 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 18 | +jobs: |
| 19 | + # This workflow contains build matrix |
| 20 | + CTest: |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + os: [ubuntu-latest, windows-latest] |
| 24 | + build: [Release, Debug] |
| 25 | + compiler: [gcc, clang, msvc] |
| 26 | + exclude: |
| 27 | + - {os: ubuntu-latest, compiler: msvc} |
| 28 | + - {os: windows-latest, compiler: gcc} |
| 29 | + - {os: windows-latest, compiler: clang} |
| 30 | + |
| 31 | + # Test on specified OS |
| 32 | + runs-on: ${{ matrix.os }} |
| 33 | + |
| 34 | + # Configure - Build - Test |
| 35 | + steps: |
| 36 | + # Checks-out repository under $GITHUB_WORKSPACE, so your job can access it |
| 37 | + - uses: actions/checkout@v4.1.7 |
| 38 | + with: |
| 39 | + submodules: true |
| 40 | + |
| 41 | + # Configuration for GCC |
| 42 | + - name: Configuration for gcc |
| 43 | + if: matrix.compiler == 'gcc' |
| 44 | + run: | |
| 45 | + echo Runs-on ${{matrix.os}}, Build with ${{matrix.compiler}} |
| 46 | + mkdir build |
| 47 | + cd build |
| 48 | + cmake .. -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc |
| 49 | +
|
| 50 | + # Configuration for Clang |
| 51 | + - name: Configuration for clang |
| 52 | + if: matrix.compiler == 'clang' |
| 53 | + run: | |
| 54 | + echo Runs-on ${{matrix.os}}, Build with ${{matrix.compiler}} |
| 55 | + mkdir build |
| 56 | + cd build |
| 57 | + cmake .. -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang |
| 58 | +
|
| 59 | + # Configuration for MSVC |
| 60 | + - name: Configuration for msvc |
| 61 | + if: matrix.compiler == 'msvc' |
| 62 | + run: | |
| 63 | + echo "Runs-on ${{matrix.os}}, Build with ${{matrix.compiler}}" |
| 64 | + mkdir build |
| 65 | + cd build |
| 66 | + cmake .. -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl |
| 67 | +
|
| 68 | + # Build for Linux |
| 69 | + - name: Build for Linux |
| 70 | + if: matrix.os == 'ubuntu-latest' |
| 71 | + run: | |
| 72 | + echo Runs-on ${{matrix.os}}, ${{matrix.build}} build |
| 73 | + cd build |
| 74 | + cmake --build . --target all --config ${{ matrix.build }} --clean-first -j4 |
| 75 | +
|
| 76 | + # Build for Windows |
| 77 | + - name: Build for Windows |
| 78 | + if: matrix.os == 'windows-latest' |
| 79 | + run: | |
| 80 | + echo "Runs-on ${{matrix.os}}, ${{matrix.build}} build" |
| 81 | + cd build |
| 82 | + cmake --build . --target all_build --config ${{ matrix.build }} --clean-first -j4 |
| 83 | +
|
| 84 | + - name: Test |
| 85 | + run: | |
| 86 | + cd build |
| 87 | + ctest --rerun-failed --output-on-failure -j 4 |
| 88 | +
|
| 89 | +
|
0 commit comments