|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + name: ${{ matrix.compiler }}-${{ matrix.version }} (${{ matrix.os }}) |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + os: [macos-13, macos-14, ubuntu-22.04, ubuntu-24.04] |
| 14 | + compiler: [ gfortran ] |
| 15 | + version: [ 12, 13, 14 ] |
| 16 | + extra_flags: [ -ffree-line-length-0 ] |
| 17 | + include: |
| 18 | + # https://hub.docker.com/r/phhargrove/llvm-flang/tags |
| 19 | + - os: ubuntu-24.04 |
| 20 | + compiler: flang |
| 21 | + version: 20 |
| 22 | + extra_flags: -g |
| 23 | + container: phhargrove/llvm-flang:20.1.0-1 |
| 24 | + - os: ubuntu-24.04 |
| 25 | + compiler: flang |
| 26 | + version: 19 |
| 27 | + extra_flags: -g -mmlir -allow-assumed-rank |
| 28 | + container: phhargrove/llvm-flang:19.1.1-1 |
| 29 | +# - os: ubuntu-24.04 |
| 30 | +# compiler: flang |
| 31 | +# version: new |
| 32 | +# container: gmao/llvm-flang:latest |
| 33 | +# extra_flags: -g |
| 34 | + |
| 35 | + exclude: |
| 36 | + - os: ubuntu-22.04 |
| 37 | + version: 13 # no package available |
| 38 | + - os: ubuntu-22.04 |
| 39 | + version: 14 # no package available |
| 40 | + |
| 41 | + container: |
| 42 | + image: ${{ matrix.container }} |
| 43 | + |
| 44 | + env: |
| 45 | + GCC_VERSION: ${{ matrix.version }} |
| 46 | + FC: ${{ matrix.compiler }} |
| 47 | + FPM_FLAGS: --profile release --verbose |
| 48 | + |
| 49 | + steps: |
| 50 | + - name: Checkout code |
| 51 | + uses: actions/checkout@v4 |
| 52 | + |
| 53 | + - name: Install Dependencies Ubuntu |
| 54 | + if: ${{ contains(matrix.os, 'ubuntu') && matrix.compiler == 'gfortran' && 0 }} |
| 55 | + run: | |
| 56 | + sudo apt-get update |
| 57 | + sudo apt list -a 'gfortran-*' |
| 58 | + sudo apt install -y gfortran-${GCC_VERSION} build-essential |
| 59 | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \ |
| 60 | + --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${GCC_VERSION} |
| 61 | +
|
| 62 | + - name: Setup Compilers |
| 63 | + run: | |
| 64 | + set -x |
| 65 | + if test "$FC" = "flang" ; then \ |
| 66 | + echo "FPM_FC=flang-new" >> "$GITHUB_ENV" ; \ |
| 67 | + else \ |
| 68 | + echo "FPM_FC=gfortran-${GCC_VERSION}" >> "$GITHUB_ENV" ; \ |
| 69 | + fi |
| 70 | +
|
| 71 | + - name: Setup FPM |
| 72 | + uses: fortran-lang/setup-fpm@main |
| 73 | + if: ${{ matrix.os != 'macos-14' }} |
| 74 | + with: |
| 75 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 76 | + |
| 77 | + - name: Build FPM |
| 78 | + if: ${{ matrix.os == 'macos-14' }} # no arm64 fpm distro, build from source |
| 79 | + run: | |
| 80 | + set -x |
| 81 | + curl --retry 5 -LOsS https://github.com/fortran-lang/fpm/releases/download/v0.11.0/fpm-0.11.0.F90 |
| 82 | + mkdir fpm-temp |
| 83 | + gfortran-14 -o fpm-temp/fpm fpm-0.11.0.F90 |
| 84 | + echo "PATH=`pwd`/fpm-temp:${PATH}" >> "$GITHUB_ENV" |
| 85 | +
|
| 86 | + - name: Version info |
| 87 | + run: | |
| 88 | + set -x |
| 89 | + echo == TOOL VERSIONS == |
| 90 | + uname -a |
| 91 | + if test -r /etc/os-release ; then cat /etc/os-release ; fi |
| 92 | + ${FPM_FC} --version |
| 93 | + fpm --version |
| 94 | +
|
| 95 | + - name: Build and Test (Assertions OFF) |
| 96 | + run: | |
| 97 | + set -x |
| 98 | + fpm test ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" |
| 99 | + fpm run --example false-assertion ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" |
| 100 | + fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" |
| 101 | +
|
| 102 | + - name: Build and Test (Assertions ON) |
| 103 | + env: |
| 104 | + FPM_FLAGS: ${{ env.FPM_FLAGS }} --flag -DASSERTIONS |
| 105 | + run: | |
| 106 | + set -x |
| 107 | + fpm test ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" |
| 108 | + ( set +e ; fpm run --example false-assertion ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" ; test $? = 1 ) |
| 109 | + ( set +e ; fpm run --example invoke-via-macro ${FPM_FLAGS} --flag "${{ matrix.EXTRA_FLAGS }}" ; test $? = 1 ) |
| 110 | +
|
| 111 | +
|
0 commit comments