Supported compilers

Runner compiler
Ubuntu gfortran, ifx, lfortran, flang, flang-new, nvfortran, aocc, aomp
macOS gfortran, lfortran
Windows gfortran, ifx, lfortran, flang, flang-new

Compiler toolchains

Each Fortran compiler is paired with the following C and C++ compilers.

Inputs

Input Default Value
compiler empty gfortran, ifx, lfortran, flang, flang-new, nvfortran, aocc, aomp
compiler-version empty Version, latest, or empty
platform empty Empty uses the runner OS; ubuntu-latest, windows-latest, macos-latest
extra-packages empty Space- or comma-separated Conda packages
fpm-version empty Version, latest, or empty
checkout-repo true true or false

Permissions

Compiler setup reads Actions job metadata and checks out the repository by default.

permissions:
  actions: read
  contents: read

Exported environment

FC, CC, CXX, FPM_FC, FPM_CC, FPM_CXX, CMAKE_Fortran_COMPILER, CMAKE_C_COMPILER, CMAKE_CXX_COMPILER

fpm

fpm is installed by default.

test_fpm:
  name: ${{ matrix.os }}_${{ matrix.compiler }}_fpm
  runs-on: ${{ matrix.os }}
  strategy:
    fail-fast: false
    matrix:
      include:
      - {os: ubuntu-latest, compiler: gfortran, compiler-version: "", fpm-version: "", extra-packages: ""}
  steps:
    - name: setup-fortran-conda
      uses: gha3mi/setup-fortran-conda@latest
      with:
        compiler: ${{ matrix.compiler }}
        compiler-version: ${{ matrix.compiler-version }}
        fpm-version: ${{ matrix.fpm-version }}
        extra-packages: ${{ matrix.extra-packages }}

    - name: fpm test
      run: fpm test --compiler "${{ env.FPM_FC }}" --profile release --verbose

CMake

CMake, Ninja and pkg-config are installed by default.

test_cmake:
  name: ${{ matrix.os }}_${{ matrix.compiler }}_cmake
  runs-on: ${{ matrix.os }}
  strategy:
    fail-fast: false
    matrix:
      include:
      - {os: ubuntu-latest, compiler: gfortran, compiler-version: "", extra-packages: ""}
  steps:
    - name: setup-fortran-conda
      uses: gha3mi/setup-fortran-conda@latest
      with:
        compiler: ${{ matrix.compiler }}
        compiler-version: ${{ matrix.compiler-version }}
        extra-packages: ${{ matrix.extra-packages }}

    - name: CMake test
      run: |
        cmake -S . -B build -G Ninja -DCMAKE_Fortran_COMPILER="${{ env.CMAKE_Fortran_COMPILER }}"
        cmake --build build --verbose
        ctest --test-dir build --output-on-failure -VV

Meson

Meson, Ninja and pkg-config are installed by default.

test_meson:
  name: ${{ matrix.os }}_${{ matrix.compiler }}_meson
  runs-on: ${{ matrix.os }}
  strategy:
    fail-fast: false
    matrix:
      include:
      - {os: ubuntu-latest, compiler: gfortran, compiler-version: "", extra-packages: ""}
  steps:
    - name: setup-fortran-conda
      uses: gha3mi/setup-fortran-conda@latest
      with:
        compiler: ${{ matrix.compiler }}
        compiler-version: ${{ matrix.compiler-version }}
        extra-packages: ${{ matrix.extra-packages }}

    - name: Meson test
      run: |
        meson setup build --buildtype release --backend=ninja
        meson compile -C build --verbose
        meson test -C build --verbose