Skip to content

rtd

rtd #2957

Workflow file for this run

name: rtd
on:
schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
push:
paths-ignore:
- 'README.md'
- 'DEVELOPER.md'
pull_request:
branches:
- master
- develop
paths-ignore:
- 'README.md'
- 'DEVELOPER.md'
workflow_dispatch:
inputs:
ref:
description: 'The tag, branch or commit hash to trigger an RTD build for. Branches and tags must be fully formed, e.g. refs/heads/<branch> or refs/tags/<tag> respectively.'
required: false
type: string
default: 'refs/heads/develop'
mf6_ref:
description: 'The tag, branch or commit hash to build MF6 from. Branches and tags must be fully formed, e.g. refs/heads/<branch> or refs/tags/<tag> respectively.'
required: false
type: string
default: 'refs/heads/develop'
jobs:
set_options:
name: Set release options
if: github.ref_name != 'master'
runs-on: ubuntu-22.04
outputs:
ref: ${{ steps.set_ref.outputs.ref }}
sha: ${{ steps.set_sha.outputs.sha }}
mf6_ref: ${{ steps.set_mf6_ref.outputs.ref }}
steps:
- name: Set ref
id: set_ref
run: |
# if ref was provided explicitly via workflow_dispatch, use it
if [[ ("${{ github.event_name }}" == "workflow_dispatch") && (-n "${{ inputs.ref }}") ]]; then
ref="${{ inputs.ref }}"
echo "using ref $ref from workflow_dispatch"
else
# otherwise use the current branch
ref="${{ github.ref }}"
echo "using current ref $ref"
fi
echo "ref=$ref" >> $GITHUB_OUTPUT
- name: Checkout repo
uses: actions/checkout@v6
with:
ref: ${{ steps.set_ref.outputs.ref }}
- name: Set sha
id: set_sha
run: |
if [[ ("${{ github.event_name }}" == "workflow_dispatch") && (-n "${{ inputs.ref }}") ]]; then
sha=$(git rev-parse ${{ steps.set_ref.outputs.ref }})
else
sha="${{ github.sha }}"
fi
echo "sha=$sha" >> $GITHUB_OUTPUT
- name: Set MF6 ref
id: set_mf6_ref
run: |
# if ref was provided explicitly via workflow_dispatch, use it
if [[ ("${{ github.event_name }}" == "workflow_dispatch") && (-n "${{ inputs.mf6_ref }}") ]]; then
ref="${{ inputs.mf6_ref }}"
else
# otherwise use the develop branch
ref="refs/heads/develop"
fi
echo "using mf6 ref $ref"
echo "ref=$ref" >> $GITHUB_OUTPUT
build:
name: Build artifacts for RTD
needs: set_options
runs-on: ubuntu-latest
strategy:
fail-fast: false
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout MODFLOW6 examples
uses: actions/checkout@v6
with:
path: modflow6-examples
ref: ${{ needs.set_options.outputs.ref }}
- name: Checkout MODFLOW 6
uses: actions/checkout@v6
with:
repository: MODFLOW-ORG/modflow6
path: modflow6
ref: ${{ needs.set_options.outputs.mf6_ref }}
- name: Install LaTeX and extra fonts
run: |
sudo apt-get update
sudo apt install texlive-latex-extra texlive-science fonts-liberation
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections
sudo apt-get install ttf-mscorefonts-installer
sudo rm -rf ~/.cache/matplotlib
- name: Install pandoc
run: |
wget https://github.com/jgm/pandoc/releases/download/2.11.2/pandoc-2.11.2-linux-amd64.tar.gz
sudo tar xvzf pandoc-2.11.2-linux-amd64.tar.gz --strip-components=1 -C /usr/local
pandoc --version
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.41.4
manifest-path: modflow6-examples/pixi.toml
- name: Set up headless display
uses: pyvista/setup-headless-display-action@v4
- name: Create Jupyter kernel
working-directory: modflow6-examples
run: pixi run python -m ipykernel install --name python_kernel --user
- name: Update FloPy classes
working-directory: modflow6-examples
run: |
cmd="pixi run python -m flopy.mf6.utils.generate_classes --ref ${{ needs.set_options.outputs.mf6_ref }}"
if [[ "${{ needs.set_options.outputs.mf6_ref }}" == "refs/heads/master" ]]; then
cmd="$cmd --releasemode"
fi
eval "$cmd"
- name: Install MODFLOW executables
uses: modflowpy/install-modflow-action@v1
- name: Build MODFLOW 6
working-directory: modflow6
run: |
pixi run --manifest-path ../modflow6-examples/pixi.toml meson setup builddir -Ddebug=false --prefix=$(pwd) --libdir=bin
pixi run --manifest-path ../modflow6-examples/pixi.toml meson install -C builddir
pixi run --manifest-path ../modflow6-examples/pixi.toml meson test --verbose --no-rebuild -C builddir
cp bin/* ~/.local/bin/modflow/
- name: Run notebooks, make plots
working-directory: modflow6-examples/autotest
run: pixi run pytest -v -n=auto --durations=0 test_notebooks.py --plot
- name: Run postprocessing
working-directory: modflow6-examples/scripts
run: pixi run python create-doc-tables.py
- name: Create Markdown tables
working-directory: modflow6-examples/etc
run: pixi run python ci_create_examples_rst.py
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: rtd-files-for-${{ needs.set_options.outputs.sha }}
path: |
modflow6-examples/.doc/introduction.md
modflow6-examples/.doc/examples.rst
modflow6-examples/.doc/_examples
modflow6-examples/.doc/_images
modflow6-examples/.doc/_notebooks
trigger:
name: Trigger RTD build
needs:
- set_options
- build
runs-on: ubuntu-latest
if: |
github.repository_owner == 'MODFLOW-ORG' &&
(
github.ref_name == 'master' ||
github.ref_name == 'develop'
) && (
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch'
)
steps:
- name: Checkout MODFLOW6 examples repo
uses: actions/checkout@v6
- name: Trigger RTD build
uses: dfm/rtds-action@v1
with:
webhook_url: ${{ secrets.RTDS_WEBHOOK_URL }}
webhook_token: ${{ secrets.RTDS_WEBHOOK_TOKEN }}
commit_ref: ${{ needs.set_options.outputs.ref }}