From 7bb16194d4f07c79f5443a13ddd18a31c87abbff Mon Sep 17 00:00:00 2001 From: w-bonelli Date: Mon, 24 Oct 2022 10:49:24 -0400 Subject: [PATCH] ci: refactor/update miscellaneous * switch from modflowpy/install-gfortran-action to awvwgk/setup-fortran for gfortran setup * rename test_z03_largetests.py to test_z03_largetestmodels.py (allows cleaner CI config) * bump latest gfortran tests, nightly build tests and large/example model tests to GCC/gfortran 12 * colocate push-triggered CI jobs in ci.yml * update CI badges in readme * mark get_exes tests as flaky to retry download on failure (and add flaky to environment.yml) * add ci-diagnose* to branches triggering CI --- .github/common/checkout-regression-branch.sh | 9 - .../common/get-examples-regression-files.sh | 5 - .../common/get-largetests-regression-files.sh | 5 - .github/common/get-regression-files.sh | 5 - .github/common/git-branch-export.sh | 10 - .github/common/update-flopy.sh | 5 - .../workflows/ci-check-warnings-gfortran.yml | 83 ---- .github/workflows/ci-format.yml | 38 -- .github/workflows/ci-large-tests.yml | 106 ----- .../workflows/ci-tests-gfortran-latest.yml | 83 ---- .../workflows/ci-tests-gfortran-previous.yml | 91 ---- .github/workflows/ci-tests-ifort.yml | 99 ---- .github/workflows/ci.yml | 439 ++++++++++++++++++ .github/workflows/{ci-docs.yml => docs.yml} | 15 +- .github/workflows/large.yml | 97 ++++ README.md | 6 +- autotest/get_exes.py | 3 + ...getests.py => test_z03_largetestmodels.py} | 0 environment.yml | 1 + 19 files changed, 552 insertions(+), 548 deletions(-) delete mode 100755 .github/common/checkout-regression-branch.sh delete mode 100755 .github/common/get-examples-regression-files.sh delete mode 100755 .github/common/get-largetests-regression-files.sh delete mode 100755 .github/common/get-regression-files.sh delete mode 100755 .github/common/git-branch-export.sh delete mode 100755 .github/common/update-flopy.sh delete mode 100644 .github/workflows/ci-check-warnings-gfortran.yml delete mode 100644 .github/workflows/ci-format.yml delete mode 100644 .github/workflows/ci-large-tests.yml delete mode 100644 .github/workflows/ci-tests-gfortran-latest.yml delete mode 100644 .github/workflows/ci-tests-gfortran-previous.yml delete mode 100644 .github/workflows/ci-tests-ifort.yml create mode 100644 .github/workflows/ci.yml rename .github/workflows/{ci-docs.yml => docs.yml} (96%) create mode 100644 .github/workflows/large.yml rename autotest/{test_z03_largetests.py => test_z03_largetestmodels.py} (100%) diff --git a/.github/common/checkout-regression-branch.sh b/.github/common/checkout-regression-branch.sh deleted file mode 100755 index 5a3a7c85047..00000000000 --- a/.github/common/checkout-regression-branch.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -cd ../modflow6-testmodels -if git show-ref -q --heads ${BRANCH}; then - git checkout ${BRANCH}; echo switched to modflow6-testmodels branch ${BRANCH}; -else echo using modflow6-testmodels branch master; fi -git branch -cd ../modflow6 -ls ../ diff --git a/.github/common/get-examples-regression-files.sh b/.github/common/get-examples-regression-files.sh deleted file mode 100755 index 73686e26de1..00000000000 --- a/.github/common/get-examples-regression-files.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -echo $HOME -pwd -git clone https://github.com/MODFLOW-USGS/modflow6-examples ../modflow6-examples diff --git a/.github/common/get-largetests-regression-files.sh b/.github/common/get-largetests-regression-files.sh deleted file mode 100755 index 8f4647d717d..00000000000 --- a/.github/common/get-largetests-regression-files.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -echo $HOME -pwd -git clone https://github.com/MODFLOW-USGS/modflow6-largetestmodels ../modflow6-largetestmodels diff --git a/.github/common/get-regression-files.sh b/.github/common/get-regression-files.sh deleted file mode 100755 index 1a0af86b1c3..00000000000 --- a/.github/common/get-regression-files.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -echo $HOME -pwd -git clone https://github.com/MODFLOW-USGS/modflow6-testmodels ../modflow6-testmodels diff --git a/.github/common/git-branch-export.sh b/.github/common/git-branch-export.sh deleted file mode 100755 index 416c05328a5..00000000000 --- a/.github/common/git-branch-export.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -echo GITHUB_REF branch name ${GITHUB_REF##*/} -echo GITHUB_REF=${GITHUB_REF} -echo GITHUB_HEAD_REF=${GITHUB_HEAD_REF} -echo GITHUB_BASE_REF=${GITHUB_BASE_REF} -if [ -z ${GITHUB_BASE_REF+x} ]; then - export BRANCH=${GITHUB_REF##*/}; -else export BRANCH=${GITHUB_HEAD_REF}; fi -echo BRANCH=${BRANCH} diff --git a/.github/common/update-flopy.sh b/.github/common/update-flopy.sh deleted file mode 100755 index 226030c4952..00000000000 --- a/.github/common/update-flopy.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -cd autotest -python update_flopy.py -cd .. diff --git a/.github/workflows/ci-check-warnings-gfortran.yml b/.github/workflows/ci-check-warnings-gfortran.yml deleted file mode 100644 index 0b8dc258f87..00000000000 --- a/.github/workflows/ci-check-warnings-gfortran.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: check warnings - gfortran - -on: - push: - branches: - - develop - pull_request: - branches: - - develop - -env: - FC: gfortran - -jobs: - check_warnings: - runs-on: ubuntu-latest - defaults: - run: - shell: bash -l {0} - - steps: - - name: Checkout repo - uses: actions/checkout@v2.3.4 - - - name: Install Conda environment from environment.yml - uses: mamba-org/provision-with-micromamba@main - with: - cache-downloads: true - cache-env: true - - - name: Install gfortran - uses: modflowpy/install-gfortran-action@v1 - - - name: Print python package versions - run: | - pip list - - - name: Setup modflow - run: | - meson setup builddir -Ddebug=false -Dwerror=true - - - name: Build modflow and check for warnings - run: | - meson compile -C builddir - - test_night_build_script: - runs-on: ubuntu-latest - defaults: - run: - shell: bash -l {0} - - steps: - - name: Checkout repo - uses: actions/checkout@v2.3.4 - - - name: Install Conda environment from environment.yml - uses: mamba-org/provision-with-micromamba@main - with: - cache-downloads: true - cache-env: true - - - name: Install gfortran - uses: modflowpy/install-gfortran-action@v1 - - - name: Print python package versions - run: | - pip list - - - name: Update flopy MODFLOW 6 classes - working-directory: autotest - run: | - python update_flopy.py - - - name: Run nightly build script - working-directory: distribution - run: | - pytest -v -s build_nightly.py - - - name: Move the build zip file - run: | - ls -l ./distribution/* - mv ./distribution/temp_zip/linux.zip ./linux.zip - ls -l ./ diff --git a/.github/workflows/ci-format.yml b/.github/workflows/ci-format.yml deleted file mode 100644 index ebc5114aead..00000000000 --- a/.github/workflows/ci-format.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: fortran-format-check - -on: - push: - branches: [ master, develop ] - pull_request: - branches: [ develop ] - -jobs: - fortan-format-check: - runs-on: ubuntu-latest - defaults: - run: - shell: bash -l {0} - - steps: - - uses: actions/checkout@v2.3.4 - - - name: Install Conda environment from environment.yml - uses: mamba-org/provision-with-micromamba@main - with: - cache-downloads: true - cache-env: true - - - name: Install gfortran - uses: modflowpy/install-gfortran-action@v1 - - - name: Print python package versions - run: | - pip list - - - name: Set and print branch name - run: | - .github/common/git-branch-export.sh - - - name: Fortran source format check - run: | - .github/common/fortran-format-check.sh diff --git a/.github/workflows/ci-large-tests.yml b/.github/workflows/ci-large-tests.yml deleted file mode 100644 index 50a2d805298..00000000000 --- a/.github/workflows/ci-large-tests.yml +++ /dev/null @@ -1,106 +0,0 @@ -# Parts of configuration file are based on the examples in this repository: -# https://github.com/oneapi-src/oneapi-ci -# -# Which have the following copyright: -# SPDX-FileCopyrightText: 2020 Intel Corporation -# -# SPDX-License-Identifier: MIT - - -## add this back in to on: if there is a need to debug the large tests -# -#pull_request: -# branches: -# - develop - - -name: Run and test modflow6-largetestmodels and modflow6-examples (z03) - -on: - schedule: - - cron: '0 6 * * *' # run at 6 AM UTC every day - -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - FC: [ ifort, gfortran ] - test_script: [ largetests, examples ] - defaults: - run: - shell: bash -l {0} - - if: github.repository_owner == 'MODFLOW-USGS' - steps: - - name: Checkout repo - uses: actions/checkout@v2.3.4 - - - name: Install Conda environment from environment.yml - uses: mamba-org/provision-with-micromamba@main - with: - cache-downloads: true - cache-env: true - - - name: set FC=ifort environmental variable - if: matrix.FC == 'ifort' - run: | - echo "FC=ifort" >> $GITHUB_ENV - - - name: Install ifort - if: matrix.FC == 'ifort' - uses: modflowpy/install-intelfortran-action@v1 - - - name: Install gfortran - if: matrix.FC == 'gfortran' - uses: modflowpy/install-gfortran-action@v1 - - - name: Install additional python packages - run: | - micromamba install jupyter jupytext shapely scipy pandas pyshp - - - name: Print python package versions - run: | - pip list - - - name: Set and print branch name - run: | - .github/common/git-branch-export.sh - - - name: Get the appropriate large or example regression test files - run: | - .github/common/get-${{ matrix.test_script }}-regression-files.sh - - - name: Update flopy MODFLOW 6 classes - run: | - .github/common/update-flopy.sh - - - name: Run script to build example scripts - if: matrix.test_script == 'examples' - run: | - cd ../modflow6-examples/etc/ - python ci_build_files.py - ls -lh ../examples/ - cd ../../modflow6 - - - name: activate ifort and build applications - if: matrix.FC == 'ifort' - run: | - meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin - meson install -C builddir - cd autotest - pytest -v --durations=0 get_exes.py - - - name: Build gfortran applications - if: matrix.FC == 'gfortran' - run: | - meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin - meson install -C builddir - cd autotest - pytest -v --durations=0 get_exes.py - - - name: Test applications - working-directory: autotest - run: | - pytest -v -n=auto --durations=0 test_z03_${{ matrix.test_script }}.py \ No newline at end of file diff --git a/.github/workflows/ci-tests-gfortran-latest.yml b/.github/workflows/ci-tests-gfortran-latest.yml deleted file mode 100644 index ae952f86670..00000000000 --- a/.github/workflows/ci-tests-gfortran-latest.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: tests - gfortran - latest version - -on: - push: - branches: - - develop - pull_request: - branches: - - develop - -env: - FC: gfortran - -jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - defaults: - run: - shell: bash -l {0} - - steps: - - name: Checkout repo - uses: actions/checkout@v2.3.4 - - - name: Install Conda environment from environment.yml - uses: mamba-org/provision-with-micromamba@main - with: - cache-downloads: true - cache-env: true - - - name: Print python package versions - run: | - pip list - - - name: Install gfortran - uses: modflowpy/install-gfortran-action@v1 - - - name: Set and print branch name - run: | - .github/common/git-branch-export.sh - - - name: Test make for MODFLOW 6 programs - working-directory: ./distribution - run: | - pytest -v -n=auto build_makefiles.py - - - name: Get regression test files - run: | - .github/common/get-regression-files.sh - - - name: Check out the correct regression test branch - run: | - .github/common/checkout-regression-branch.sh - - - name: Update flopy MODFLOW 6 classes - run: | - .github/common/update-flopy.sh - - - name: Setup modflow - run: | - meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin - - - name: Build and install modflow - run: | - meson install -C builddir - - - name: Test modflow installation - run: | - meson test --verbose --no-rebuild -C builddir - - - name: Get executables - working-directory: autotest - run: | - pytest -v --durations=0 get_exes.py - - - name: Test applications - working-directory: autotest - run: | - pytest -v -n=auto --durations=0 diff --git a/.github/workflows/ci-tests-gfortran-previous.yml b/.github/workflows/ci-tests-gfortran-previous.yml deleted file mode 100644 index e476d90049b..00000000000 --- a/.github/workflows/ci-tests-gfortran-previous.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: tests - gfortran - previous versions - -on: - push: - branches: - - develop - pull_request: - branches: - - develop - -env: - FC: gfortran - -jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest ] - GCC_V: [ 7, 8, 9 ] - defaults: - run: - shell: bash -l {0} - - steps: - - name: Checkout repo - uses: actions/checkout@v2.3.4 - - - name: Install Conda environment from environment.yml - uses: mamba-org/provision-with-micromamba@main - with: - cache-downloads: true - cache-env: true - - - name: Set up gfortran ${{ matrix.GCC_V }} - run: | - sudo apt-get install -y --no-install-recommends gcc-${{ matrix.GCC_V }} g++-${{ matrix.GCC_V }} gfortran-${{ matrix.GCC_V }} - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.GCC_V }} 100 \ - --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.GCC_V }} \ - --slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.GCC_V }} \ - --slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.GCC_V }} - - - name: Print GNU compiler versions - run: | - gcc --version - gfortran --version - g++ --version - gcov --version - - - name: Print python package versions - run: | - pip list - - - name: Set and print branch name - run: | - .github/common/git-branch-export.sh - - - name: Get regression test files - run: | - .github/common/get-regression-files.sh - - - name: Check out the correct regression test branch - run: | - .github/common/checkout-regression-branch.sh - - - name: Update flopy MODFLOW 6 classes - run: | - .github/common/update-flopy.sh - - - name: Setup modflow - run: | - meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin - - - name: Build and install modflow - run: | - meson install -C builddir - - - name: Test modflow installation - run: | - meson test --verbose --no-rebuild -C builddir - - - name: Get executables - working-directory: autotest - run: | - pytest -v --durations=0 get_exes.py - - - name: Test applications - working-directory: autotest - run: | - pytest -v -n=auto --durations=0 diff --git a/.github/workflows/ci-tests-ifort.yml b/.github/workflows/ci-tests-ifort.yml deleted file mode 100644 index 494c0d35af6..00000000000 --- a/.github/workflows/ci-tests-ifort.yml +++ /dev/null @@ -1,99 +0,0 @@ -# Parts of configuration file are based on the examples in this repository: -# https://github.com/oneapi-src/oneapi-ci -# -# Which have the following copyright: -# SPDX-FileCopyrightText: 2020 Intel Corporation -# -# SPDX-License-Identifier: MIT - -name: tests - ifort - -on: - push: - branches: - - develop - pull_request: - branches: - - develop - -env: - FC: ifort - -jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-latest - - os: macos-latest - - os: windows-latest - defaults: - run: - shell: bash -l {0} - - steps: - - name: Checkout repo - uses: actions/checkout@v2.3.4 - - - name: Install Conda environment - uses: mamba-org/provision-with-micromamba@main - with: - cache-downloads: true - cache-env: true - - - name: Print Python package versions - run: | - pip list - - - name: Install ifort - uses: modflowpy/install-intelfortran-action@v1 - - - name: Test makefiles - if: runner.os == 'Linux' || runner.os == 'macOS' - working-directory: ./distribution - run: | - pytest -v -n=auto build_makefiles.py - - - name: Set and print branch name - run: | - .github/common/git-branch-export.sh - - - name: Get regression test files - run: | - .github/common/get-regression-files.sh - - - name: Check out regression test branch - run: | - .github/common/checkout-regression-branch.sh - - - name: Update flopy - run: | - .github/common/update-flopy.sh - - - name: Build modflow6 - if: runner.os != 'Windows' - run: | - meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin - meson install -C builddir - meson test --verbose --no-rebuild -C builddir - cd autotest - pytest -v --durations=0 get_exes.py - - - name: Build modflow6 (Windows) - if: runner.os == 'Windows' - run: | - # activating micromamba environment causes default link.exe to be found instead of MSVC linker - export PATH="/C/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64":$PATH - - meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin - meson install -C builddir - meson test --verbose --no-rebuild -C builddir - cd autotest - pytest -v --durations=0 get_exes.py - - - name: Test applications - working-directory: autotest - run: | - pytest -v -n=auto --durations=0 \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..27caa9bde0e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,439 @@ +name: MODFLOW 6 continuous integration +on: + push: + branches: + - master + - develop + - ci-diagnose* + pull_request: + branches: + - master + - develop +jobs: + lint: + name: Lint (fprettify) + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + steps: + + - name: Checkout modflow6 + uses: actions/checkout@v3 + + - name: Setup Micromamba + uses: mamba-org/provision-with-micromamba@main + with: + cache-downloads: true + cache-env: true + + - name: Check Fortran source formatting + run: | + .github/common/fortran-format-check.sh + + build: + name: Build (gfortran 12) + runs-on: ubuntu-22.04 + defaults: + run: + shell: bash -l {0} + env: + FC: gfortran + GCC_V: 12 + steps: + + - name: Checkout modflow6 + uses: actions/checkout@v3 + + - name: Setup gfortran ${{ env.GCC_V }} + uses: awvwgk/setup-fortran@main + with: + compiler: gcc + version: ${{ env.GCC_V }} + + - name: Setup Micromamba + uses: mamba-org/provision-with-micromamba@main + with: + cache-downloads: true + cache-env: true + + - name: Meson setup/compile + run: | + meson setup builddir -Ddebug=false -Dwerror=true + meson compile -C builddir + + - name: Meson test + run: | + meson test --verbose --no-rebuild -C builddir + + test_gfortran_latest: + name: Test (gfortran 12) + needs: + - lint + - build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-22.04, macos-12, windows-2022 ] + defaults: + run: + shell: bash -l {0} + env: + FC: gfortran + GCC_V: 12 + steps: + - name: Checkout modflow6 + uses: actions/checkout@v3 + with: + path: modflow6 + + - name: Checkout modflow6-testmodels + uses: actions/checkout@v3 + with: + repository: MODFLOW-USGS/modflow6-testmodels + path: modflow6-testmodels + + - name: Setup gfortran ${{ env.GCC_V }} + uses: awvwgk/setup-fortran@main + with: + compiler: gcc + version: ${{ env.GCC_V }} + + - name: Setup Micromamba + uses: mamba-org/provision-with-micromamba@main + with: + environment-file: modflow6/environment.yml + cache-downloads: true + cache-env: true + + - name: Build modflow6 + working-directory: modflow6 + run: | + meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + meson install -C builddir + meson test --verbose --no-rebuild -C builddir + + - name: Update flopy + working-directory: modflow6/autotest + run: | + python update_flopy.py + + - name: Get executables + working-directory: modflow6/autotest + run: | + pytest -v --durations 0 get_exes.py + + - name: Run tests + working-directory: modflow6/autotest + run: | + pytest -v -n auto --durations 0 + + test_gfortran_previous: + name: Test gfortran (${{ matrix.GCC_V }}, ${{ matrix.os }}) + needs: + - lint + - build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-20.04 ] + GCC_V: [ 7, 8, 9, 10, 11 ] + defaults: + run: + shell: bash -l {0} + env: + FC: gfortran + steps: + + - name: Checkout modflow6 + uses: actions/checkout@v3 + with: + path: modflow6 + + - name: Checkout modflow6-testmodels + uses: actions/checkout@v3 + with: + repository: MODFLOW-USGS/modflow6-testmodels + path: modflow6-testmodels + + - name: Setup gfortran ${{ matrix.GCC_V }} + uses: awvwgk/setup-fortran@main + with: + compiler: gcc + version: ${{ matrix.GCC_V }} + + - name: Setup Micromamba + uses: mamba-org/provision-with-micromamba@main + with: + environment-file: modflow6/environment.yml + cache-downloads: true + cache-env: true + + - name: Update flopy + working-directory: modflow6/autotest + run: | + python update_flopy.py + + - name: Build modflow6 + working-directory: modflow6 + run: | + meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + meson install -C builddir + meson test --verbose --no-rebuild -C builddir + + - name: Get executables + working-directory: modflow6/autotest + run: | + pytest -v --durations 0 get_exes.py + + - name: Run tests + working-directory: modflow6/autotest + run: | + pytest -v -n auto --durations 0 + + test_ifort: + name: Test (ifort) + needs: + - lint + - build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + defaults: + run: + shell: bash -l {0} + steps: + + - name: Checkout modflow6 + uses: actions/checkout@v3 + with: + path: modflow6 + + - name: Checkout modflow6-testmodels + uses: actions/checkout@v3 + with: + repository: MODFLOW-USGS/modflow6-testmodels + path: modflow6-testmodels + + - name: Setup Micromamba + uses: mamba-org/provision-with-micromamba@main + with: + environment-file: modflow6/environment.yml + cache-downloads: true + cache-env: true + + - name: Setup ifort + uses: modflowpy/install-intelfortran-action@v1 + + - name: Add Micromamba Scripts dir to path + if: runner.os == 'Windows' + shell: pwsh + run: | + # https://github.com/modflowpy/install-intelfortran-action#conda-scripts + $mamba_bin = "C:\Users\runneradmin\micromamba-root\envs\modflow6\Scripts" + echo $mamba_bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - name: Build modflow6 + if: runner.os != 'Windows' + working-directory: modflow6 + run: | + meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + meson install -C builddir + meson test --verbose --no-rebuild -C builddir + + - name: Build modflow6 + if: runner.os == 'Windows' + working-directory: modflow6 + shell: pwsh + run: | + meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + meson install -C builddir + meson test --verbose --no-rebuild -C builddir + + - name: Update flopy + working-directory: modflow6/autotest + run: | + python update_flopy.py + + - name: Get executables + if: runner.os != 'Windows' + working-directory: modflow6/autotest + run: | + pytest -v --durations 0 get_exes.py + + - name: Get executables + if: runner.os == 'Windows' + working-directory: modflow6/autotest + shell: pwsh + run: | + pytest -v --durations 0 get_exes.py + + - name: Run tests + if: runner.os != 'Windows' + working-directory: modflow6/autotest + run: | + pytest -v -n auto --durations 0 + + - name: Run tests + if: runner.os == 'Windows' + working-directory: modflow6/autotest + shell: pwsh + run: | + pytest -v -n auto --durations 0 + + test_makefiles_gfortran: + name: Test makefiles (gfortran ${{ matrix.gcc_v }}, ${{ matrix.os }}) + needs: + - lint + - build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-22.04, macos-12, windows-2022] + gcc_v: [ 12 ] + defaults: + run: + shell: bash -l {0} + env: + FC: gfortran + steps: + + - name: Checkout modflow6 + uses: actions/checkout@v3 + with: + path: modflow6 + + - name: Checkout modflow6-testmodels + uses: actions/checkout@v3 + with: + repository: MODFLOW-USGS/modflow6-testmodels + path: modflow6-testmodels + + - name: Setup gfortran ${{ matrix.gcc_v }} + uses: awvwgk/setup-fortran@main + with: + compiler: gcc + version: ${{ matrix.gcc_v }} + + - name: Setup Micromamba + uses: mamba-org/provision-with-micromamba@main + with: + environment-file: modflow6/environment.yml + cache-downloads: true + cache-env: true + + - name: Test makefiles + working-directory: modflow6/distribution + run: | + pytest -v -n auto build_makefiles.py + + test_makefiles_ifort: + name: Test makefiles (ifort, ${{ matrix.os }}) + needs: + - lint + - build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-latest ] + defaults: + run: + shell: bash -l {0} + env: + FC: ifort + steps: + + - name: Checkout modflow6 + uses: actions/checkout@v3 + with: + path: modflow6 + + - name: Checkout modflow6-testmodels + uses: actions/checkout@v3 + with: + repository: MODFLOW-USGS/modflow6-testmodels + path: modflow6-testmodels + + - name: Setup ifort + uses: modflowpy/install-intelfortran-action@v1 + + - name: Setup Micromamba + uses: mamba-org/provision-with-micromamba@main + with: + environment-file: modflow6/environment.yml + cache-downloads: true + cache-env: true + + - name: Test makefiles + working-directory: modflow6/distribution + run: | + pytest -v -n auto build_makefiles.py + + test_nightly_build_gfortran: + name: Test nightly build (gfortran 12) + needs: + - lint + - build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + ostag: linux + - os: macos-12 + ostag: mac + - os: windows-2022 + ostag: win64 + env: + GCC_V: 12 + defaults: + run: + shell: bash -l {0} + steps: + + - name: Checkout modflow6 + uses: actions/checkout@v3 + + - name: Setup gfortran ${{ env.GCC_V }} + uses: awvwgk/setup-fortran@main + with: + compiler: gcc + version: ${{ env.GCC_V }} + + - name: Setup Micromamba + uses: mamba-org/provision-with-micromamba@main + with: + cache-downloads: true + cache-env: true + + - name: Print Python package versions + run: | + pip list + + - name: Update flopy + working-directory: autotest + run: | + python update_flopy.py + + - name: Run nightly build script + working-directory: distribution + run: | + python build_nightly.py + + - name: Make sure zip file exists + working-directory: distribution + run: | + path="temp_zip/${{ matrix.ostag }}.zip" + if [ -e "$path" ]; then + echo "Zipfile found: $path" + else + echo "Zipfile not found: $path" + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/ci-docs.yml b/.github/workflows/docs.yml similarity index 96% rename from .github/workflows/ci-docs.yml rename to .github/workflows/docs.yml index e10a3fa30a0..529b69cb588 100644 --- a/.github/workflows/ci-docs.yml +++ b/.github/workflows/docs.yml @@ -1,11 +1,14 @@ -name: docs - +name: MODFLOW 6 documentation on: push: - branches: [ master, develop ] + branches: + - master + - develop + - ci-diagnose* pull_request: - branches: [ develop ] - + branches: + - master + - develop jobs: rtd_build: runs-on: ubuntu-latest @@ -17,7 +20,7 @@ jobs: distribution-directory: distribution steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v3 - name: Install Conda environment from environment.yml uses: mamba-org/provision-with-micromamba@main diff --git a/.github/workflows/large.yml b/.github/workflows/large.yml new file mode 100644 index 00000000000..ed23cc21e4f --- /dev/null +++ b/.github/workflows/large.yml @@ -0,0 +1,97 @@ +name: MODFLOW 6 large models +on: + schedule: + - cron: '0 6 * * *' # run at 6 AM UTC every day +jobs: + test: + name: Test + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + fc: [ ifort, gfortran ] + repo: [ examples, largetestmodels ] + defaults: + run: + shell: bash -l {0} + env: + GCC_V: 12 + steps: + + - name: Checkout modflow6 + uses: actions/checkout@v3 + with: + path: modflow6 + + - name: Checkout modflow6-${{ matrix.repo }} + uses: actions/checkout@v3 + with: + repository: MODFLOW-USGS/modflow6-${{ matrix.repo }} + path: modflow6-${{ matrix.repo }} + + - name: Setup Micromamba + uses: mamba-org/provision-with-micromamba@main + with: + environment-file: modflow6/environment.yml + cache-downloads: true + cache-env: true + + - name: Setup gfortran ${{ env.GCC_V }} + if: matrix.FC == 'gfortran' + uses: awvwgk/setup-fortran@main + with: + compiler: gcc + version: ${{ env.GCC_V }} + + - name: Setup ifort + if: matrix.fc == 'ifort' + uses: modflowpy/install-intelfortran-action@v1 + + - name: Cache modflow6 examples + id: cache-examples + uses: actions/cache@v3 + with: + path: modflow6-examples/examples + key: modflow6-examples-${{ hashFiles('modflow6-examples/data/**') }} + + - name: Install extra Python packages + if: matrix.repo == 'examples' && steps.cache-examples.outputs.cache-hit != 'true' + working-directory: modflow6-examples/etc + run: | + pip install -r requirements.pip.txt + + - name: Build example models + if: matrix.repo == 'examples' && steps.cache-examples.outputs.cache-hit != 'true' + working-directory: modflow6-examples/etc + run: | + python ci_build_files.py + ls -lh ../examples/ + + - name: Add Micromamba Scripts dir to path (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + # add micromamba scripts dir to system path + $mamba_bin = "C:\Users\runneradmin\micromamba-root\envs\modflow6\Scripts" + echo $mamba_bin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - name: Build modflow6 + working-directory: modflow6 + run: | + meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin + meson install -C builddir + + - name: Get executables + working-directory: modflow6/autotest + run: | + pytest -v --durations 0 get_exes.py + + - name: Update flopy + working-directory: modflow6/autotest + run: | + python update_flopy.py + + - name: Run tests + working-directory: modflow6/autotest + run: | + pytest -v -n auto --durations 0 test_z03_${{ matrix.repo }}.py \ No newline at end of file diff --git a/README.md b/README.md index bb36b52579a..094f48868b7 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ This is the development repository for the USGS MODFLOW 6 Hydrologic Model. The ### Version 6.4.0 release candidate -[![tests - ifort](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/ci-tests-ifort.yml/badge.svg)](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/ci-tests-ifort.yml) -[![tests - gfortran - latest version](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/ci-tests-gfortran-latest.yml/badge.svg)](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/ci-tests-gfortran-latest.yml) -[![tests - gfortran - previous versions](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/ci-tests-gfortran-previous.yml/badge.svg)](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/ci-tests-gfortran-previous.yml) +[![MODFLOW 6 continuous integration](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/ci.yml/badge.svg)](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/ci.yml) +[![MODFLOW 6 documentation](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/docs.yml/badge.svg)](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/docs.yml) +[![MODFLOW 6 large models](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/large.yml/badge.svg)](https://github.com/MODFLOW-USGS/modflow6/actions/workflows/large.yml) [![MODFLOW 6 intel nightly build](https://github.com/MODFLOW-USGS/modflow6-nightly-build/actions/workflows/nightly-build-intel.yml/badge.svg)](https://github.com/MODFLOW-USGS/modflow6-nightly-build/actions/workflows/nightly-build-intel.yml) [![MODFLOW 6 nightly build](https://github.com/MODFLOW-USGS/modflow6-nightly-build/actions/workflows/nightly-build.yml/badge.svg)](https://github.com/MODFLOW-USGS/modflow6-nightly-build/actions/workflows/nightly-build.yml) diff --git a/autotest/get_exes.py b/autotest/get_exes.py index e30197a4811..7530f31ca3f 100644 --- a/autotest/get_exes.py +++ b/autotest/get_exes.py @@ -3,6 +3,7 @@ import os import shutil +from flaky import flaky import pymake from build_exes import meson_build @@ -96,6 +97,7 @@ def test_create_dirs(): create_dir(pth) +@flaky(max_runs=3) def test_getmfexes(verify=True): pymake.getmfexes(mfexe_pth, verify=verify) for target in os.listdir(mfexe_pth): @@ -106,6 +108,7 @@ def test_getmfexes(verify=True): shutil.copy(srcpth, dstpth) +@flaky(max_runs=3) def test_rebuild_mf6_release(): rebuild_mf6_release() diff --git a/autotest/test_z03_largetests.py b/autotest/test_z03_largetestmodels.py similarity index 100% rename from autotest/test_z03_largetests.py rename to autotest/test_z03_largetestmodels.py diff --git a/environment.yml b/environment.yml index 4b6d4da6a01..acdb3fc6451 100644 --- a/environment.yml +++ b/environment.yml @@ -19,4 +19,5 @@ dependencies: - git+https://github.com/MODFLOW-USGS/modflowapi.git - pytest - pytest-xdist + - flaky - requests