Skip to content

Commit

Permalink
Pixi follow up
Browse files Browse the repository at this point in the history
  • Loading branch information
Hofer-Julian committed Apr 3, 2024
1 parent f55a31d commit b585e75
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 91 deletions.
109 changes: 66 additions & 43 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,14 @@ jobs:
path: modflow6
ref: ${{ inputs.branch }}

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

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

- name: Setup ${{ matrix.compiler }} ${{ matrix.version }}
if: (!(runner.os == 'Windows' && matrix.parallel))
Expand All @@ -129,6 +128,7 @@ jobs:
- name: Update version
id: update_version
working-directory: modflow6/distribution
shell: pixi run bash -e {0}
run: |
ver="${{ steps.set_version.outputs.version }}"
cmd="python update_version.py -v $ver"
Expand All @@ -142,6 +142,7 @@ jobs:
- name: Get OS tag
id: ostag
shell: pixi run bash -e {0}
run: |
ostag=$(python -c "from modflow_devtools.ostags import get_ostag; print(get_ostag())")
if [[ "${{ matrix.parallel }}" == "true" ]]; then
Expand Down Expand Up @@ -169,9 +170,9 @@ jobs:
if: (!(runner.os == 'Windows' && matrix.parallel))
working-directory: modflow6
run: |
meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin
meson install -C builddir
meson test --verbose --no-rebuild -C builddir
pixi run setup-release builddir
pixi run install-build builddir
pixi run test-build builddir
- name: Check architecture (macOS)
working-directory: modflow6/bin
Expand Down Expand Up @@ -242,27 +243,27 @@ jobs:

- name: Update flopy
if: inputs.run_tests == true && runner.os != 'Windows'
working-directory: modflow6/autotest
run: python update_flopy.py
working-directory: modflow6
run: pixi run update-flopy

- name: Get executables
if: inputs.run_tests == true && runner.os != 'Windows'
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: inputs.run_tests == true && runner.os != 'Windows'
working-directory: modflow6/autotest
working-directory: modflow6
env:
REPOS_PATH: ${{ github.workspace }}
run: |
markers="not large"
if [[ "${{ inputs.developmode }}" == "false" ]]; then
markers="$markers and not developmode"
fi
pytest -v -n auto --durations 0 -m "$markers"
pixi run autotest-markers "$markers"
- name: Upload failed test output
if: failure()
Expand Down Expand Up @@ -300,7 +301,7 @@ jobs:
working-directory: modflow6/distribution
env:
GITHUB_TOKEN: ${{ github.token }}
run: pytest -v --durations 0
run: pixi run test-distribution

docs:
name: Build docs
Expand Down Expand Up @@ -343,12 +344,14 @@ jobs:
working-directory: usgslatex/usgsLaTeX
run: sudo ./install.sh --all-users

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

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

- name: Setup ${{ inputs.compiler_toolchain }} ${{ inputs.compiler_version }}
uses: fortran-lang/setup-fortran@v1
Expand All @@ -359,6 +362,7 @@ jobs:
- name: Update version
id: update_version
working-directory: modflow6/distribution
shell: pixi run bash -e {0}
run: |
ver="${{ needs.build.outputs.version }}"
cmd="python update_version.py -v $ver"
Expand All @@ -371,8 +375,8 @@ jobs:
eval "$cmd"
- name: Update FloPy classes
working-directory: modflow6/autotest
run: python update_flopy.py
working-directory: modflow6
run: pixi run update-flopy

- name: Get OS tag
id: ostag
Expand All @@ -396,18 +400,23 @@ jobs:
- name: Install dependencies for building models
if: inputs.full == true
working-directory: modflow6-examples/etc
shell: pixi run bash -e {0}
working-directory: modflow6
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
cd ../modflow6-examples/etc
pip install -r requirements.pip.txt
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
get-modflow "${{ github.workspace }}/bin" --subset mf2005,triangle,gridgen
- name: Build example models
if: inputs.full == true
working-directory: modflow6-examples/autotest
run: pytest -v -n auto test_scripts.py --init
working-directory: modflow6
shell: pixi run bash -e {0}
run: |
cd ../modflow6-examples/autotest
pytest -v -n auto test_scripts.py --init
- name: Create folder structure
if: inputs.full == true
Expand All @@ -426,13 +435,12 @@ jobs:
cp -r modflow6/utils/zonebudget "$distname/utils/zonebudget"
# create LaTeX file describing the folder structure
cd modflow6/doc/ReleaseNotes
python mk_folder_struct.py -dp "${{ github.workspace }}/$distname"
pixi run mk-folder-struct -dp "${{ github.workspace }}/$distname"
- name: Collect deprecations
working-directory: modflow6/doc/mf6io/mf6ivar
run: |
python deprecations.py
pixi run deprecations
cat md/deprecations.md
- name: Upload deprecations
Expand All @@ -442,12 +450,15 @@ jobs:
path: modflow6/doc/mf6io/mf6ivar/md/deprecations.md

