Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use fortran cache/install actions #19

Merged
merged 3 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
ci: add fortran install actions
* add reusable github actions cache_ifort and cache_gfortran
* use ifort/gfortran actions in CI workflows
* bump actions/cache to v3
  • Loading branch information
wpbonelli committed Sep 1, 2022
commit fcdd2b93f1396a8835094e9522b960a1d7e8da49
74 changes: 74 additions & 0 deletions .github/actions/cache_gfortran/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Cache gfortran
description: Cache gfortran installation (cross-platform)
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('**/.github/actions/cache_gfortran/action.yml') }}

- name: Symlink to gfortran (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
sudo ln -fs /usr/bin/gfortran-10 /usr/local/bin/gfortran
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('**/.github/actions/cache_gfortran/action.yml') }}

- name: Symlink to gfortran (MacOS)
if: runner.os == 'macOS'
shell: bash
run: |
sudo ln -fs /usr/local/bin/gfortran-11 /usr/local/bin/gfortran
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: |
# TODO: where is windows install?
/c/ProgramData/Chocolatey/
key: gfortran-${{ runner.os }}-${{ hashFiles('**/.github/actions/cache_gfortran/action.yml', '**/.github/common/link-gfortranlib5.sh') }}

- name: Workaround for windows-2022 v20220626.1 gfortran executable run failures
if: runner.os == 'Windows'
shell: bash
run: |
.github/common/link-gfortranlib5.sh

- name: Print GNU compiler versions
if: runner.os != 'Windows'
shell: bash
run: |
gfortran --version
gcc --version
g++ --version

