|
| 1 | +name: test |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + mask-experimental: |
| 7 | + type: boolean |
| 8 | + default: true |
| 9 | + description: Always report experimental test as successful |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
| 14 | +jobs: |
| 15 | + tests: |
| 16 | + name: > |
| 17 | + 🖥️ ${{ matrix.os || 'Fedora' }} |
| 18 | + ${{ !matrix.os && format('🛠️ {0}', matrix.toolchain) || '' }} |
| 19 | + ${{ matrix.mpi && format('🖧 {0}', matrix.mpi) || '' }} |
| 20 | + ${{ matrix.experimental && '[🧪 Experimental]' || '' }} |
| 21 | + runs-on: ${{ matrix.os || 'ubuntu-latest' }} |
| 22 | + container: ${{ !matrix.os && 'ghcr.io/lecrisut/dev-env:main' || '' }} |
| 23 | + continue-on-error: ${{ matrix.experimental || false }} |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + toolchain: [ gcc, llvm, intel ] |
| 28 | + mpi: [false, openmpi, mpich, intel] |
| 29 | + include: |
| 30 | + # flang is missing features in 16.0.6 |
| 31 | + - toolchain: llvm |
| 32 | + experimental: true |
| 33 | + steps: |
| 34 | + - name: Install missing packages |
| 35 | + run: dnf install -y bzip2 python-unversioned-command |
| 36 | + - name: Load mpi module ${{ matrix.mpi || '' }} |
| 37 | + run: | |
| 38 | + # Get interactive profile to be able to load modules |
| 39 | + source /etc/profile |
| 40 | + |
| 41 | + # Save the current environment since we only want the added difference |
| 42 | + printenv > orig_env |
| 43 | + |
| 44 | + # Load the relevant mpi module |
| 45 | + module load mpi/${{ matrix.mpi }} |
| 46 | + printenv > module_env |
| 47 | + |
| 48 | + diff orig_env module_env | sed -n 's/> //p' >> $GITHUB_ENV |
| 49 | + |
| 50 | + # Set MPI flag on |
| 51 | + echo "WITH_MPI=ON" >> $GITHUB_ENV |
| 52 | + if: matrix.mpi |
| 53 | + - name: Enable msvc toolchain on windows |
| 54 | + uses: ilammy/msvc-dev-cmd@v1 |
| 55 | + if: contains(matrix.os, 'windows') |
| 56 | + - name: Activate Intel compilers |
| 57 | + # Not elegant, it will propagate all environment variable. |
| 58 | + # Intel does not provide a way to output the environment variables to a file |
| 59 | + # Note: PATH needs to be exported to GITHUB_PATH otherwise it can be overwritten |
| 60 | + run: | |
| 61 | + source /opt/intel/oneapi/setvars.sh |
| 62 | + printenv >> $GITHUB_ENV |
| 63 | + echo $PATH >> $GITHUB_PATH |
| 64 | + if: matrix.toolchain == 'intel' |
| 65 | + - uses: actions/checkout@v3 |
| 66 | + - uses: lukka/get-cmake@latest |
| 67 | + - name: Run CMake workflow ${{ matrix.toolchain }}-ci |
| 68 | + uses: lukka/run-cmake@v10.3 |
| 69 | + with: |
| 70 | + workflowPreset: "${{ matrix.toolchain }}-ci" |
| 71 | + continue-on-error: ${{ matrix.experimental && inputs.mask-experimental}} |
0 commit comments