- name: Build documentation
working-directory: modflow6
shell: pixi run bash -e {0}
env:
# this step is lazy about building the mf6 examples PDF document, first
# trying to download a prebuilt PDF from MODFLOW-USGS/modflow6-examples,
# so it needs a GITHUB_TOKEN.
GITHUB_TOKEN: ${{ github.token }}
run: |
cd ..
mkdir -p "${{ needs.build.outputs.distname }}/doc"
cmd="python modflow6/distribution/build_docs.py -b bin -o doc"
if [[ "${{ inputs.full }}" == "true" ]]; then
Expand Down Expand Up @@ -496,15 +507,14 @@ jobs:
repository: MODFLOW-USGS/modflow6-examples
path: modflow6-examples

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

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

- name: Setup ${{ inputs.compiler_toolchain }} ${{ inputs.compiler_version }}
uses: fortran-lang/setup-fortran@v1
Expand All @@ -514,8 +524,10 @@ jobs:

- name: Update version
id: update_version
working-directory: modflow6/distribution
working-directory: modflow6
shell: pixi run bash -e {0}
run: |
cd distribution
ver="${{ needs.build.outputs.version }}"
cmd="python update_version.py -v $ver"
if [[ "${{ inputs.approve }}" == "true" ]]; then
Expand All @@ -528,7 +540,10 @@ jobs:
- name: Get OS tag
id: ostag
working-directory: modflow6
shell: pixi run bash -e {0}
run: |
cd ..
ostag=$(python -c "from modflow_devtools.ostags import get_ostag; print(get_ostag())")
if [[ "${{ matrix.parallel }}" == "true" ]]; then
ostag="${ostag}par"
Expand Down Expand Up @@ -559,7 +574,10 @@ jobs:
- name: Install dependencies for example models
env:
GITHUB_TOKEN: ${{ github.token }}
working-directory: modflow6
shell: pixi run bash -e {0}
run: |
cd ..
pip install -r modflow6-examples/etc/requirements.pip.txt
distname="${{ needs.build.outputs.distname }}_${{ steps.ostag.outputs.ostag }}"
echo "$distname/bin" >> $GITHUB_PATH
Expand All @@ -576,14 +594,19 @@ jobs:

- name: Update Flopy
working-directory: modflow6/autotest
run: python update_flopy.py
run: pixi run update-flopy

- name: Build example models
if: inputs.full == true
working-directory: modflow6-examples/autotest
run: pytest -v -n auto test_scripts.py --init
working-directory: modflow6
shell: pixi run bash -e {0}
run: |
cd ../modflow6-examples/autotest
pytest -v -n auto test_scripts.py --init
- name: Build distribution
working-directory: modflow6
shell: pixi run bash -e {0}
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
Expand Down Expand Up @@ -704,4 +727,4 @@ jobs:
if [[ "${{ inputs.full }}" == "true" ]]; then
cmd="$cmd --full"
fi
eval "$cmd"
eval "$cmd"
35 changes: 20 additions & 15 deletions .github/workflows/release_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,22 @@ jobs:
pull-requests: write
defaults:
run:
shell: bash -l {0}
shell: bash
steps:
- name: Checkout modflow6
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/modflow6
ref: ${{ github.ref }}

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

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

- name: Update version
working-directory: distribution
Expand All @@ -172,13 +174,13 @@ jobs:
# approve will be empty if workflow was triggered by pushing a release branch
# todo: pull approve into set_options job/output?
if [[ ("${{ inputs.approve }}" == "true") || ("${{ inputs.approve }}" == "") ]]; then
python update_version.py -v "$ver" --approve
pixi run update-version -v "$ver" --approve
else
python update_version.py -v "$ver"
pixi run update-version -v "$ver"
fi
# lint version.f90
fprettify -c ../.fprettify.yaml ../src/Utilities/version.f90
pixi run fprettify -c ../.fprettify.yaml ../src/Utilities/version.f90
# commit and push
git config core.sharedRepository true
Expand Down Expand Up @@ -209,20 +211,22 @@ jobs:
runs-on: ubuntu-22.04
defaults:
run:
shell: bash -l {0}
shell: bash
steps:
- name: Checkout modflow6
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/modflow6
path: modflow6

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

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

- name: Download artifacts
uses: dawidd6/action-download-artifact@v3
Expand All @@ -231,6 +235,7 @@ jobs:
working-directory: modflow6
env:
GITHUB_TOKEN: ${{ github.token }}
shell: pixi run bash -e {0}
run: |
# create draft release
version=$(python distribution/update_version.py -g)
Expand Down
33 changes: 0 additions & 33 deletions environment.yml

This file was deleted.

0 comments on commit b585e75

Please sign in to comment.