Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: CI
on:
push:
branches:
- master
- main
- develop
pull_request:
branches:
- master
- main
- develop
jobs:
test:
Expand All @@ -17,22 +17,22 @@ jobs:
matrix:
os: [ ubuntu-latest, macos-latest ]
steps:
- name: Checkout repo
- name: Checkout
uses: actions/checkout@v3
- name: Install gfortran
- name: Install
uses: ./
- name: Check installation
- name: Test
run: |
./scripts/test/test_install.sh /usr/local/bin/gfortran
./scripts/test/test.sh /usr/local/bin/gfortran
test_windows:
name: Test (Windows)
runs-on: windows-latest
steps:
- name: Checkout repo
- name: Checkout
uses: actions/checkout@v3
- name: Install gfortran
- name: Install
uses: ./
- name: Check installation
- name: Test
shell: pwsh
run: |
./scripts/test/test_install.ps1
./scripts/test/test.ps1
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ An action to install the [GNU Fortran](https://gcc.gnu.org/fortran/) compiler.
- [Linux](#linux)
- [MacOS](#macos)
- [Windows](#windows)
- [Disclaimer](#disclaimer)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand All @@ -26,6 +25,8 @@ To use this action, add a step like the following to your workflow:
uses: modflowpy/install-gfortran-action@v0.0.1
```

GNU fortran is pre-installed on runners for all three platforms, so there is no need to install it fresh &mdash; this action simply symlinks the compiler executable to a common location on Linux and MacOS and works around a Windows Server 2022 error preventing the default installation from working properly.

## Install location

### Linux
Expand All @@ -39,7 +40,3 @@ On MacOS `gfortran` version 11 is installed to `/usr/local/bin/gfortran-11` and
### Windows

On Windows `gfortran` is installed via Chocolatey.

## Disclaimer

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.
31 changes: 0 additions & 31 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@ description: Install & cache GNU Fortran
runs:
using: composite
steps:
- name: Cache gfortran (Linux)
if: runner.os == 'Linux'
id: cache-install-linux
uses: actions/cache@v3
with:
path: |
/usr/bin/gfortran-10
/usr/bin/gcc-10
/usr/bin/g++-10
key: gfortran-${{ runner.os }}-${{ hashFiles('action.yml') }}

- name: Symlink to gfortran (Linux)
if: runner.os == 'Linux'
shell: bash
Expand All @@ -22,17 +11,6 @@ runs:
sudo ln -fs /usr/bin/gcc-10 /usr/local/bin/gcc
sudo ln -fs /usr/bin/g++-10 /usr/local/bin/g++

- name: Cache gfortran (MacOS)
if: runner.os == 'macOS'
id: cache-install-macos
uses: actions/cache@v3
with:
path: |
/usr/local/bin/gfortran-11
/usr/local/bin/gcc-11
/usr/local/bin/g++-11
key: gfortran-${{ runner.os }}-${{ hashFiles('action.yml') }}

- name: Symlink to gfortran (MacOS)
if: runner.os == 'macOS'
shell: bash
Expand All @@ -41,15 +19,6 @@ runs:
sudo ln -fs /usr/local/bin/gcc-11 /usr/local/bin/gcc
sudo ln -fs /usr/local/bin/g++-11 /usr/local/bin/g++

- name: Cache gfortran (Windows)
if: runner.os == 'Windows'
id: cache-install-windows
uses: actions/cache@v3
with:
path: |
/c/ProgramData/Chocolatey/
key: gfortran-${{ runner.os }}-${{ hashFiles('action.yml', 'scripts/install/link-gfortranlib5.sh') }}

- name: Workaround for windows-2022 v20220626.1 gfortran executable run failures
if: runner.os == 'Windows'
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions scripts/test/hw.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
program hello
print *, 'hello world'
end program hello
17 changes: 17 additions & 0 deletions scripts/test/test.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if ((get-command "gfortran" -ErrorAction SilentlyContinue) -eq $null) {
write-output "Command gfortran not available"
exit 1
} else {
write-output "Command gfortran found"
}

gfortran scripts/test/hw.f90 -o hw
write-output "Compile succeeded"

$output=$(./hw)
if ($output -match "hello world") {
write-output $output
} else {
write-output "Unexpected output: $output"
exit 1
}
36 changes: 36 additions & 0 deletions scripts/test/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

path="$1"
if [ -z "$path" ]
then
echo "Must specify path argument"
exit 1
fi

if [ -L "$path" ] # install dir is symlinked
then
echo "Install location exists: $path"
else
echo "Install location doesn't exist: $path"
exit 1
fi

if command -v gfortran &> /dev/null
then
echo "Command gfortran available"
else
echo "Command gfortran not available"
exit 1
fi

gfortran scripts/test/hw.f90 -o hw
echo "Compile succeeded"

output=$(./hw '2>&1')
if [[ "$output" == *"hello world"* ]]
then
echo "$output"
else
echo "Unexpected output: $output"
exit 1
fi