|
| 1 | +name: test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | + |
| 9 | +jobs: |
| 10 | + tests: |
| 11 | + name: Check on ${{ matrix.toolchain }} toolchain ${{ matrix.mpi }} |
| 12 | + runs-on: ${{ matrix.os || 'ubuntu-latest' }} |
| 13 | + container: ${{ !matrix.os && 'ghcr.io/lecrisut/dev-env:main' || '' }} |
| 14 | + continue-on-error: ${{ matrix.experimental || false }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + toolchain: [ gcc, llvm, intel ] |
| 19 | + mpi: ['', openmpi, mpich, intel] |
| 20 | + include: |
| 21 | + # flang is missing features in 16.0.6 |
| 22 | + - toolchain: llvm |
| 23 | + experimental: true |
| 24 | + steps: |
| 25 | + - name: Install missing packages |
| 26 | + run: dnf install -y bzip2 python-unversioned-command |
| 27 | + - name: Load mpi module ${{ matrix.mpi }} |
| 28 | + run: | |
| 29 | + # Get interactive profile to be able to load modules |
| 30 | + source /etc/profile |
| 31 | + |
| 32 | + # Save the current environment since we only want the added difference |
| 33 | + printenv > orig_env |
| 34 | + |
| 35 | + # Load the relevant mpi module |
| 36 | + module load mpi/${{ matrix.mpi }} |
| 37 | + printenv > module_env |
| 38 | + |
| 39 | + diff orig_env module_env | sed -n 's/> //p' >> $GITHUB_ENV |
| 40 | + |
| 41 | + # Set MPI flag on |
| 42 | + echo "WITH_MPI=ON" >> $GITHUB_ENV |
| 43 | + if: ${{ matrix.mpi }} |
| 44 | + - name: Enable msvc toolchain on windows |
| 45 | + uses: ilammy/msvc-dev-cmd@v1 |
| 46 | + if: contains(matrix.os, 'windows') |
| 47 | + - name: Activate Intel compilers |
| 48 | + run: | |
| 49 | + source /etc/profile |
| 50 | + printenv > orig_env |
| 51 | + module load compiler |
| 52 | + printenv > module_env |
| 53 | + diff orig_env module_env | sed -n 's/> //p' >> $GITHUB_ENV |
| 54 | + echo $PATH >> $GITHUB_PATH |
| 55 | + if: matrix.toolchain == 'intel' |
| 56 | + - uses: actions/checkout@v3 |
| 57 | + - uses: lukka/get-cmake@latest |
| 58 | + - name: Run CMake configuration for ${{ matrix.toolchain }} toolchain |
| 59 | + uses: lukka/run-cmake@v10.3 |
| 60 | + with: |
| 61 | + workflowPreset: "${{ matrix.toolchain }}-ci" |
| 62 | + |
| 63 | + coverage: |
| 64 | + name: Check test coverage |
| 65 | + runs-on: ubuntu-latest |
| 66 | + needs: [ tests ] |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v3 |
| 69 | + - uses: lukka/get-cmake@latest |
| 70 | + - name: Get test coverage |
| 71 | + uses: lukka/run-cmake@v10.3 |
| 72 | + with: |
| 73 | + workflowPreset: ci-coverage |
| 74 | + - name: Get lcov data |
| 75 | + uses: danielealbano/lcov-action@v3 |
| 76 | + with: |
| 77 | + # Note lcov-action prepends and appends wild-cards *. Account for those |
| 78 | + # https://github.com/danielealbano/lcov-action/issues/11 |
| 79 | + remove_patterns: /test/,/cmake-build*/ |
| 80 | + - name: Upload coverage to Codecov |
| 81 | + uses: codecov/codecov-action@v3 |
| 82 | + with: |
| 83 | + name: ${{ matrix.coverage }} coverage |
| 84 | + files: coverage.info |
| 85 | + flags: ${{ matrix.coverage }} |
| 86 | + verbose: true |
0 commit comments