diff --git a/.github/workflows/nightly-build-intel.yml b/.github/workflows/nightly-build-intel.yml index a0723a4..82d62a7 100644 --- a/.github/workflows/nightly-build-intel.yml +++ b/.github/workflows/nightly-build-intel.yml @@ -1,63 +1,82 @@ -# 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: MODFLOW 6 intel nightly build - on: schedule: - cron: '0 2 * * *' # run at 2 AM UTC - # - cron: '*/10 * * * *' # run every 10 minutes - # - cron: '20 */1 * * *' # run every hour at 20 minutes past the hour push: branches: - master + - develop* + - ci-diagnose* pull_request: branches: - master - env: FC: ifort - jobs: - build_for_os: - name: compile code + build: + name: Build binaries runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - - os: ubuntu-20.04 - artifact_name: linux.zip - - os: macos-latest - artifact_name: mac.zip - - os: windows-latest - artifact_name: win64.zip - defaults: - run: - shell: bash - + - os: ubuntu-22.04 + artifact_name: linux + - os: macos-12 + artifact_name: mac + - os: windows-2022 + artifact_name: win64 steps: + - name: Checkout repo uses: actions/checkout@v3 + - name: Checkout modflow6 + uses: actions/checkout@v3 + with: + repository: MODFLOW-USGS/modflow6 + path: modflow6 + ref: develop + - name: Setup Python uses: actions/setup-python@v4.0.0 with: python-version: 3.9 - name: Install Python packages - run: | - pip install -r requirements.txt - pip list + run: pip install -r requirements.txt - - name: Install ifort + - name: Setup Intel Fortran uses: modflowpy/install-intelfortran-action@v1 + - name: Update version timestamps + run: python modflow6/distribution/update_version.py + + - name: Build binaries + 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: Move code.json + run: cp modflow6/code.json modflow6/bin/code.json + + - name: Upload binaries + uses: actions/upload-artifact@v3 + with: + name: bin-${{ runner.os }} + path: modflow6/bin + + docs: + name: Build documentation + needs: build + runs-on: ubuntu-22.04 + steps: + + - name: Checkout repo + uses: actions/checkout@v3 + - name: Checkout modflow6 uses: actions/checkout@v3 with: @@ -65,122 +84,200 @@ jobs: path: modflow6 ref: develop - - name: Update flopy classes - working-directory: modflow6/autotest - run: | - python update_flopy.py - - - name: Build and zip - if: runner.os != 'Windows' - working-directory: modflow6/distribution - run: | - python build_nightly.py - - - name: Build and zip (Windows) - if: runner.os == 'Windows' - working-directory: modflow6/distribution - shell: pwsh - run: | - python build_nightly.py + - name: Setup Python + uses: actions/setup-python@v4.0.0 + with: + python-version: 3.9 - - name: Move the build zip file - run: | - ls -l ./modflow6/distribution/* - mv ./modflow6/distribution/temp_zip/${{ matrix.artifact_name }} ./${{ matrix.artifact_name }} - ls -l ./ + - name: Install Python packages + run: pip install -r requirements.txt - - name: Copy the modflow6/docs directory - if: runner.os == 'Linux' - shell: python - run: | - import shutil - src = "/home/runner/work/modflow6-nightly-build/modflow6-nightly-build/modflow6/doc/" - dst = "./doc/" - shutil.copytree(src, dst) + - name: Checkout usgslatex + uses: actions/checkout@v3 + with: + repository: MODFLOW-USGS/usgslatex + path: usgslatex - name: Install TeX Live - if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt install texlive-latex-extra texlive-science texlive-font-utils - - - name: Clone USGS LaTeX repo - if: runner.os == 'Linux' - run: | - git clone https://github.com/MODFLOW-USGS/usgslatex.git usgslatex + sudo apt install texlive-latex-extra \ + texlive-science \ + texlive-font-utils \ + texlive-fonts-recommended \ + texlive-fonts-extra \ + dos2unix - name: Install USGS LaTeX style files and Univers font - if: runner.os == 'Linux' - working-directory: ./usgslatex/usgsLaTeX - run: | - sudo ./install.sh --all-users + working-directory: usgslatex/usgsLaTeX + run: sudo ./install.sh --all-users - - name: Build mf6io latex document - if: runner.os == 'Linux' - shell: python + - name: Download binaries + uses: actions/download-artifact@v3 + with: + name: bin-${{ runner.os }} + path: modflow6/bin + + - name: Checkout modflow6-examples + uses: actions/checkout@v3 + with: + repository: MODFLOW-USGS/modflow6-examples + path: modflow6-examples + + - name: Cache modflow6 examples + id: cache-examples + uses: actions/cache@v3 + with: + path: modflow6-examples/examples + key: modflow6-examples-${{ hashFiles('modflow6-examples/scripts/**') }} + + - name: Install extra Python packages + if: steps.cache-examples.outputs.cache-hit != 'true' + working-directory: modflow6-examples/etc + run: pip install -r requirements.pip.txt + + - name: Build example models + if: steps.cache-examples.outputs.cache-hit != 'true' + working-directory: modflow6-examples/etc + run: python ci_build_files.py + + - name: Build docs + env: + GITHUB_TOKEN: ${{ github.token }} run: | - import sys - import subprocess + # example path below is hard-coded into modflow6/distribution/build_docs.py + # once that's fixed, this can be removed + mkdir -p modflow6-examples/examples/ex-gwf-twri01 - ws = "./modflow6/doc/mf6io/" - bibnam = "mf6io" - texnam = bibnam + ".tex" - cmds = [ - ["pdflatex", texnam], - ["bibtex", bibnam], - ["pdflatex", texnam], - ["pdflatex", texnam], - ] - for cmd in cmds: - print("running command...'{}'".format(" ".join(cmd))) - with subprocess.Popen(cmd, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - cwd=ws) as process: - stdout, stderr = process.communicate(timeout=10) - if stdout: - stdout = stdout.decode() - print(stdout) - if stderr: - print("\n\nError condition occurred:\n") - stderr = stderr.decode() - print(stderr) - - - name: Move the LaTeX document - if: runner.os == 'Linux' + # execute permission may not have survived upload/download-artifact actions + chmod +x modflow6/bin/mf6 + chmod +x modflow6/bin/mf5to6 + chmod +x modflow6/bin/zbud6 + + # build the docs + python modflow6/distribution/build_docs.py -d -b modflow6/bin -o docs + + - name: Upload docs + uses: actions/upload-artifact@v3 + with: + name: mf6io + path: docs/mf6io.pdf + + dist: + name: Build distributions + needs: docs + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + artifact_name: linux + - os: macos-12 + artifact_name: mac + - os: windows-2022 + artifact_name: win64 + defaults: + run: + shell: bash + steps: + + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Checkout modflow6 + uses: actions/checkout@v3 + with: + repository: MODFLOW-USGS/modflow6 + path: modflow6 + ref: develop + + - name: Setup Python + uses: actions/setup-python@v4.0.0 + with: + python-version: 3.9 + + - name: Install Python packages + run: pip install -r requirements.txt + + - name: Setup Intel Fortran + uses: modflowpy/install-intelfortran-action@v1 + + - name: Download binaries + uses: actions/download-artifact@v3 + with: + name: bin-${{ runner.os }} + path: ${{ matrix.artifact_name }}/bin + + - name: Update FloPy classes + working-directory: modflow6/autotest + run: python update_flopy.py + + - name: Checkout modflow6-examples + uses: actions/checkout@v3 + with: + repository: MODFLOW-USGS/modflow6-examples + path: modflow6-examples + + - name: Cache modflow6 examples + id: cache-examples + uses: actions/cache@v3 + with: + path: modflow6-examples/examples + key: modflow6-examples-${{ hashFiles('modflow6-examples/scripts/**') }} + + - name: Install extra Python packages + if: steps.cache-examples.outputs.cache-hit != 'true' + working-directory: modflow6-examples/etc + run: pip install -r requirements.pip.txt + + - name: Build example models + if: steps.cache-examples.outputs.cache-hit != 'true' + working-directory: modflow6-examples/etc + run: python ci_build_files.py + + - name: Build distribution run: | - ls -la ./modflow6/doc/mf6io/ - mv ./modflow6/doc/mf6io/mf6io.pdf mf6io.pdf - ls -la ./ + # modflow6/distribution/build_dist.py expects the examples repo to exist, + # but it's not needed for nightly builds, below can be removed when fixed + mkdir -p modflow6-examples + + # build the dist + python modflow6/distribution/build_dist.py -d -o ${{ matrix.artifact_name }} - - name: Upload a Build Artifact - uses: actions/upload-artifact@v3.1.0 + - name: Zip distribution + if: runner.os != 'Windows' + run: zip -j -r ${{ matrix.artifact_name }}.zip ${{ matrix.artifact_name }} -x '*.DS_Store' + + - name: Zip distribution (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: 7z a -tzip ${{ matrix.artifact_name }}.zip ${{ github.workspace }}\${{ matrix.artifact_name }}\bin\* -xr'!libmf6.lib' + + - name: Upload distribution + uses: actions/upload-artifact@v3 with: - name: nightly - path: | - ./${{ matrix.artifact_name }} + name: ${{ matrix.artifact_name }} + path: ${{ matrix.artifact_name }}.zip - - name: Upload additional Build Artifacts + - name: Upload mf6io docs if: runner.os == 'Linux' uses: actions/upload-artifact@v3.1.0 with: - name: nightly - path: | - ./mf6io.pdf + name: mf6io + path: ${{ matrix.artifact_name }}/doc/mf6io.pdf - # make the release if previous job was successful release: - name: Make a nightly release - needs: build_for_os - runs-on: ubuntu-20.04 + name: Create release + needs: dist + runs-on: ubuntu-22.04 defaults: run: shell: bash - if: github.event_name == 'push' || github.event_name == 'schedule' - steps: + - name: Delete Older Releases uses: dev-drprasad/delete-older-releases@v0.2.0 with: @@ -189,49 +286,50 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Download a Build Artifact + - name: Download artifacts uses: actions/download-artifact@v3.0.0 with: - name: nightly - path: ./nightly/ + path: nightly - name: List files in the artifact directory - run: | - pwd - ls -l ./nightly/ + run: ls -l nightly - - name: Get Current Time + - name: Get time uses: josStorer/get-current-time@v2.0.0 id: current-time with: format: YYYYMMDD - - name: Use current time + - name: Show time env: TIME: "${{ steps.current-time.outputs.time }}" F_TIME: "${{ steps.current-time.outputs.formattedTime }}" run: echo $TIME $F_TIME - - name: Create a Release + - name: Create release uses: ncipollo/release-action@v1.10.0 with: tag: ${{ steps.current-time.outputs.formattedTime }} name: ${{ steps.current-time.outputs.formattedTime }} nightly build - body: "OneAPI version of Intel ifort compiler used to compile executables for all operating systems." + body: "MODFLOW 6 nightly development build, compiled with Intel Fortran." draft: false allowUpdates: true token: ${{ secrets.GITHUB_TOKEN }} - - name: Upload compiled executables to the latest GitHub release + # remove all but zip and pdf files + - name: Prune release assets + run: find nightly -type f ! -name '*.zip' ! -name '*.pdf' -delete + + - name: Upload release assets uses: svenstaro/upload-release-action@2.3.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./nightly/* + file: nightly/** tag: ${{ steps.current-time.outputs.formattedTime }} overwrite: true file_glob: true - - name: Delete Artifact - uses: GeekyEggo/delete-artifact@v1.0.0 - with: - name: nightly + # - name: Delete Artifact + # uses: GeekyEggo/delete-artifact@v1.0.0 + # with: + # name: nightly diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml deleted file mode 100644 index fb1a2f0..0000000 --- a/.github/workflows/nightly-build.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: MODFLOW 6 nightly build - -on: - schedule: - - cron: '0 2 * * *' # run at 2 AM UTC - # - cron: '*/10 * * * *' # run every 10 minutes - # - cron: '20 */1 * * *' # run every hour at 20 minutes past the hour - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build_for_os: - name: compile on linux, macos, and windows - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-20.04 - artifact_name: linux.zip - body_name: bodyFileLinux - - os: macos-latest - artifact_name: mac.zip - body_name: bodyFileMac - - os: windows-latest - artifact_name: win64.zip - body_name: bodyFileWindows - defaults: - run: - shell: bash - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Setup Python - uses: actions/setup-python@v4.0.0 - with: - python-version: 3.9 - - - name: Install Python packages - run: | - pip install -r requirements.txt - pip list - - - name: Install gfortran - uses: modflowpy/install-gfortran-action@v1 - - - name: Checkout modflow6 - uses: actions/checkout@v3 - with: - repository: MODFLOW-USGS/modflow6 - path: modflow6 - ref: develop - - - name: Update flopy classes - working-directory: modflow6/autotest - run: | - python update_flopy.py - - - name: Build and zip applications - working-directory: modflow6/distribution - run: | - python build_nightly.py - - - name: Move the build zip file - run: | - ls -l ./modflow6/distribution/* - mv ./modflow6/distribution/temp_zip/${{ matrix.artifact_name }} ./${{ matrix.artifact_name }} - ls -l ./ \ No newline at end of file diff --git a/.github/workflows/nightly-distribution.yml b/.github/workflows/nightly-distribution.yml index e1818b5..f95f340 100644 --- a/.github/workflows/nightly-distribution.yml +++ b/.github/workflows/nightly-distribution.yml @@ -1,28 +1,16 @@ -# 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: MODFLOW 6 distribution (nightly build with Intel) - on: schedule: - cron: '0 2 * * *' # run at 2 AM UTC - # - cron: '*/10 * * * *' # run every 10 minutes - # - cron: '20 */1 * * *' # run every hour at 20 minutes past the hour push: branches: - master + - ci-diagnose* pull_request: branches: - master - env: FC: ifort - jobs: build_for_os: name: build distribution @@ -30,18 +18,12 @@ jobs: strategy: fail-fast: false matrix: - include: - - os: ubuntu-20.04 - artifact_name: Linux.zip - - os: macos-latest - artifact_name: macOS.zip - - os: windows-latest - artifact_name: Windows.zip + os: [ubuntu-20.04, macos-latest, windows-latest] defaults: run: shell: bash - steps: + - name: Checkout repo uses: actions/checkout@v3 @@ -58,12 +40,6 @@ jobs: - name: Install ifort uses: modflowpy/install-intelfortran-action@v1 - - name: install dos2unix on linux - if: runner.os == 'Linux' - run: | - sudo apt-get install dos2unix - dos2unix --version - - name: Install TeX Live and usgslatex if: runner.os == 'Linux' run: | @@ -89,19 +65,10 @@ jobs: - name: Update flopy classes working-directory: modflow6/autotest - run: | - python update_flopy.py + run: python update_flopy.py - name: Create distribution - if: runner.os != 'Windows' - run: | - python make_distribution.py -mf6p ./modflow6 -mf6ep ./modflow6-examples -dp ./${{ runner.os }} - - - name: Create distribution (Windows) - if: runner.os == 'Windows' - run: | - export PATH="/C/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64":$PATH - python make_distribution.py -mf6p ./modflow6 -mf6ep ./modflow6-examples -dp ./${{ runner.os }} + run: python make_distribution.py -mf6p ./modflow6 -mf6ep ./modflow6-examples -dp ./${{ runner.os }} - name: Create distribution artifact uses: actions/upload-artifact@v3.1.0 diff --git a/README.md b/README.md index 73c9a87..59a0bc9 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,43 @@ -# MODFLOW 6 development version of binary executables +# MODFLOW 6 nightly build +Nightly development build for MODFLOW 6 binaries. + +[![Latest tag](https://img.shields.io/github/tag/MODFLOW-USGS/modflow6-nightly-build.svg)](https://github.com/MODFLOW-USGS/modflow6-nightly-build/tags/latest) [![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 distribution (nightly build with Intel)](https://github.com/MODFLOW-USGS/modflow6-nightly-build/actions/workflows/nightly-distribution.yml/badge.svg)](https://github.com/MODFLOW-USGS/modflow6-nightly-build/actions/workflows/nightly-distribution.yml) -The develop branch of the [MODFLOW 6 repository](https://github.com/MODFLOW-USGS/modflow6) contains bug fixes and new functionality that may be incorporated into the next [approved MODFLOW 6 release](https://www.usgs.gov/software/modflow-6-usgs-modular-hydrologic-model). Each night, at 2 AM UTC, Fortran source code from the development branch is compiled for Windows, MacOS, and Ubuntu 18.04.4 LTS using gfortran. The binary executables released [here](https://github.com/MODFLOW-USGS/modflow6-nightly-build/releases/latest) represent release candidates for the next approved version of MODFLOW 6 but are considered preliminary or provisional. +The develop branch of the [MODFLOW 6 repository](https://github.com/MODFLOW-USGS/modflow6) contains bug fixes and new functionality that may be incorporated into the next [approved MODFLOW 6 release](https://www.usgs.gov/software/modflow-6-usgs-modular-hydrologic-model). Each night, Fortran source code from the development branch is compiled on `windows-2022`, `macos-12`, and `ubuntu-22.04` runner images using Intel Fortran. The binary executables released [here](https://github.com/MODFLOW-USGS/modflow6-nightly-build/releases/latest) are release candidates for the next approved version of MODFLOW 6 but are considered preliminary or provisional. + + + + +- [Distribution contents](#distribution-contents) +- [Reporting issues](#reporting-issues) +- [Disclaimer](#disclaimer) + + + +## Distribution contents -The compiled codes for the latest nightly build are available as operating specific [release assets](https://github.com/MODFLOW-USGS/modflow6-nightly-build/releases/latest) (`win64.zip`, `mac.zip`, and `linux.zip`). Each operating specific release asset includes: +The nightly builds are available as operating-system specific [release assets](https://github.com/MODFLOW-USGS/modflow6-nightly-build/releases/latest) (`win64.zip`, `mac.zip`, and `linux.zip`). The distribution includes: -1. **mf6** (MODFLOW 6) -2. **mf5to6** (the MODFLOW 5 to 6 converter) -3. **zbud6** (the zone budget utility for MODFLOW 6) -4. **libmf6.dll** or **libmf6.so** (a dynamic-linked library or shared object version of MODFLOW 6) +1. **mf6[.exe]**: MODFLOW 6 +2. **mf5to6[.exe]**: the MODFLOW 5 to 6 converter +3. **zbud6[.exe]**: the zone budget utility for MODFLOW 6) +4. **libmf6[.dll/so/dylib]**: a dynamic-linked library or shared object version of MODFLOW 6 +5. **code.json**: a JSON file containing version information and other metadata Each release also includes a copy of the *'MODFLOW 6 – Description of Input and Output'* document (`mf6io.pdf`) for the [latest MODFLOW 6 release candidate](https://github.com/MODFLOW-USGS/modflow6-nightly-build/releases/latest). -Release tags are based on the date (YYYYMMDD) the MODFLOW 6 codes were compiled and the release was made. Previous nightly build releases are retained for 30 days in the event that there are issues with the latest release candidate. +Release tags are based on the date, with format `YYYYMMDD`. Nightly builds are retained for 30 days in the event that there are issues with the latest release candidate. -Nightly Build Issues --------------------- +## Reporting issues Any issues with the nightly build should be posted on the main [MODFLOW 6 GitHub repo](https://github.com/MODFLOW-USGS/modflow6) and flagged with the [nightly build](https://github.com/MODFLOW-USGS/modflow6/labels/nightly%20build) label. -Disclaimer ----------- +## Disclaimer This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not diff --git a/make_distribution.py b/make_distribution.py index d745fd7..14defb1 100644 --- a/make_distribution.py +++ b/make_distribution.py @@ -221,7 +221,7 @@ def set_modflow6_release_info(modflow6_path): releaseCandidate = None developMode = None - cmd = ["python", "make_release.py"] + cmd = ["python", "update_version.py"] if isApproved is not None: cmd.append("--isApproved") if version is not None: diff --git a/requirements.txt b/requirements.txt index 0d304b7..414241a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,13 @@ # PyPI dependencies appdirs +filelock +flaky ipython jupyter jupytext matplotlib meson!=0.63.0 +modflow-devtools ninja numpy pandas