# Fortran compiler setup for GitHub actions

**URL:** <https://fortran-lang.discourse.group/t/fortran-compiler-setup-for-github-actions/5671>\
**Category:** Announcements\
**Created:** [April 26, 2023, 5:50pm UTC](https://fortran-lang.discourse.group/t/fortran-compiler-setup-for-github-actions/5671 "2023-04-26T17:50:26Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![zaikunzhang](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/zaikunzhang/32/785_2.png) [@zaikunzhang](https://fortran-lang.discourse.group/u/zaikunzhang)\
**Post date:** [October 14, 2023, 6:46am UTC](https://fortran-lang.discourse.group/t/fortran-compiler-setup-for-github-actions/5671/10 "2023-10-14T06:46:04Z")

</div>

In addition to [fortran-lang/setup-fortran](https://github.com/marketplace/actions/setup-fortran) (thank @awvwgk and contributors), I use the following scripts for the GitHub Actions of [PRIMA](http://www.libprima.net) to install Fortran compilers on **GitHub-hosted** runners.

- Intel oneAPI (alternative to fortran-lang/setup-fortran)

- NVIDIA nvfortran  
[https://github.com/equipez/github\_actions\_scripts/blob/main/install\_nvfortran](https://github.com/equipez/github_actions_scripts/blob/main/install_nvfortran)

- AMD AOCC flang  
[https://github.com/equipez/github\_actions\_scripts/blob/main/install\_aocc](https://github.com/equipez/github_actions_scripts/blob/main/install_aocc)

- Classic flang  
[https://github.com/equipez/github\_actions\_scripts/blob/main/install\_flang](https://github.com/equipez/github_actions_scripts/blob/main/install_flang)

I also have scripts to install [sunf95](https://github.com/equipez/github_actions_scripts/blob/main/install_sunf95) and [g95](https://github.com/equipez/github_actions_scripts/blob/main/install_g95) on GitHub-hosted runners even though these compilers are discontinued.

The scripts are naive (e.g., call `apt install` to install `oneapi`), and they may take a few minutes to run, which is tolerable in my case.

Here is a concrete workflow that applies them:

[https://github.com/s-prima/prima/blob/main/.github/workflows/lint\_hosted.yml#L87-L117](https://github.com/s-prima/prima/blob/main/.github/workflows/lint_hosted.yml#L87-L117),

where the Fortran source code of [PRIMA](https://github.com/libprima/prima) is compiled using **eight** compilers (`gfortran`, `ifort`, `ifx`, `nvfortran`, AOCC `flang`, Classic `flang`, `sunf95`, and `g95`) with strict debug options to make sure that no error (of course) or warning is raised (PRIMA does not tolerate any warning).

**N.B.** : Do not use the scripts on your own computers before examining them. They may make unwanted changes to your system.

---

_[View the full topic](https://fortran-lang.discourse.group/t/fortran-compiler-setup-for-github-actions/5671)._
