Set up Fortran compiler toolchains for GitHub Actions. Supports GNU, Intel, LLVM, NVIDIA, AMD, Arm, and LFortran compilers across Linux, macOS, and Windows.
Migrating from v1 requires only a few changes:
- With Intel compilers, this action sets up the oneAPI environment. Do not re-run environment setup scripts such as
setvars.batorvcvarsall.batafter this action runs. Doing so can cause thePATHvariable to exceed character limits on Windows. ifxconfigurations on macOS were previously redirected toifort. This behavior is no longer supported;ifxon macOS will fail. Remove these configurations from your workflow matrices.- In 2022, oneAPI release numbers differed from compiler version numbers. For example, oneAPI
2022.1on Windows installedifxversion2022.2.0. Compiler versions are now used consistently, so2022.1is no longer listed as a supported version. Use2022.2.0instead. - Intel's Fortran-only installer for Windows does not come with a working
icxbackend, so the preferred C/C++ companion compiler has been changed tocl. If you have hardcodedCC=icx/CXX=icxanywhere in your own workflow, remove these settings and let the action provide the appropriate values. - The legacy compiler names
gcc,intel,intel-classic, andnvidia-hpcremain supported as compatibility aliases. Migrating to the canonical names is recommended.
- uses: fortran-lang/setup-fortran@v2
with:
compiler: <compiler>
version: <version>| Input | Description | Default |
|---|---|---|
compiler |
Compiler to install (gfortran, ifx, ifort, nvfortran, aocc, lfortran, flang, armflang) |
gfortran |
version |
Compiler version to install. Enclose the version string in quotation marks (e.g. "2026.1.1" or "0.64.0") |
latest |
msystem |
Windows toolchain environment (native, ucrt64, clang64) |
native |
cleanup-disk |
Free up disk space by removing large pre-installed toolkits during nvfortran setup (true, false) |
false |
update-environment |
Whether to export toolchain environment variables (FC, CC, CXX, FPM_*, F77, F90, FORTRAN_COMPILER) into the runner environment (true, false) |
true |
For compatibility with fortran-lang/setup-fortran, the legacy names gcc,
intel, intel-classic, and nvidia-hpc are accepted as aliases for
gfortran, ifx, ifort, and nvfortran, respectively. Aliases do not
change based on platform; for example, intel always resolves to ifx.
Use of the canonical names is recommended.
| Version | ubuntu-24.04 | ubuntu-22.04 | ubuntu-24.04-arm | ubuntu-22.04-arm | macos-26 | macos-26-intel | macos-15 | macos-15-intel | macos-14 | windows-2025 | windows-2022 | windows-2025 (ucrt64) | windows-2022 (ucrt64) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| latest | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 16 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| 15 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| 14 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| 13 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| 12 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
| 11 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Version | ubuntu-24.04 | ubuntu-22.04 | windows-2025 | windows-2022 |
|---|---|---|---|---|
| latest | ✓ | ✓ | ✓ | ✓ |
| 2026.1.1 | ✓ | ✓ | ||
| 2026.1.0 | ✓ | ✓ | ||
| 2026.1 | ✓ | ✓ | ✓ | ✓ |
| 2026.0 | ✓ | ✓ | ✓ | ✓ |
| 2025.3.3 | ✓ | ✓ | ||
| 2025.3.2 | ✓ | ✓ | ||
| 2025.3.1 | ✓ | ✓ | ||
| 2025.3.0 | ✓ | ✓ | ||
| 2025.3 | ✓ | ✓ | ✓ | ✓ |
| 2025.2.1 | ✓ | ✓ | ||
| 2025.2.0 | ✓ | ✓ | ||
| 2025.2 | ✓ | ✓ | ✓ | ✓ |
| 2025.1.0 | ✓ | ✓ | ||
| 2025.1 | ✓ | ✓ | ✓ | ✓ |
| 2025.0.0 | ✓ | ✓ | ||
| 2025.0 | ✓ | ✓ | ✓ | ✓ |
| 2024.2.1 | ✓ | ✓ | ||
| 2024.2.0 | ✓ | ✓ | ||
| 2024.2 | ✓ | ✓ | ✓ | ✓ |
| 2024.1.0 | ✓ | ✓ | ||
| 2024.1 | ✓ | ✓ | ✓ | ✓ |
| 2024.0.2 | ✓ | ✓ | ||
| 2024.0.1 | ✓ | ✓ | ||
| 2024.0 | ✓ | ✓ | ✓ | ✓ |
| 2023.2.4 | ✓ | ✓ | ||
| 2023.2.3 | ✓ | ✓ | ||
| 2023.2.2 | ✓ | ✓ | ||
| 2023.2.1 | ✓ | ✓ | ✓ | ✓ |
| 2023.2.0 | ✓ | ✓ | ✓ | ✓ |
| 2023.2 | ✓ | ✓ | ✓ | ✓ |
| 2023.1.0 | ✓ | ✓ | ✓ | ✓ |
| 2023.1 | ✓ | ✓ | ✓ | ✓ |
| 2023.0.0 | ✓ | ✓ | ||
| 2023.0 | ✓ | ✓ | ||
| 2022.3.0 | ✓ | ✓ | ||
| 2022.3 | ✓ | ✓ | ||
| 2022.2.1 | ✓ | ✓ | ||
| 2022.2.0 | ✓ | ✓ | ✓ | ✓ |
| 2022.2 | ✓ | ✓ | ✓ | ✓ |
| 2022.1.0 | ✓ | ✓ | ||
| 2022.1 | ✓ | ✓ | ||
| 2022.0.2 | ✓ | ✓ | ||
| 2022.0.1 | ✓ | ✓ | ||
| 2022.0 | ✓ | ✓ | ||
| 2021.4.0 | ✓ | ✓ | ||
| 2021.4 | ✓ | ✓ | ||
| 2021.3.0 | ✓ | ✓ | ||
| 2021.3 | ✓ | ✓ | ||
| 2021.2.0 | ✓ | ✓ | ||
| 2021.2 | ✓ | ✓ | ||
| 2021.1.2 | ✓ | ✓ | ||
| 2021.1.1 | ✓ | ✓ | ||
| 2021.1 | ✓ | ✓ |
In 2022,
ifxcompiler version numbers differed from oneAPI release numbers. Specify the compiler version here, not the oneAPI release number.
| Version | ubuntu-24.04 | ubuntu-22.04 | macos-26 | macos-15 | macos-14 | macos-26-intel | macos-15-intel | windows-2025 | windows-2022 |
|---|---|---|---|---|---|---|---|---|---|
| latest | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 2021.13 | ✓ | ✓ | ✓ | ✓ | |||||
| 2021.12 | ✓ | ✓ | ✓ | ✓ | |||||
| 2021.11 | ✓ | ✓ | ✓ | ✓ | |||||
| 2021.10 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 2021.9 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| 2021.8 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| 2021.7.1 | ✓ | ✓ | |||||||
| 2021.7 | ✓ | ✓ | ✓ | ✓ | |||||
| 2021.6 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
| 2021.5 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| 2021.4 | ✓ | ✓ | |||||||
| 2021.3 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| 2021.2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| 2021.1.2 | ✓ | ✓ | |||||||
| 2021.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Intel ships
ifortfor macOS as x86_64 binaries. On ARM64 runners they run under Rosetta 2, which the action verifies (and installs if missing) before installation. To keep companion C/C++ objects linkable there, the action exportsCFLAGS,CXXFLAGS, andLDFLAGSwith-arch x86_64.
| Version | ubuntu-24.04 | ubuntu-22.04 | ubuntu-24.04-arm | ubuntu-22.04-arm |
|---|---|---|---|---|
| latest | ✓ | ✓ | ✓ | ✓ |
| 26.5 | ✓ | ✓ | ✓ | ✓ |
| 26.3 | ✓ | ✓ | ✓ | ✓ |
| 26.1 | ✓ | ✓ | ✓ | ✓ |
| 25.11 | ✓ | ✓ | ✓ | ✓ |
| 25.9 | ✓ | ✓ | ✓ | ✓ |
| 25.7 | ✓ | ✓ | ✓ | ✓ |
| 25.5 | ✓ | ✓ | ✓ | ✓ |
| 25.3 | ✓ | ✓ | ✓ | ✓ |
| 25.1 | ✓ | ✓ | ✓ | ✓ |
| 24.11 | ✓ | ✓ | ✓ | ✓ |
| 24.9 | ✓ | ✓ | ✓ | ✓ |
| 24.7 | ✓ | ✓ | ✓ | ✓ |
| 24.5 | ✓ | ✓ | ✓ | ✓ |
| 24.3 | ✓ | ✓ | ✓ | ✓ |
| 24.1 | ✓ | ✓ | ✓ | ✓ |
| 23.11 | ✓ | ✓ | ✓ | ✓ |
| 23.9 | ✓ | ✓ | ✓ | ✓ |
| 23.7 | ✓ | ✓ | ✓ | ✓ |
| 23.5 | ✓ | ✓ | ✓ | ✓ |
| 23.3 | ✓ | ✓ | ✓ | ✓ |
| 23.1 | ✓ | ✓ | ✓ | ✓ |
| 22.11 | ✓ | ✓ | ✓ | ✓ |
| 22.9 | ✓ | ✓ | ✓ | ✓ |
| 22.7 | ✓ | ✓ | ✓ | ✓ |
| 22.5 | ✓ | ✓ | ✓ | ✓ |
| 22.3 | ✓ | ✓ | ✓ | ✓ |
| 22.2 | ✓ | ✓ | ✓ | ✓ |
| 22.1 | ✓ | ✓ | ✓ | ✓ |
| 21.11 | ✓ | ✓ | ✓ | ✓ |
| 21.9 | ✓ | ✓ | ✓ | ✓ |
| 21.7 | ✓ | ✓ | ✓ | ✓ |
| 21.5 | ✓ | ✓ | ✓ | ✓ |
| 21.3 | ✓ | ✓ | ✓ | ✓ |
| 21.2 | ✓ | ✓ | ✓ | ✓ |
| 21.1 | ✓ | ✓ | ✓ | ✓ |
| 20.11 | ✓ | ✓ | ✓ | ✓ |
| 20.9 | ✓ | ✓ | ✓ | ✓ |
| 20.7 | ✓ | ✓ | ✓ | ✓ |
| Version | ubuntu-24.04 | ubuntu-22.04 |
|---|---|---|
| latest | ✓ | ✓ |
| 5.2 | ✓ | ✓ |
| 5.1 | ✓ | ✓ |
| 5.0 | ✓ | ✓ |
| 4.2 | ✓ | ✓ |
| 4.1 | ✓ | ✓ |
| Version | ubuntu-24.04 | ubuntu-22.04 | ubuntu-24.04-arm | ubuntu-22.04-arm | macos-26 | macos-26-intel | macos-15 | macos-15-intel | macos-14 | windows-2025 | windows-2022 | windows-2025 (ucrt64) | windows-2022 (ucrt64) | windows-2025 (clang64) | windows-2022 (clang64) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| latest | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 0.66.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
| 0.65.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
| 0.64.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
| 0.63.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| 0.62.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| 0.61.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| 0.60.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| 0.59.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| 0.58.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||
| 0.57.0 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| Version | ubuntu-24.04 | ubuntu-22.04 | ubuntu-24.04-arm | ubuntu-22.04-arm | macos-26 | macos-26-intel | macos-15 | macos-15-intel | macos-14 | windows-2025 | windows-2022 | windows-11-arm | windows-2025 (ucrt64) | windows-2022 (ucrt64) | windows-2025 (clang64) | windows-2022 (clang64) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| latest | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
| 23 | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||||||
| 22 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||||
| 21 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||||
| 20 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||||||||
| 19 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||||||||
| 18 | ✓ | ✓ | ✓ | ✓ | ||||||||||||
| 17 | ✓ | ✓ | ✓ | ✓ | ||||||||||||
| 16 | ✓ |
Specific patch versions (e.g.
21.1.6) are supported on macOS and native Windows runners and validated against available GitHub releases. Patch versions are not individually tested.
| Version | ubuntu-24.04-arm | ubuntu-22.04-arm |
|---|---|---|
| latest | ✓ | ✓ |
| 23.1 | ✓ | ✓ |
| 22.1 | ✓ | ✓ |
| 21.1 | ✓ | ✓ |
| 20.1 | ✓ | ✓ |
steps:
- uses: actions/checkout@v7
- uses: fortran-lang/setup-fortran@v2
- run: ${{ env.FC }} hello.f90If omitted, compiler defaults to gfortran and version to the latest
supported version for the platform.
- uses: fortran-lang/setup-fortran@v2
with:
compiler: lfortran
version: "0.66.0"strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
toolchain:
- { compiler: gfortran, version: "15" }
- { compiler: ifx, version: "2026.1" }
- { compiler: lfortran, version: "0.66.0" }
exclude:
- os: macos-latest
toolchain: { compiler: ifx, version: "2026.1" }
include:
- os: windows-11-arm
toolchain: { compiler: flang, version: "22" }
jobs:
test:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: fortran-lang/setup-fortran@v2
with:
compiler: ${{ matrix.toolchain.compiler }}
version: ${{ matrix.toolchain.version }}
- run: ${{ env.FC }} hello.f90- uses: fortran-lang/setup-fortran@v2
with:
compiler: lfortran
msystem: ucrt64| Output | Description |
|---|---|
version |
Resolved version of the installed compiler |
fc |
Command or path to the Fortran compiler |
cc |
Command or path to the C compiler |
cxx |
Command or path to the C++ compiler |
| Variable | Description |
|---|---|
FC |
Command or path to the Fortran compiler |
CC |
Command or path to the C compiler |
CXX |
Command or path to the C++ compiler |
FPM_FC |
Command or path to the Fortran compiler for fpm |
FPM_CC |
Command or path to the C compiler for fpm |
FPM_CXX |
Command or path to the C++ compiler for fpm |
F77 |
Command or path to the Fortran compiler (alias for FC) |
F90 |
Command or path to the Fortran compiler (alias for FC) |
Requires Node.js 24 or newer (.nvmrc pins the version CI uses).
Install dependencies with npm ci.
Run npm run all to format and lint the source, run unit tests, bundle the
action into dist, and run the smoke tests.
Commit changes to dist together with the source changes, as GitHub Actions
executes the bundled code from this directory.
- Add the version to
SUPPORTED_VERSIONSin the respective installation script (latest first). - Add the version to the CI matrix for that compiler.
- Update the README.
- Run
npm run all— it will fail if the version isn't tested or documented.
Compilers have separate installation scripts for each platform they support.
Report bugs and feature requests in the issue tracker.