From 782e2a6c75dc54e6bb9f58b360228b31fe8ea58c Mon Sep 17 00:00:00 2001 From: Hofer-Julian Date: Wed, 3 Apr 2024 11:37:52 +0200 Subject: [PATCH] Migrate docs and compilers CI --- .build_rtd_docs/update_doxyfile_version.py | 14 ++++ .../{compilers.yml.disabled => compilers.yml} | 33 +++++----- .../workflows/{docs.yml.disabled => docs.yml} | 65 +++++++------------ DEVELOPER.md | 2 +- distribution/README.md | 4 +- pixi.toml | 2 + 6 files changed, 60 insertions(+), 60 deletions(-) create mode 100644 .build_rtd_docs/update_doxyfile_version.py rename .github/workflows/{compilers.yml.disabled => compilers.yml} (95%) rename .github/workflows/{docs.yml.disabled => docs.yml} (77%) diff --git a/.build_rtd_docs/update_doxyfile_version.py b/.build_rtd_docs/update_doxyfile_version.py new file mode 100644 index 00000000000..8755cc54c9e --- /dev/null +++ b/.build_rtd_docs/update_doxyfile_version.py @@ -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) diff --git a/.github/workflows/compilers.yml.disabled b/.github/workflows/compilers.yml similarity index 95% rename from .github/workflows/compilers.yml.disabled rename to .github/workflows/compilers.yml index 4f91d47df30..bf73aa7d719 100644 --- a/.github/workflows/compilers.yml.disabled +++ b/.github/workflows/compilers.yml @@ -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 @@ -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() @@ -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() @@ -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() @@ -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 \ No newline at end of file + gh pr create -B "${{ github.event.repository.default_branch }}" -H "$head" --title "Update compile/test compatibility tables" --body-file compat.md diff --git a/.github/workflows/docs.yml.disabled b/.github/workflows/docs.yml similarity index 77% rename from .github/workflows/docs.yml.disabled rename to .github/workflows/docs.yml index 37743f39fc4..6864dde44a9 100644 --- a/.github/workflows/docs.yml.disabled +++ b/.github/workflows/docs.yml @@ -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: | @@ -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 @@ -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 @@ -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 @@ -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: @@ -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 diff --git a/DEVELOPER.md b/DEVELOPER.md index d25473d1373..aa6d58a453e 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -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. diff --git a/distribution/README.md b/distribution/README.md index 66d74f805fb..7bafeb8d437 100644 --- a/distribution/README.md +++ b/distribution/README.md @@ -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 @@ -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 \ No newline at end of file +- `version`: the version number of the release diff --git a/pixi.toml b/pixi.toml index b8508cf59dd..088354977f7 100644 --- a/pixi.toml +++ b/pixi.toml @@ -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"