Fortran compiler setup for GitHub actions

Some while ago I created a setup-fortran action for usage in CI with GitHub actions, which apparently is already in use around the Fortran ecosystem. Turns out I never properly announced it in our discourse, so here we go:


Currently the action allows to setup gfortran (gcc), ifort (intel-classic) and ifx (intel):

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        toolchain: [{compiler: gcc, version: 11}]
        include:
          - os: ubuntu-latest
            toolchain: {compiler: intel, version: '2023.1'}
          - os: ubuntu-latest
            toolchain: {compiler: intel-classic, version: '2021.9'}
          - os: macos-latest
            toolchain: {compiler: intel-classic, version: '2021.9'}

    steps:
      - uses: awvwgk/setup-fortran@v1
        with:
          compiler: ${{ matrix.toolchain.compiler }}
          version: ${{ matrix.toolchain.version }}

      - run: ${{ env.FC }} --version

Support for the GCC toolchains:

runner 5 6 7 8 9 10 11 12
macos-11 โœ“ โœ“ โœ“ โœ“ โœ“ โœ“ โœ“
macos-12 โœ“ โœ“ โœ“ โœ“ โœ“ โœ“ โœ“
ubuntu-20.04 โœ“ โœ“ โœ“ โœ“ โœ“
ubuntu-22.04 โœ“ โœ“ โœ“ โœ“
windows-2019 โœ“ โœ“ โœ“ โœ“ โœ“
windows-2022 โœ“ โœ“ โœ“ โœ“ โœ“

Supported Intel toolchains (the version refers to the compiler version in the output not the version of the oneapi release, read more about this here):

runner compiler version
ubuntu-* intel 2023.1, 2023.0,
2022.2.1, 2022.2, 2022.1, 2022.0,
2021.4, 2021.3, 2021.2, 2021.1.2, 2021.1
ubuntu-* intel-classic 2021.9, 2021.8,
2021.7.1, 2021.7, 2021.6, 2021.5,
2021.4, 2021.3, 2021.2, 2021.1.2, 2021.1
macos-* intel-classic 2021.9, 2021.8,
2021.7.1, 2021.7, 2021.6, 2021.5,
2021.4, 2021.3, 2021.2, 2021.1

Looking for help with other toolchains, like

17 Likes

This is awesome - exactly what we need to stress test the fpm system libraries implementation!

Thanks, it is great. It would be nice to have something similar on gitlab too.

Iโ€™m not much of a GitLab user, but the setup steps are mainly collected in one big script at setup-fortran/setup-fortran.sh at main ยท awvwgk/setup-fortran ยท GitHub and should be reusable. There are some GitHub actions specific steps like making the Intel setup persistent between workflow steps, which could be guarded by checking for GHA specific env vars. Is there an equivalent to custom GHA for providing steps in a GitLab pipeline?