From 91b02c1f34cb1bc03591fe6e3e72c8c7af784646 Mon Sep 17 00:00:00 2001 From: w-bonelli Date: Tue, 18 Jul 2023 13:15:43 -0400 Subject: [PATCH] ci: use awvwgk/setup-fortran, expand Intel testing --- .github/workflows/ci.yml | 220 ++++++++++++++++++++++++++-------- .github/workflows/large.yml | 21 +++- .github/workflows/release.yml | 16 ++- autotest/get_exes.py | 24 +++- 4 files changed, 218 insertions(+), 63 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a0eef2e97b..2b20d440684 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,6 +70,10 @@ jobs: - name: Meson compile run: meson compile -C builddir + - name: Show build log + if: failure() + run: cat builddir/meson-logs/meson-log.txt + - name: Meson test run: meson test --verbose --no-rebuild -C builddir @@ -106,7 +110,15 @@ jobs: run: | meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin meson install -C builddir - meson test --verbose --no-rebuild -C builddir + + - name: Show build log + if: failure() + working-directory: modflow6 + run: cat builddir/meson-logs/meson-log.txt + + - name: Unit test programs + working-directory: modflow6 + run: meson test --verbose --no-rebuild -C builddir - name: Update flopy working-directory: modflow6/autotest @@ -183,7 +195,15 @@ jobs: run: | meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin meson install -C builddir - meson test --verbose --no-rebuild -C builddir + + - name: Show build log + if: failure() + working-directory: modflow6 + run: cat builddir/meson-logs/meson-log.txt + + - name: Unit test programs + working-directory: modflow6 + run: meson test --verbose --no-rebuild -C builddir - name: Update flopy working-directory: modflow6/autotest @@ -289,8 +309,16 @@ jobs: run: | meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin meson install -C builddir - meson test --verbose --no-rebuild -C builddir + + - name: Show build log + if: failure() + working-directory: modflow6 + run: cat builddir/meson-logs/meson-log.txt + - name: Unit test programs + working-directory: modflow6 + run: meson test --verbose --no-rebuild -C builddir + - name: Get executables working-directory: modflow6/autotest env: @@ -308,8 +336,8 @@ jobs: pytest -v -n auto --durations 0 -m "not large" fi - test_ifort: - name: Test (ifort) + test_intel: + name: Test (Intel) needs: - lint - build @@ -318,7 +346,130 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] + include: + ### ifx + ## 2022.2.x autotests disabled + # - mf5to6 test_evt: failure to converge + # - mf6 Keating_[disu_]dev: bad head comparison + - os: ubuntu-22.04 + intel_compiler: intel + intel_version: 2022.2.1 + test: false + - os: ubuntu-22.04 + intel_compiler: intel + intel_version: 2022.2 + test: false + ## 2021.1 segfault in meson serial sim test + # - os: ubuntu-22.04 + # intel_compiler: intel + # intel_version: 2022.1 + # test: false + ## 2022.0 & 2021.[1,2,4] segfault at compile time + # - os: ubuntu-22.04 + # intel_compiler: intel + # intel_version: "2022.0" + # test: false + # - os: ubuntu-22.04 + # intel_compiler: intel + # intel_version: 2021.4 + # test: false + # - os: ubuntu-22.04 + # intel_compiler: intel + # intel_version: 2021.2 + # test: false + # - os: ubuntu-22.04 + # intel_compiler: intel + # intel_version: 2021.1 + # test: false + ## ifx not yet supported on macOS + # - os: macos-12 + # intel_compiler: intel + # intel_version: 2023.2 + # test: true + - os: windows-20222023.3 | + test: true + ## 2023.[0,1] fail to compile + # - os: windows-2022 + # intel_compiler: intel + # intel_version: 2023.1 + # test: false + # - os: windows-2022 + # intel_compiler: intel + # intel_version: "2023.0" + # test: false + - os: windows-2022 + intel_compiler: intel + intel_version: 2022.2 + test: false + ## 2022.1 fail to link + # - os: windows-2022 + # intel_compiler: intel + # intel_version: 2022.1 + # test: false + + ### ifort + ## only autotest latest on each platform + - os: ubuntu-22.04 + intel_compiler: intel-classic + intel_version: "2021.10" + test: true + - os: ubuntu-22.04 + intel_compiler: intel-classic + intel_version: 2021.9 + test: false + - os: ubuntu-22.04 + intel_compiler: intel-classic + intel_version: 2021.8 + test: false + - os: ubuntu-22.04 + intel_compiler: intel-classic + intel_version: 2021.7 + test: false + - os: ubuntu-22.04 + intel_compiler: intel-classic + intel_version: 2021.6 + test: false + - os: macos-12 + intel_compiler: intel-classic + intel_version: "2021.10" + test: true + - os: macos-12 + intel_compiler: intel-classic + intel_version: 2021.9 + test: false + - os: macos-12 + intel_compiler: intel-classic + intel_version: 2021.8 + test: false + - os: macos-12 + intel_compiler: intel-classic + intel_version: 2021.7 + test: false + - os: macos-12 + intel_compiler: intel-classic + intel_version: 2021.6 + test: false + - os: windows-2022 + intel_compiler: intel-classic + intel_version: "2021.10" + test: true + - os: windows-2022 + intel_compiler: intel-classic + intel_version: 2021.9 + test: false + - os: windows-2022 + intel_compiler: intel-classic + intel_version: 2021.8 + test: false + - os: windows-2022 + intel_compiler: intel-classic + intel_version: 2021.7 + test: false + - os: windows-2022 + intel_compiler: intel-classic + intel_version: 2021.6 + test: false + defaults: run: shell: bash -l {0} @@ -346,50 +497,44 @@ jobs: cache-downloads: true - name: Setup Intel Fortran - uses: modflowpy/install-intelfortran-action@v1 + uses: awvwgk/setup-fortran@main + with: + compiler: ${{ matrix.intel_compiler }} + version: ${{ matrix.intel_version }} - name: Update version files working-directory: modflow6/distribution run: python update_version.py - 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 (Windows) - if: runner.os == 'Windows' + - name: Show build log + if: failure() 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 + run: cat builddir/meson-logs/meson-log.txt + + - name: Unit test programs + working-directory: modflow6 + run: meson test --verbose --no-rebuild -C builddir - name: Update flopy + if: matrix.test working-directory: modflow6/autotest run: python update_flopy.py - name: Get executables - if: runner.os != 'Windows' - working-directory: modflow6/autotest - env: - GITHUB_TOKEN: ${{ github.token }} - run: pytest -v --durations 0 get_exes.py - - - name: Get executables (Windows) - if: runner.os == 'Windows' + if: matrix.test working-directory: modflow6/autotest - shell: pwsh env: GITHUB_TOKEN: ${{ github.token }} run: pytest -v --durations 0 get_exes.py - name: Test programs - if: runner.os != 'Windows' + if: matrix.test working-directory: modflow6/autotest env: REPOS_PATH: ${{ github.workspace }} @@ -400,30 +545,9 @@ jobs: pytest -v -n auto --durations 0 -m "not large" fi - - name: Test programs (Windows) - if: runner.os == 'Windows' - working-directory: modflow6/autotest - shell: pwsh - env: - REPOS_PATH: ${{ github.workspace }} - run: | - if ( "${{ github.ref_name }}" -eq "master" ) { - pytest -v -n auto --durations 0 -m "not large and not developmode" - } else { - pytest -v -n auto --durations 0 -m "not large" - } - - name: Test scripts - if: runner.os != 'Windows' - working-directory: modflow6/distribution - env: - GITHUB_TOKEN: ${{ github.token }} - run: pytest -v --durations 0 - - - name: Test scripts (Windows) - if: runner.os == 'Windows' + if: matrix.test working-directory: modflow6/distribution - shell: pwsh env: GITHUB_TOKEN: ${{ github.token }} run: pytest -v --durations 0 diff --git a/.github/workflows/large.yml b/.github/workflows/large.yml index 291dcc16673..7829f49b8dd 100644 --- a/.github/workflows/large.yml +++ b/.github/workflows/large.yml @@ -2,6 +2,9 @@ name: MODFLOW 6 large models on: schedule: - cron: '0 6 * * *' # run at 6 AM UTC every day +env: + GCC_V: 12 + IFORT_V: 2021.7.0 jobs: cache_ifort: name: Cache Intel OneAPI compilers @@ -11,8 +14,13 @@ jobs: matrix: os: [ ubuntu-22.04, macos-12, windows-2022 ] steps: - - name: Setup Intel Fortran - uses: modflowpy/install-intelfortran-action@v1 + + - name: Setup ifort ${{ env.IFORT_V }} + uses: awvwgk/setup-fortran@main + with: + compiler: intel-classic + version: ${{ env.IFORT_V }} + test: name: Test runs-on: ubuntu-22.04 @@ -24,8 +32,6 @@ jobs: defaults: run: shell: bash -l {0} - env: - GCC_V: 12 steps: - name: Checkout modflow6 @@ -53,9 +59,12 @@ jobs: compiler: gcc version: ${{ env.GCC_V }} - - name: Setup ifort + - name: Setup ifort ${{ env.IFORT_V }}} if: matrix.fc == 'ifort' - uses: modflowpy/install-intelfortran-action@v1 + uses: awvwgk/setup-fortran@main + with: + compiler: intel-classic + version: ${{ env.IFORT_V }} - name: Cache modflow6 examples id: cache-examples diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index efe4b7be4c2..9361e66a11b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -46,6 +46,7 @@ on: value: ${{ jobs.build.outputs.distname }} env: FC: ifort + IFORT_V: 2021.7.0 jobs: build: name: Build binaries (${{ matrix.os }}) @@ -85,7 +86,10 @@ jobs: powershell - name: Setup Intel Fortran - uses: modflowpy/install-intelfortran-action@v1 + uses: awvwgk/setup-fortran@main + with: + compiler: intel-classic + version: ${{ env.IFORT_V }} - name: Set version number id: set_version @@ -279,7 +283,10 @@ jobs: cache-environment: true - name: Setup Intel Fortran - uses: modflowpy/install-intelfortran-action@v1 + uses: awvwgk/setup-fortran@main + with: + compiler: intel-classic + version: ${{ env.IFORT_V }} - name: Update version id: update_version @@ -416,7 +423,10 @@ jobs: powershell - name: Setup Intel Fortran - uses: modflowpy/install-intelfortran-action@v1 + uses: awvwgk/setup-fortran@main + with: + compiler: intel-classic + version: ${{ env.IFORT_V }} - name: Update version id: update_version diff --git a/autotest/get_exes.py b/autotest/get_exes.py index 0a071d50fea..f8c92ccfc85 100644 --- a/autotest/get_exes.py +++ b/autotest/get_exes.py @@ -1,7 +1,9 @@ import argparse +from os import environ from pathlib import Path from tempfile import TemporaryDirectory from warnings import warn +from platform import system import flopy import pytest @@ -9,7 +11,7 @@ from flaky import flaky from modflow_devtools.build import meson_build from modflow_devtools.download import download_and_unzip, get_release -from modflow_devtools.misc import get_ostag +from modflow_devtools.misc import get_ostag, is_in_ci, set_env repository = "MODFLOW-USGS/modflow6" top_bin_path = project_root_path / "bin" @@ -73,11 +75,21 @@ def test_rebuild_release(rebuilt_bin_path: Path): f.write(f"{line}\n") # rebuild with Meson - meson_build( - project_path=source_files_path.parent, - build_path=download_path / "builddir", - bin_path=rebuilt_bin_path, - ) + def rebuild(): + meson_build( + project_path=source_files_path.parent, + build_path=download_path / "builddir", + bin_path=rebuilt_bin_path, + ) + + # temp workaround until next release, + # ifx fails to build 6.4.2 on Windows + # most likely due to backspace issues + if system() == "Windows" and environ.get("FC") == "ifx": + with set_env(FC="ifort", CC="icl"): + rebuild() + else: + rebuild() @flaky(max_runs=3)