MODFLOW 6 compiler checks #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MODFLOW 6 compiler checks | |
on: | |
push: | |
branches: | |
- v[0-9]+.[0-9]+.[0-9]+* | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: 0 0 * * 0 # 12am utc every sunday | |
# workflow_dispatch trigger to start release via GitHub UI or CLI, see | |
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# combinations from https://github.com/fortran-lang/setup-fortran#runner-compatibility | |
include: | |
# gfortran | |
- {os: ubuntu-20.04, compiler: gcc, version: 7} | |
- {os: ubuntu-20.04, compiler: gcc, version: 8} | |
- {os: ubuntu-20.04, compiler: gcc, version: 9} | |
- {os: ubuntu-20.04, compiler: gcc, version: 10} | |
- {os: ubuntu-20.04, compiler: gcc, version: 11} | |
- {os: ubuntu-22.04, compiler: gcc, version: 9} | |
- {os: ubuntu-22.04, compiler: gcc, version: 10} | |
- {os: ubuntu-22.04, compiler: gcc, version: 11} | |
- {os: ubuntu-22.04, compiler: gcc, version: 12} | |
- {os: ubuntu-22.04, compiler: gcc, version: 13} | |
- {os: macos-11, compiler: gcc, version: 7} | |
- {os: macos-11, compiler: gcc, version: 8} | |
- {os: macos-11, compiler: gcc, version: 9} | |
- {os: macos-11, compiler: gcc, version: 10} | |
- {os: macos-11, compiler: gcc, version: 11} | |
- {os: macos-11, compiler: gcc, version: 12} | |
- {os: macos-11, compiler: gcc, version: 13} | |
- {os: macos-12, compiler: gcc, version: 7} | |
- {os: macos-12, compiler: gcc, version: 8} | |
- {os: macos-12, compiler: gcc, version: 9} | |
- {os: macos-12, compiler: gcc, version: 10} | |
- {os: macos-12, compiler: gcc, version: 11} | |
- {os: macos-12, compiler: gcc, version: 12} | |
- {os: macos-12, compiler: gcc, version: 13} | |
- {os: windows-2019, compiler: gcc, version: 9} | |
- {os: windows-2019, compiler: gcc, version: 10} | |
- {os: windows-2019, compiler: gcc, version: 11} | |
- {os: windows-2019, compiler: gcc, version: 12} | |
- {os: windows-2019, compiler: gcc, version: 13} | |
- {os: windows-2022, compiler: gcc, version: 9} | |
- {os: windows-2022, compiler: gcc, version: 10} | |
- {os: windows-2022, compiler: gcc, version: 11} | |
- {os: windows-2022, compiler: gcc, version: 12} | |
- {os: windows-2022, compiler: gcc, version: 13} | |
# ifx | |
- {os: ubuntu-20.04, compiler: intel, version: 2023.2} | |
- {os: ubuntu-20.04, compiler: intel, version: 2023.1} | |
- {os: ubuntu-20.04, compiler: intel, version: "2023.0"} | |
- {os: ubuntu-20.04, compiler: intel, version: 2022.2.1} | |
- {os: ubuntu-20.04, compiler: intel, version: 2022.2} | |
- {os: ubuntu-20.04, compiler: intel, version: 2022.1} | |
- {os: ubuntu-20.04, compiler: intel, version: "2022.0"} | |
- {os: ubuntu-20.04, compiler: intel, version: 2021.4} | |
- {os: ubuntu-20.04, compiler: intel, version: 2021.2} | |
- {os: ubuntu-20.04, compiler: intel, version: 2021.1} | |
- {os: ubuntu-22.04, compiler: intel, version: 2023.2} | |
- {os: ubuntu-22.04, compiler: intel, version: 2023.1} | |
- {os: ubuntu-22.04, compiler: intel, version: "2023.0"} | |
- {os: ubuntu-22.04, compiler: intel, version: 2022.2.1} | |
- {os: ubuntu-22.04, compiler: intel, version: 2022.2} | |
- {os: ubuntu-22.04, compiler: intel, version: 2022.1} | |
- {os: ubuntu-22.04, compiler: intel, version: "2022.0"} | |
- {os: ubuntu-22.04, compiler: intel, version: 2021.4} | |
- {os: ubuntu-22.04, compiler: intel, version: 2021.2} | |
- {os: ubuntu-22.04, compiler: intel, version: 2021.1} | |
# no ifx on mac | |
- {os: windows-2019, compiler: intel, version: 2023.2} | |
- {os: windows-2019, compiler: intel, version: 2023.1} | |
- {os: windows-2019, compiler: intel, version: "2023.0"} | |
- {os: windows-2019, compiler: intel, version: 2022.2} | |
- {os: windows-2019, compiler: intel, version: 2022.1} | |
- {os: windows-2022, compiler: intel, version: 2023.2} | |
- {os: windows-2022, compiler: intel, version: 2023.1} | |
- {os: windows-2022, compiler: intel, version: "2023.0"} | |
- {os: windows-2022, compiler: intel, version: 2022.2} | |
- {os: windows-2022, compiler: intel, version: 2022.1} | |
# ifort | |
- {os: ubuntu-20.04, compiler: intel-classic, version: "2021.10"} | |
- {os: ubuntu-20.04, compiler: intel-classic, version: 2021.9} | |
- {os: ubuntu-20.04, compiler: intel-classic, version: 2021.8} | |
- {os: ubuntu-20.04, compiler: intel-classic, version: 2021.7} | |
- {os: ubuntu-20.04, compiler: intel-classic, version: 2021.6} | |
- {os: ubuntu-20.04, compiler: intel-classic, version: 2021.5} | |
- {os: ubuntu-20.04, compiler: intel-classic, version: 2021.4} | |
- {os: ubuntu-20.04, compiler: intel-classic, version: 2021.3} | |
- {os: ubuntu-20.04, compiler: intel-classic, version: 2021.2} | |
- {os: ubuntu-20.04, compiler: intel-classic, version: 2021.1} | |
- {os: ubuntu-22.04, compiler: intel-classic, version: "2021.10"} | |
- {os: ubuntu-22.04, compiler: intel-classic, version: 2021.9} | |
- {os: ubuntu-22.04, compiler: intel-classic, version: 2021.8} | |
- {os: ubuntu-22.04, compiler: intel-classic, version: 2021.7} | |
- {os: ubuntu-22.04, compiler: intel-classic, version: 2021.6} | |
- {os: ubuntu-22.04, compiler: intel-classic, version: 2021.5} | |
- {os: ubuntu-22.04, compiler: intel-classic, version: 2021.4} | |
- {os: ubuntu-22.04, compiler: intel-classic, version: 2021.3} | |
- {os: ubuntu-22.04, compiler: intel-classic, version: 2021.2} | |
- {os: ubuntu-22.04, compiler: intel-classic, version: 2021.1} | |
- {os: macos-11, compiler: intel-classic, version: "2021.10"} | |
- {os: macos-11, compiler: intel-classic, version: 2021.9} | |
- {os: macos-11, compiler: intel-classic, version: 2021.8} | |
- {os: macos-11, compiler: intel-classic, version: 2021.7} | |
- {os: macos-11, compiler: intel-classic, version: 2021.6} | |
- {os: macos-11, compiler: intel-classic, version: 2021.5} | |
- {os: macos-11, compiler: intel-classic, version: 2021.4} | |
- {os: macos-11, compiler: intel-classic, version: 2021.3} | |
- {os: macos-11, compiler: intel-classic, version: 2021.2} | |
- {os: macos-11, compiler: intel-classic, version: 2021.1} | |
- {os: macos-12, compiler: intel-classic, version: "2021.10"} | |
- {os: macos-12, compiler: intel-classic, version: 2021.9} | |
- {os: macos-12, compiler: intel-classic, version: 2021.8} | |
- {os: macos-12, compiler: intel-classic, version: 2021.7} | |
- {os: macos-12, compiler: intel-classic, version: 2021.6} | |
- {os: macos-12, compiler: intel-classic, version: 2021.5} | |
- {os: macos-12, compiler: intel-classic, version: 2021.4} | |
- {os: macos-12, compiler: intel-classic, version: 2021.3} | |
- {os: macos-12, compiler: intel-classic, version: 2021.2} | |
- {os: macos-12, compiler: intel-classic, version: 2021.1} | |
- {os: windows-2019, compiler: intel-classic, version: "2021.10"} | |
- {os: windows-2019, compiler: intel-classic, version: 2021.9} | |
- {os: windows-2019, compiler: intel-classic, version: 2021.8} | |
- {os: windows-2019, compiler: intel-classic, version: 2021.7} | |
- {os: windows-2019, compiler: intel-classic, version: 2021.6} | |
- {os: windows-2022, compiler: intel-classic, version: "2021.10"} | |
- {os: windows-2022, compiler: intel-classic, version: 2021.9} | |
- {os: windows-2022, compiler: intel-classic, version: 2021.8} | |
- {os: windows-2022, compiler: intel-classic, version: 2021.7} | |
- {os: windows-2022, compiler: intel-classic, version: 2021.6} | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout modflow6 | |
uses: actions/checkout@v4 | |
with: | |
path: modflow6 | |
- name: Checkout modflow6-testmodels | |
uses: actions/checkout@v4 | |
with: | |
repository: MODFLOW-USGS/modflow6-testmodels | |
path: modflow6-testmodels | |
- name: Checkout modflow6-examples | |
uses: actions/checkout@v4 | |
with: | |
repository: MODFLOW-USGS/modflow6-examples | |
path: modflow6-examples | |
- name: Setup ${{ matrix.compiler }} ${{ matrix.version }} | |
uses: fortran-lang/setup-fortran@v1 | |
with: | |
compiler: ${{ matrix.compiler}} | |
version: ${{ matrix.version }} | |
- name: Setup Micromamba | |
uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: modflow6/environment.yml | |
init-shell: >- | |
bash | |
powershell | |
cache-environment: true | |
cache-downloads: true | |
- name: Build modflow6 | |
working-directory: modflow6 | |
run: | | |
meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin | |
meson install -C builddir | |
- name: Show build log | |
if: failure() | |
working-directory: modflow6 | |
run: cat builddir/meson-logs/meson-log.txt | |
- name: Upload build log | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: meson-log.txt | |
path: modflow6/builddir/meson-logs/meson-log.txt | |
- name: Unit test programs | |
if: success() | |
working-directory: modflow6 | |
run: meson test --verbose --no-rebuild -C builddir | |
- name: Create compile report | |
if: success() || failure() | |
shell: bash | |
run: | | |
if [[ "${{ job.status }}" == "success" ]]; then | |
support="✓" | |
else | |
support="" | |
fi | |
mkdir -p compat | |
prefix="${{ matrix.os }},${{ matrix.compiler }},${{ matrix.version }}" | |
echo "$prefix,$support" >> "compat/comp_${prefix//,/_}.csv" | |
- name: Update flopy | |
if: success() | |
working-directory: modflow6/autotest | |
run: python update_flopy.py | |
- name: Get executables | |
if: success() | |
working-directory: modflow6/autotest | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: pytest -v --durations 0 get_exes.py | |
- name: Test modflow6 | |
if: success() | |
working-directory: modflow6/autotest | |
env: | |
REPOS_PATH: ${{ github.workspace }} | |
run: pytest -v -n auto --durations 0 | |
- name: Create test report | |
if: success() || failure() | |
shell: bash | |
run: | | |
if [[ "${{ job.status }}" == "success" ]]; then | |
support="✓" | |
else | |
support="" | |
fi | |
mkdir -p compat | |
prefix="${{ matrix.os }},${{ matrix.compiler }},${{ matrix.version }}" | |
echo "$prefix,$support" >> "compat/test_${prefix//,/_}.csv" | |
- name: Upload reports | |
if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: compat | |
path: compat/*.csv | |
report: | |
name: Make compatibility report | |
if: success() || failure() | |
needs: test | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install packages | |
run: pip install tabulate pandas | |
- name: Download reports | |
uses: actions/download-artifact@v3 | |
with: | |
name: compat | |
path: .github/compat/new | |
- name: Concatenate reports | |
working-directory: .github/compat | |
run: | | |
cols="runner,compiler,version,support" | |
echo "$cols" > long_comp.csv | |
echo "$cols" > long_test.csv | |
cat new/comp*.csv >> long_comp.csv | |
cat new/test*.csv >> long_test.csv | |
- name: Make wide CSV and MD tables | |
working-directory: .github/compat | |
id: merge-reports | |
run: | | |
python ../common/wide_compat_reports.py "long_comp.csv" "comp.csv" | |
python ../common/wide_compat_reports.py "long_test.csv" "test.csv" | |
# only upload wide CSVs and Markdown tables | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: compat | |
path: | | |
.github/compat/comp.* | |
.github/compat/test.* | |
# update DEVELOPER.md if this is not a push event and there are any changes | |
- name: Check for changes | |
working-directory: .github/compat | |
if: github.event_name != 'pull_request' | |
id: diff | |
run: | | |
if ! [ -f comp.csv ]; then | |
echo "diff=false" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
diff_comp=$(git diff comp.csv) | |
diff_test=$(git diff test.csv) | |
if [[ ( $diff_comp == "" ) && ( $diff_test == "" ) ]]; then | |
echo "No changes found" | |
echo "diff=false" >> $GITHUB_OUTPUT | |
else | |
echo "comp.csv diff:" | |
echo "$diff_comp" | |
echo "test.csv diff:" | |
echo "$diff_test" | |
echo "diff=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Update DEVELOPER.md | |
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name != 'pull_request' }} | |
run: | | |
python .github/common/update_compat_tables.py "compile" ".github/compat/comp.md" "DEVELOPER.md" | |
python .github/common/update_compat_tables.py "test" ".github/compat/test.md" "DEVELOPER.md" | |
- name: Print DEVELOPER.md diff | |
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name != 'pull_request' }} | |
run: git diff DEVELOPER.md | |
- name: Create pull request | |
if: ${{ steps.diff.outputs.diff == 'true' && github.event_name != 'pull_request' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# setup bot user | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
# create new branch | |
now=$(date +'%Y-%m-%dT%H-%M-%S') | |
updated_branch="compat_$now" | |
default_branch="${{ github.event.repository.default_branch }}" | |
git switch -c "$updated_branch" | |
# commit wide CSVs and Markdown tables and push branch | |
git add DEVELOPER.md .github/compat/comp.csv .github/compat/test.csv | |
git commit -m "Update compatibility tables" | |
git push -u origin "$updated_branch" | |
# open PR | |
cat <(echo '### Compile') <(echo) .github/compat/comp.md <(echo) <(echo '### Test') <(echo) .github/compat/test.md > compat.md | |
gh pr create -B "$default_branch" -H "$updated_branch" --title "Update compile/test compatibility tables" --body-file compat.md |