From 7de227cce9c00648c4b69e00fe5a90a20a2e790c Mon Sep 17 00:00:00 2001 From: w-bonelli Date: Mon, 12 Sep 2022 11:18:57 -0400 Subject: [PATCH] Refactor (#6) * refactor: inline scripts * docs: remove in-dev badge from README --- .github/workflows/commit.yml | 4 ++-- README.md | 3 +-- action.yml | 8 ++++++-- scripts/install/install-python-std.sh | 6 ------ scripts/install/link-gfortranlib5.sh | 7 ------- scripts/test/test_install.ps1 | 7 ------- scripts/test/test_install.sh | 24 ------------------------ {scripts/test => test}/hw.f90 | 0 {scripts/test => test}/test.ps1 | 2 +- {scripts/test => test}/test.sh | 2 +- 10 files changed, 11 insertions(+), 52 deletions(-) delete mode 100755 scripts/install/install-python-std.sh delete mode 100755 scripts/install/link-gfortranlib5.sh delete mode 100755 scripts/test/test_install.ps1 delete mode 100755 scripts/test/test_install.sh rename {scripts/test => test}/hw.f90 (100%) rename {scripts/test => test}/test.ps1 (91%) rename {scripts/test => test}/test.sh (93%) diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 350708e..9519765 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -23,7 +23,7 @@ jobs: uses: ./ - name: Test run: | - ./scripts/test/test.sh /usr/local/bin/gfortran + ./test/test.sh /usr/local/bin/gfortran test_windows: name: Test (Windows) runs-on: windows-latest @@ -35,4 +35,4 @@ jobs: - name: Test shell: pwsh run: | - ./scripts/test/test.ps1 + ./test/test.ps1 diff --git a/README.md b/README.md index 5bc140a..dad5fd7 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # install-gfortran-action [![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) -![Status](https://img.shields.io/badge/-under%20development-yellow?style=flat-square) An action to install the [GNU Fortran](https://gcc.gnu.org/fortran/) compiler. @@ -22,7 +21,7 @@ To use this action, add a step like the following to your workflow: ```yaml - name: Install GNU Fortran - uses: modflowpy/install-gfortran-action@v0.0.1 + uses: modflowpy/install-gfortran-action@v1 ``` GNU fortran is pre-installed on runners for all three platforms, so there is no need to install it fresh — 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. diff --git a/action.yml b/action.yml index 6a1f3cc..55a7254 100644 --- a/action.yml +++ b/action.yml @@ -19,11 +19,15 @@ 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: Workaround for windows-2022 v20220626.1 gfortran executable run failures + - name: Workaround v20220626.1 gfortran executable run failures (Windows) if: runner.os == 'Windows' shell: bash run: | - scripts/install/link-gfortranlib5.sh + FCDIR=/c/ProgramData/Chocolatey/bin + LNDIR=/c/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin + if [ -d "$FCDIR" ] && [ -f "$LNDIR/libgfortran-5.dll" ] && [ ! -f "$FCDIR/libgfortran-5.dll" ]; then + ln -s "$LNDIR/libgfortran-5.dll" "$FCDIR/libgfortran-5.dll" + fi - name: Print GNU compiler versions if: runner.os != 'Windows' diff --git a/scripts/install/install-python-std.sh b/scripts/install/install-python-std.sh deleted file mode 100755 index e4ebc7f..0000000 --- a/scripts/install/install-python-std.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -pip install wheel -pip install requests appdirs numpy matplotlib pytest pytest-xdist meson!=0.63.0 ninja -pip install https://github.com/modflowpy/flopy/zipball/develop -pip install https://github.com/modflowpy/pymake/zipball/master diff --git a/scripts/install/link-gfortranlib5.sh b/scripts/install/link-gfortranlib5.sh deleted file mode 100755 index 275c2f9..0000000 --- a/scripts/install/link-gfortranlib5.sh +++ /dev/null @@ -1,7 +0,0 @@ -#! /bin/bash - -FCDIR=/c/ProgramData/Chocolatey/bin -LNDIR=/c/ProgramData/Chocolatey/lib/mingw/tools/install/mingw64/bin -if [ -d "$FCDIR" ] && [ -f "$LNDIR/libgfortran-5.dll" ] && [ ! -f "$FCDIR/libgfortran-5.dll" ]; then - ln -s "$LNDIR/libgfortran-5.dll" "$FCDIR/libgfortran-5.dll" -fi diff --git a/scripts/test/test_install.ps1 b/scripts/test/test_install.ps1 deleted file mode 100755 index 2463020..0000000 --- a/scripts/test/test_install.ps1 +++ /dev/null @@ -1,7 +0,0 @@ - -echo "Checking gfortran command" -if ((get-command "gfortran" -ErrorAction SilentlyContinue) -eq $null) { - echo "gfortran command is not available" - exit 1 -} - diff --git a/scripts/test/test_install.sh b/scripts/test/test_install.sh deleted file mode 100755 index 7541804..0000000 --- a/scripts/test/test_install.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -path="$1" -if [ -z "$path" ] -then - echo "Must specify path argument" - exit 1 -fi - -# check install location -echo "Checking install location: $path" -if [ ! -L "$path" ] # install dir is symlinked -then - echo "Install location does not exist: $path" - exit 1 -fi - -# check ifort executable -echo "Checking gfortran command" -if ! command -v gfortran &> /dev/null -then - echo "gfortran command is not available" - exit 1 -fi \ No newline at end of file diff --git a/scripts/test/hw.f90 b/test/hw.f90 similarity index 100% rename from scripts/test/hw.f90 rename to test/hw.f90 diff --git a/scripts/test/test.ps1 b/test/test.ps1 similarity index 91% rename from scripts/test/test.ps1 rename to test/test.ps1 index 5e8d7c8..99be850 100755 --- a/scripts/test/test.ps1 +++ b/test/test.ps1 @@ -5,7 +5,7 @@ if ((get-command "gfortran" -ErrorAction SilentlyContinue) -eq $null) { write-output "Command gfortran found" } -gfortran scripts/test/hw.f90 -o hw +gfortran test/hw.f90 -o hw write-output "Compile succeeded" $output=$(./hw) diff --git a/scripts/test/test.sh b/test/test.sh similarity index 93% rename from scripts/test/test.sh rename to test/test.sh index 74ecf7d..79e82ab 100755 --- a/scripts/test/test.sh +++ b/test/test.sh @@ -23,7 +23,7 @@ else exit 1 fi -gfortran scripts/test/hw.f90 -o hw +gfortran test/hw.f90 -o hw echo "Compile succeeded" output=$(./hw '2>&1')