- name: Print GNU compiler versions (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
gfortran --version
gcc --version
g++ --version
83 changes: 83 additions & 0 deletions .github/actions/cache_ifort/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Cache Intel fortran
description: Cache Intel fortran installation (cross-platform)
runs:
using: composite
steps:
- name: Set install path (Linux & MacOS)
if: runner.os != 'Windows'
id: set-install-path
shell: bash
run: |
echo "::set-output name=install-path::/opt/intel/oneapi"

- name: Set resources (Linux)
id: set-resources-linux
shell: bash
run: |
echo "::set-output name=hpckit_url::https://registrationcenter-download.intel.com/akdlm/irc_nas/18679/l_HPCKit_p_2022.2.0.191_offline.sh"
echo "::set-output name=fortran::intel.oneapi.lin.ifort-compiler"

- name: Cache ifort (Linux)
if: runner.os == 'Linux'
id: cache-install-linux
uses: actions/cache@v3
with:
path: ${{ steps.set-install-path.outputs.install-path }}
key: ifort-${{ runner.os }}-${{ hashFiles('**/.github/actions/cache_ifort/action.yml', '**/.github/intel-scripts/cache_exclude_linux.sh') }}

- name: Install ifort (Linux)
if: runner.os == 'Linux' && steps.cache-install-linux.outputs.cache-hit != 'true'
shell: bash
run: |
.github/intel-scripts/install_linux.sh $HPCKIT_URL $FORTRAN
env:
HPCKIT_URL: ${{ steps.set-resources-linux.outputs.hpckit_url }}
FORTRAN: ${{ steps.set-resources-linux.outputs.fortran }}

- name: Set resources (Mac)
id: set-resources-macos
shell: bash
run: |
echo "::set-output name=hpckit_url::https://registrationcenter-download.intel.com/akdlm/IRC_NAS/18681/m_HPCKit_p_2022.2.0.158_offline.dmg"
echo "::set-output name=fortran::intel.oneapi.mac.ifort-compiler"

- name: Cache ifort (MacOS)
if: runner.os == 'macOS'
id: cache-install-macos
uses: actions/cache@v3
with:
path: ${{ steps.set-install-path.outputs.install-path }}
key: ifort-${{ runner.os }}-${{ hashFiles('**/.github/actions/cache_ifort/action.yml') }}

- name: Install ifort (MacOS)
if: runner.os == 'macOS' && steps.cache-install-macos.outputs.cache-hit != 'true'
shell: bash
run: |
.github/intel-scripts/install_macos.sh $HPCKIT_URL $FORTRAN_COMPONENTS
env:
HPCKIT_URL: ${{ steps.set-resources-macos.outputs.hpckit_url }}
FORTRAN: ${{ steps.set-resources-macos.outputs.fortran }}

- name: Set resources (Windows)
id: set-resources-windows
shell: pwsh
run: |
echo "::set-output name=hpckit_url::https://registrationcenter-download.intel.com/akdlm/IRC_NAS/18680/w_HPCKit_p_2022.2.0.173_offline.exe"
echo "::set-output name=fortran::intel.oneapi.win.ifort-compiler"

- name: Cache ifort (Windows)
if: runner.os == 'Windows'
id: cache-install-windows
uses: actions/cache@v3
with:
path: C:\Program Files (x86)\Intel\oneAPI
key: ifort-${{ runner.os }}-${{ hashFiles('**/.github/actions/cache_ifort/action.yml', '**/.github/intel-scripts/cache_exclude_windows.sh') }}

- name: Install ifort (Windows)
if: runner.os == 'Windows' && steps.cache-install-windows.outputs.cache-hit != 'true'
shell: pwsh
run: |
.github/intel-scripts/install_windows.bat $env:HPCKIT_URL $env:FORTRAN
env:
HPCKIT_URL: ${{ steps.set-resources-windows.outputs.hpckit_url }}
FORTRAN: ${{ steps.set-resources-windows.outputs.fortran }}
50 changes: 4 additions & 46 deletions .github/workflows/nightly-build-intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,7 @@ jobs:
shell: bash

env:
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/18680/w_HPCKit_p_2022.2.0.173_offline.exe
LINUX_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18679/l_HPCKit_p_2022.2.0.191_offline.sh
MACOS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/18681/m_HPCKit_p_2022.2.0.158_offline.dmg
WINDOWS_FORTRAN_COMPONENTS: intel.oneapi.win.ifort-compiler
LINUX_FORTRAN_COMPONENTS_WEB: intel.oneapi.lin.ifort-compiler
MACOS_FORTRAN_COMPONENTS: intel.oneapi.mac.ifort-compiler
FC: ifort
VS_VER: vs2022

steps:
- name: Checkout this github repo
Expand All @@ -65,45 +58,8 @@ jobs:
run: |
pip list

- name: cache install ifort on linux
if: runner.os == 'Linux'
id: cache-install-linux
uses: actions/cache@v2
with:
path: |
/opt/intel/oneapi
key: install-${{ env.LINUX_HPCKIT_URL }}-${{ env.LINUX_FORTRAN_COMPONENTS_WEB }}-compiler-${{ hashFiles('**/.github/intel-scripts/cache_exclude_linux.sh') }}

- name: install ifort on linux
if: runner.os == 'Linux' && steps.cache-install-linux.outputs.cache-hit != 'true'
run: |
.github/intel-scripts/install_linux.sh $LINUX_HPCKIT_URL $LINUX_FORTRAN_COMPONENTS_WEB

- name: cache install ifort on macos
if: runner.os == 'macOS'
id: cache-install-macos
uses: actions/cache@v2
with:
path: /opt/intel/oneapi
key: install-${{ env.MACOS_HPCKIT_URL }}-${{ env.MACOS_FORTRAN_COMPONENTS }}

- name: install ifort on macos
if: runner.os == 'macOS' && steps.cache-install-macos.outputs.cache-hit != 'true'
run: |
.github/intel-scripts/install_macos.sh $MACOS_HPCKIT_URL $MACOS_FORTRAN_COMPONENTS

- name: cache install ifort on windows
if: runner.os == 'Windows'
id: cache-install-windows
uses: actions/cache@v2
with:
path: C:\Program Files (x86)\Intel\oneAPI
key: install-${{ env.WINDOWS_HPCKIT_URL }}-${{ env.WINDOWS_FORTRAN_COMPONENTS }}-compiler-${{ hashFiles('**/.github/intel-scripts/cache_exclude_windows.sh') }}

- name: install ifort on windows
if: runner.os == 'Windows' && steps.cache-install-windows.outputs.cache-hit != 'true'
run: |
.github/intel-scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_FORTRAN_COMPONENTS
- name: Install ifort
uses: ./.github/actions/cache_ifort

- name: Clone MODFLOW 6 repo
run: |
Expand Down Expand Up @@ -138,6 +94,8 @@ jobs:
run: |
call "../../.github/intel-scripts/build_windows.bat"
python build_nightly.py
env:
VS_VER: vs2022

- name: Move the build zip file
run: |
Expand Down
27 changes: 2 additions & 25 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,8 @@ jobs:
run: |
pip list

- name: Workaround for windows-2022 v20220626.1 gfortran executable run failures
if: runner.os == 'Windows'
run: |
.github/common/link-gfortranlib5.sh

- name: Setup symbolic link to gfortran on Linux
if: runner.os == 'Linux'
run: |
sudo ln -fs /usr/bin/gfortran-10 /usr/local/bin/gfortran
sudo ln -fs /usr/bin/gcc-10 /usr/local/bin/gcc
sudo ln -fs /usr/bin/g++-10 /usr/local/bin/g++

- name: Setup symbolic link to gfortran on macOS
if: runner.os == 'macOS'
run: |
sudo ln -fs /usr/local/bin/gfortran-11 /usr/local/bin/gfortran
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: Print GNU compiler versions
shell: bash
run: |
gfortran --version
gcc --version
g++ --version
- name: Install gfortran
uses: ./.github/actions/cache_gfortran

- name: Clone MODFLOW 6 repo
run: |
Expand Down
50 changes: 4 additions & 46 deletions .github/workflows/nightly-distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,58 +39,14 @@ jobs:
shell: bash

env:
WINDOWS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/18680/w_HPCKit_p_2022.2.0.173_offline.exe
LINUX_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/18679/l_HPCKit_p_2022.2.0.191_offline.sh
MACOS_HPCKIT_URL: https://registrationcenter-download.intel.com/akdlm/IRC_NAS/18681/m_HPCKit_p_2022.2.0.158_offline.dmg
WINDOWS_FORTRAN_COMPONENTS: intel.oneapi.win.ifort-compiler
LINUX_FORTRAN_COMPONENTS_WEB: intel.oneapi.lin.ifort-compiler
MACOS_FORTRAN_COMPONENTS: intel.oneapi.mac.ifort-compiler
FC: ifort
VS_VER: vs2022

steps:
- name: Checkout this github repo
uses: actions/[email protected]

- name: cache install ifort on linux
if: runner.os == 'Linux'
id: cache-install-linux
uses: actions/cache@v2
with:
path: |
/opt/intel/oneapi
key: install-${{ env.LINUX_HPCKIT_URL }}-${{ env.LINUX_FORTRAN_COMPONENTS_WEB }}-compiler-${{ hashFiles('**/.github/intel-scripts/cache_exclude_linux.sh') }}

- name: install ifort on linux
if: runner.os == 'Linux' && steps.cache-install-linux.outputs.cache-hit != 'true'
run: |
.github/intel-scripts/install_linux.sh $LINUX_HPCKIT_URL $LINUX_FORTRAN_COMPONENTS_WEB

- name: cache install ifort on macos
if: runner.os == 'macOS'
id: cache-install-macos
uses: actions/cache@v2
with:
path: /opt/intel/oneapi
key: install-${{ env.MACOS_HPCKIT_URL }}-${{ env.MACOS_FORTRAN_COMPONENTS }}

- name: install ifort on macos
if: runner.os == 'macOS' && steps.cache-install-macos.outputs.cache-hit != 'true'
run: |
.github/intel-scripts/install_macos.sh $MACOS_HPCKIT_URL $MACOS_FORTRAN_COMPONENTS

- name: cache install ifort on windows
if: runner.os == 'Windows'
id: cache-install-windows
uses: actions/cache@v2
with:
path: C:\Program Files (x86)\Intel\oneAPI
key: install-${{ env.WINDOWS_HPCKIT_URL }}-${{ env.WINDOWS_FORTRAN_COMPONENTS }}-compiler-${{ hashFiles('**/.github/intel-scripts/cache_exclude_windows.sh') }}

- name: install ifort on windows
if: runner.os == 'Windows' && steps.cache-install-windows.outputs.cache-hit != 'true'
run: |
.github/intel-scripts/install_windows.bat $WINDOWS_HPCKIT_URL $WINDOWS_FORTRAN_COMPONENTS
- name: Install ifort
uses: ./.github/actions/cache_ifort

- name: Setup Python
uses: actions/[email protected]
Expand Down Expand Up @@ -155,6 +111,8 @@ jobs:
run: |
call ".github/intel-scripts/build_windows.bat"
python make_distribution.py -mf6p ./modflow6 -mf6ep ./modflow6-examples -dp ./${{ runner.os }}
env:
VS_VER: vs2022

- name: Create an artifact of the distributions
uses: actions/[email protected]
Expand Down