Skip to content

Commit

Permalink
Migrate docs and compilers CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian committed Apr 3, 2024
1 parent a12d404 commit 782e2a6
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 60 deletions.
14 changes: 14 additions & 0 deletions .build_rtd_docs/update_doxyfile_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join("..", "doc")))
from version import __version__
print("Update the Doxyfile with the latest version number")
with open("Doxyfile", "r") as fp:
lines = fp.readlines()

tag = "PROJECT_NUMBER"
with open("Doxyfile", "w") as fp:
for line in lines:
if tag in line:
line = '{} = "version {}"\n'.format(tag, __version__)
fp.write(line)
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
- {os: windows-2022, compiler: intel-classic, version: 2021.6}
defaults:
run:
shell: bash -l {0}
shell: bash
steps:
- name: Checkout modflow6
uses: actions/checkout@v4
Expand All @@ -157,21 +157,20 @@ jobs:
compiler: ${{ matrix.compiler}}
version: ${{ matrix.version }}

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@v1
- uses: prefix-dev/setup-pixi@v0.5.1
with:
environment-file: modflow6/environment.yml
init-shell: >-
bash
powershell
cache-environment: true
cache-downloads: true
pixi-version: "latest"
manifest-path: "modflow6/pixi.toml"

- name: Setup pixi
working-directory: modflow6
run: pixi run install

- name: Build modflow6
working-directory: modflow6
run: |
meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin
meson install -C builddir
pixi run setup-release builddir
pixi run install-build builddir
- name: Show build log
if: failure()
Expand All @@ -188,7 +187,7 @@ jobs:
- name: Unit test programs
if: success()
working-directory: modflow6
run: meson test --verbose --no-rebuild -C builddir
run: pixi run test-build builddir

- name: Create compile report
if: success() || failure()
Expand All @@ -207,21 +206,21 @@ jobs:
- name: Update flopy
if: success()
working-directory: modflow6/autotest
run: python update_flopy.py
run: pixi run update-flopy

- name: Get executables
if: success()
working-directory: modflow6/autotest
env:
GITHUB_TOKEN: ${{ github.token }}
run: pytest -v --durations 0 get_exes.py
run: pixi run get-exes

- name: Test modflow6
if: success()
working-directory: modflow6/autotest
working-directory: modflow6
env:
REPOS_PATH: ${{ github.workspace }}
run: pytest -v -n auto --durations 0
run: pixi run autotest

- name: Create test report
if: success() || failure()
Expand Down Expand Up @@ -354,4 +353,4 @@ jobs:
# 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
gh pr create -B "${{ github.event.repository.default_branch }}" -H "$head" --title "Update compile/test compatibility tables" --body-file compat.md
65 changes: 25 additions & 40 deletions .github/workflows/docs.yml.disabled → .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,20 @@ jobs:
repository: MODFLOW-USGS/usgslatex
path: usgslatex

- name: Install Conda environment from environment.yml
uses: mamba-org/setup-micromamba@v1
- uses: prefix-dev/setup-pixi@v0.5.1
with:
environment-file: modflow6/environment.yml
cache-environment: true
cache-downloads: true

pixi-version: "latest"
manifest-path: "modflow6/pixi.toml"

- name: Setup pixi
working-directory: modflow6
run: pixi run install
- name: Install additional packages for Sphinx using pip
working-directory: modflow6/.build_rtd_docs
run: pip install -r requirements.rtd.txt
run: pixi run pip install -r requirements.rtd.txt

- name: Print python package versions
run: pip list
run: pixi run pip list

- name: Install TeX Live
run: |
Expand All @@ -65,7 +66,7 @@ jobs:

- name: Test building files from dfn's for LaTeX
working-directory: modflow6/autotest
run: pytest -v build_mfio_tex.py
run: pixi run pytest -v build_mfio_tex.py

- name: Setup ${{ env.FC }} ${{ env.FC_V }}
uses: fortran-lang/setup-fortran@v1
Expand All @@ -84,19 +85,19 @@ jobs:
if: steps.cache-examples.outputs.cache-hit != 'true'
working-directory: modflow6-examples/etc
run: |
pip install -r requirements.pip.txt
pip install -r requirements.usgs.txt
pixi run pip install -r requirements.pip.txt
pixi run pip install -r requirements.usgs.txt
- name: Update FloPy
if: steps.cache-examples.outputs.cache-hit != 'true'
working-directory: modflow6/autotest
run: python update_flopy.py
run: pixi run update-flopy

