Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit ecc99e5

Browse files
Develop (#3)
* ci: initial implementation * refactor: rename verify -> test, update README (#2) Co-authored-by: jdhughes-usgs <jdhughes@usgs.gov>
1 parent d8b576e commit ecc99e5

File tree

8 files changed

+202
-1
lines changed

8 files changed

+202
-1
lines changed

.github/workflows/commit.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
- develop
7+
pull_request:
8+
branches:
9+
- master
10+
- develop
11+
jobs:
12+
test:
13+
name: Test
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ ubuntu-latest, macos-latest ]
19+
steps:
20+
- name: Checkout repo
21+
uses: actions/checkout@v3
22+
- name: Install gfortran
23+
uses: ./
24+
- name: Check installation
25+
run: |
26+
./scripts/test/test_install.sh /usr/local/bin/gfortran
27+
test_windows:
28+
name: Test (Windows)
29+
runs-on: windows-latest
30+
steps:
31+
- name: Checkout repo
32+
uses: actions/checkout@v3
33+
- name: Install gfortran
34+
uses: ./
35+
- name: Check installation
36+
shell: pwsh
37+
run: |
38+
./scripts/test/test_install.ps1

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ bin-release/
1616
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
1717
# should NOT be excluded as they contain compiler settings and other important
1818
# information for Eclipse / Flash Builder.
19+
20+
# IDE
21+
.idea

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,45 @@
11
# install-gfortran-action
2-
action to install gfortran compiler
2+
3+
[![CI](https://github.com/modflowpy/install-gfortran-action/actions/workflows/commit.yml/badge.svg?branch=develop)](https://github.com/modflowpy/install-gfortran-action/actions/workflows/commit.yml)
4+
![Status](https://img.shields.io/badge/-under%20development-yellow?style=flat-square)
5+
6+
An action to install the [GNU Fortran](https://gcc.gnu.org/fortran/) compiler.
7+
8+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
9+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
10+
11+
- [Usage](#usage)
12+
- [Install location](#install-location)
13+
- [Linux](#linux)
14+
- [MacOS](#macos)
15+
- [Windows](#windows)
16+
- [Disclaimer](#disclaimer)
17+
18+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
19+
20+
## Usage
21+
22+
To use this action, add a step like the following to your workflow:
23+
24+
```yaml
25+
- name: Install GNU Fortran
26+
uses: modflowpy/install-gfortran-action@v0.0.1
27+
```
28+
29+
## Install location
30+
31+
### Linux
32+
33+
On Linux `gfortran` version 10 is installed to `/usr/bin/gfortran-10` and symlinked to `/usr/local/bin/gfortran`.
34+
35+
### MacOS
36+
37+
On MacOS `gfortran` version 11 is installed to `/usr/local/bin/gfortran-11` and symlinked to `/usr/local/bin/gfortran`.
38+
39+
### Windows
40+
41+
On Windows `gfortran` is installed via Chocolatey.
42+
43+
## Disclaimer
44+
45+
This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not received final approval by the U.S. Geological Survey (USGS). No warranty, expressed or implied, is made by the USGS or the U.S. Government as to the functionality of the software and related material nor shall the fact of release constitute any such warranty. The software is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the software.

action.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Install GNU Fortran
2+
description: Install & cache GNU Fortran
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Cache gfortran (Linux)
7+
if: runner.os == 'Linux'
8+
id: cache-install-linux
9+
uses: actions/cache@v3
10+
with:
11+
path: |
12+
/usr/bin/gfortran-10
13+
/usr/bin/gcc-10
14+
/usr/bin/g++-10
15+
key: gfortran-${{ runner.os }}-${{ hashFiles('action.yml') }}
16+
17+
- name: Symlink to gfortran (Linux)
18+
if: runner.os == 'Linux'
19+
shell: bash
20+
run: |
21+
sudo ln -fs /usr/bin/gfortran-10 /usr/local/bin/gfortran
22+
sudo ln -fs /usr/bin/gcc-10 /usr/local/bin/gcc
23+
sudo ln -fs /usr/bin/g++-10 /usr/local/bin/g++
24+
25+
- name: Cache gfortran (MacOS)
26+
if: runner.os == 'macOS'
27+
id: cache-install-macos
28+
uses: actions/cache@v3
29+
with:
30+
path: |
31+
/usr/local/bin/gfortran-11
32+
/usr/local/bin/gcc-11
33+
/usr/local/bin/g++-11
34+
key: gfortran-${{ runner.os }}-${{ hashFiles('action.yml') }}
35+
36+
- name: Symlink to gfortran (MacOS)
37+
if: runner.os == 'macOS'
38+
shell: bash
39+
run: |
40+
sudo ln -fs /usr/local/bin/gfortran-11 /usr/local/bin/gfortran
41+
sudo ln -fs /usr/local/bin/gcc-11 /usr/local/bin/gcc
42+
sudo ln -fs /usr/local/bin/g++-11 /usr/local/bin/g++
43+
44+
- name: Cache gfortran (Windows)
45+
if: runner.os == 'Windows'
46+
id: cache-install-windows
47+
uses: actions/cache@v3
48+
with:
49+
path: |
50+
/c/ProgramData/Chocolatey/
51+
key: gfortran-${{ runner.os }}-${{ hashFiles('action.yml', 'scripts/install/link-gfortranlib5.sh') }}
52+
53+
- name: Workaround for windows-2022 v20220626.1 gfortran executable run failures
54+
if: runner.os == 'Windows'
55+
shell: bash
56+
run: |
57+
scripts/install/link-gfortranlib5.sh
58+
59+
- name: Print GNU compiler versions
60+
if: runner.os != 'Windows'
61+
shell: bash
62+
run: |
63+
gfortran --version
64+
gcc --version
65+
g++ --version
66+
67+
- name: Print GNU compiler versions (Windows)
68+
if: runner.os == 'Windows'
69+
shell: pwsh
70+
run: |
71+
gfortran --version
72+
gcc --version
73+
g++ --version

scripts/install/install-python-std.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
pip install wheel
4+
pip install requests appdirs numpy matplotlib pytest pytest-xdist meson!=0.63.0 ninja
5+
pip install https://github.com/modflowpy/flopy/zipball/develop
6+
pip install https://github.com/modflowpy/pymake/zipball/master

scripts/install/link-gfortranlib5.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/bash
2+
3+
FCDIR=/c/ProgramData/Chocolatey/bin
4+
LNDIR=/c/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin
5+
if [ -d "$FCDIR" ] && [ -f "$LNDIR/libgfortran-5.dll" ] && [ ! -f "$FCDIR/libgfortran-5.dll" ]; then
6+
ln -s "$LNDIR/libgfortran-5.dll" "$FCDIR/libgfortran-5.dll"
7+
fi

scripts/test/test_install.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
echo "Checking gfortran command"
3+
if ((get-command "gfortran" -ErrorAction SilentlyContinue) -eq $null) {
4+
echo "gfortran command is not available"
5+
exit 1
6+
}
7+

scripts/test/test_install.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
path="$1"
4+
if [ -z "$path" ]
5+
then
6+
echo "Must specify path argument"
7+
exit 1
8+
fi
9+
10+
# check install location
11+
echo "Checking install location: $path"
12+
if [ ! -L "$path" ] # install dir is symlinked
13+
then
14+
echo "Install location does not exist: $path"
15+
exit 1
16+
fi
17+
18+
# check ifort executable
19+
echo "Checking gfortran command"
20+
if ! command -v gfortran &> /dev/null
21+
then
22+
echo "gfortran command is not available"
23+
exit 1
24+
fi

0 commit comments

Comments
 (0)