Skip to content

MODFLOW 6 compiler checks #26

MODFLOW 6 compiler checks

MODFLOW 6 compiler checks #26

Workflow file for this run

name: MODFLOW 6 compiler checks
on:
# 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:
env:
PIXI_BETA_WARNING_OFF: true
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: 11}
- {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: 11}
- {os: macos-11, compiler: gcc, version: 12}
- {os: macos-11, compiler: gcc, version: 13}
- {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: 11}
- {os: windows-2019, compiler: gcc, version: 12}
- {os: windows-2019, compiler: gcc, version: 13}
- {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: 2024.1}
- {os: ubuntu-20.04, compiler: intel, version: "2024.0"}
- {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-22.04, compiler: intel, version: 2024.1}
- {os: ubuntu-22.04, compiler: intel, version: "2024.0"}
- {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}
# no ifx on mac
- {os: windows-2019, compiler: intel, version: 2024.1}
- {os: windows-2019, compiler: intel, version: "2024.0"}
- {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-2022, compiler: intel, version: 2024.1}
- {os: windows-2022, compiler: intel, version: "2024.0"}
- {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}
# 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
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 pixi
uses: prefix-dev/[email protected]
with:
pixi-version: v0.24.2
manifest-path: "modflow6/pixi.toml"
- name: Custom pixi install
working-directory: modflow6
run: pixi run install
- name: Build modflow6
working-directory: modflow6
run: |
pixi run setup builddir
pixi run build 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: pixi run test 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: pixi run update-flopy
- name: Get executables
if: success()
working-directory: modflow6/autotest
env:
GITHUB_TOKEN: ${{ github.token }}
run: pixi run get-exes
- name: Test modflow6
if: success()
working-directory: modflow6
env:
REPOS_PATH: ${{ github.workspace }}
run: pixi run autotest
- 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@v5
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/widen_compat_reports.py "long_comp.csv" "comp.csv"
python ../common/widen_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: |
# one at a time
head="compat"
id=$(gh pr list -H $head -s open --json id -q ".[0].id")
[[ -n "${id// /}" ]] && (echo "PR already open"; exit 0) || (echo "opening PR")
# 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
git switch -c "$head"
# commit and push
git add DEVELOPER.md .github/compat/comp.csv .github/compat/test.csv
git commit -m "Update compatibility tables"
git push -u origin "$head"
# open PR
cat <(echo '### Compile') <(echo) .github/compat/comp.md <(echo) <(echo '### Test') <(echo) .github/compat/test.md > compat.md
gh pr create -B "${{ github.event.repository.default_branch }}" -H "$head" --title "Update compile/test compatibility tables" --body-file compat.md