- name: Build example models
if: steps.cache-examples.outputs.cache-hit != 'true'
working-directory: modflow6-examples/autotest
run: |
pytest -v -n auto test_scripts.py --init
pixi run pytest -v -n auto test_scripts.py --init
ls -lh ../examples/
- name: Run benchmarks
Expand All @@ -117,7 +118,7 @@ jobs:

- name: Collect deprecations
working-directory: modflow6/doc/mf6io/mf6ivar
run: python deprecations.py
run: pixi run deprecations

- name: Show deprecations
working-directory: modflow6/doc/mf6io/mf6ivar/md
Expand Down Expand Up @@ -165,7 +166,6 @@ jobs:
runs-on: ubuntu-22.04
env:
working-directory: .build_rtd_docs
distribution-directory: distribution
common-directory: .github/common
branch-name: ${GITHUB_REF##*/}
defaults:
Expand All @@ -183,38 +183,23 @@ jobs:
sudo apt-get update
sudo apt-get install doxygen graphviz
- name: Install Conda environment from environment.yml
uses: mamba-org/setup-micromamba@v1
- uses: prefix-dev/setup-pixi@v0.5.1
with:
environment-file: environment.yml
cache-environment: true
cache-downloads: true
pixi-version: "latest"
manifest-path: "modflow6/pixi.toml"

- name: Setup pixi
working-directory: modflow6
run: pixi run install

- name: Print python package versions
run: pip list
run: pixi run pip list

- name: update MODFLOW 6 version
run: python update_version.py
working-directory: ${{env.distribution-directory}}
run: pixi run update-version

- name: update MODFLOW 6 version in Doxyfile
run: |
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join("..", "doc")))
from version import __version__
print("Update the Doxyfile with the latest version number")
with open("Doxyfile", "r") as fp:
lines = fp.readlines()

tag = "PROJECT_NUMBER"
with open("Doxyfile", "w") as fp:
for line in lines:
if tag in line:
line = '{} = "version {}"\n'.format(tag, __version__)
fp.write(line)
shell: python
working-directory: ${{env.working-directory}}
run: pixi run update-doxyfile-version

- name: run doxygen
run: doxygen
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ The binaries can then be found in the `bin` folder. `meson install` also trigger

MODFLOW 6 unit tests are written in Fortran with [`test-drive`](https://github.com/fortran-lang/test-drive).

MODFLOW 6 integration tests are written in Python with [`pytest`](https://docs.pytest.org/en/7.1.x/). Integration testing dependencies are included in the Conda environment `environment.yml`.
MODFLOW 6 integration tests are written in Python with [`pytest`](https://docs.pytest.org/en/7.1.x/). Integration testing dependencies are included in the Pixi environment `pixi.toml`.

**Note:** the entire test suite should pass before a pull request is submitted. Tests run in GitHub Actions CI and a PR can only be merged with passing tests. See [`CONTRIBUTING.md`](CONTRIBUTING.md) for more information.

Expand Down
4 changes: 2 additions & 2 deletions distribution/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Both nightly builds and official distributions are created automatically with Gi

## Requirements

This document assumes a MODFLOW 6 development environment has been configured as per the [developer documentation](../DEVELOPER.md), including a Fortran compiler (either `ifort` or `gfortran`) as well as a Conda environment as specified in `environment.yml`. Official distributions are currently prepared with Intel Fortran (`ifort`).
This document assumes a MODFLOW 6 development environment has been configured as per the [developer documentation](../DEVELOPER.md), including a Fortran compiler (either `ifort` or `gfortran`) as well as a Pixi environment as specified in `pixi.toml`. Official distributions are currently prepared with Intel Fortran (`ifort`).

## Steps

Expand Down Expand Up @@ -242,4 +242,4 @@ To dispatch the release workflow, navigate to the Actions tab of this repository
- `branch`: the branch to release from
- `development`: whether to build a minimal development distribution or a full distribution
- `run_tests`: whether to run autotests after building binaries
- `version`: the version number of the release
- `version`: the version number of the release
2 changes: 2 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ fortran-format-check = "python .github/common/fortran_format_check.py"
msvs-vfproj-check = "python .github/common/msvs_vfproj_check.py"
update-flopy = { cmd = "python update_flopy.py", cwd = "autotest" }
update-version = { cmd = "python update_version.py", cwd = "distribution" }
update-doxyfile-version = { cmd = "python update_doxyfile_version", cwd = ".build_rtd_docs"}
get-exes = { cmd = "pytest -v --durations 0 get_exes.py", cwd = "autotest" }
build-makefiles = "python build_makefiles.py"
deprecations = "python deprecations.py"

# CI
setup-strict = "meson setup -Ddebug=false -Dwerror=true"
Expand Down

0 comments on commit 782e2a6

Please sign in to comment.