|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main, master ] |
| 6 | + pull_request: |
| 7 | + branches: [ main, master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + name: ${{ matrix.compiler }}-${{ matrix.compiler-version }} on ${{ matrix.os }} |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + # gfortran on Linux |
| 19 | + - os: ubuntu-latest |
| 20 | + compiler: gfortran |
| 21 | + compiler-version: 13 |
| 22 | + fpm-compiler: gfortran |
| 23 | + - os: ubuntu-latest |
| 24 | + compiler: gfortran |
| 25 | + compiler-version: 14 |
| 26 | + fpm-compiler: gfortran |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout code |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Install gfortran (Linux) |
| 33 | + if: matrix.compiler == 'gfortran' && runner.os == 'Linux' |
| 34 | + run: | |
| 35 | + sudo apt-get update -y |
| 36 | + sudo apt-get install -y gfortran-${{ matrix.compiler-version }} |
| 37 | + sudo update-alternatives --install /usr/bin/gfortran gfortran \ |
| 38 | + /usr/bin/gfortran-${{ matrix.compiler-version }} 100 |
| 39 | +
|
| 40 | + - name: Install gfortran (macOS) |
| 41 | + if: matrix.compiler == 'gfortran' && runner.os == 'macOS' |
| 42 | + run: | |
| 43 | + brew install gcc@${{ matrix.compiler-version }} |
| 44 | + ln -sf /opt/homebrew/bin/gfortran-${{ matrix.compiler-version }} \ |
| 45 | + /opt/homebrew/bin/gfortran |
| 46 | +
|
| 47 | + - name: Install flang (Linux) |
| 48 | + if: matrix.compiler == 'flang' && runner.os == 'Linux' |
| 49 | + run: | |
| 50 | + sudo apt-get update -y |
| 51 | + sudo apt-get install -y flang-${{ matrix.compiler-version }} |
| 52 | + sudo update-alternatives --install /usr/bin/flang flang \ |
| 53 | + /usr/bin/flang-${{ matrix.compiler-version }} 100 |
| 54 | +
|
| 55 | + - name: Install flang (macOS) |
| 56 | + if: matrix.compiler == 'flang' && runner.os == 'macOS' |
| 57 | + run: | |
| 58 | + brew install llvm@${{ matrix.compiler-version }} |
| 59 | + ln -sf /opt/homebrew/opt/llvm@${{ matrix.compiler-version }}/bin/flang \ |
| 60 | + /opt/homebrew/bin/flang |
| 61 | +
|
| 62 | + - name: Install fpm |
| 63 | + uses: fortran-lang/setup-fpm@v7 |
| 64 | + with: |
| 65 | + fpm-version: 'v0.13.0' |
| 66 | + |
| 67 | + - name: Build and test |
| 68 | + run: fpm test --compiler ${{ matrix.fpm-compiler }} --profile release |
0 commit comments