Tests #230
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on github template: https://github.com/actions/starter-workflows/blob/main/ci/python-package.yml | |
name: Tests | |
on: | |
schedule: | |
- cron: '0 9 * * 1' # run every Monday at 9 AM UTC (3 am PST) | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: ${{ matrix.python-version }}, ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python-version: ['3.11'] | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Fetch all Git tags | |
run: git fetch --prune --unshallow --tags | |
- name: Setup Micromamba | |
uses: mamba-org/setup-micromamba@main | |
with: | |
environment-file: installation/environment.yml | |
cache-environment: false | |
cache-downloads: false | |
# persist on the same day. | |
# cache-environment-key: environment-${{ steps.date.outputs.date }} | |
# cache-downloads-key: downloads-${{ steps.date.outputs.date }} | |
create-args: >- | |
python=${{ matrix.python-version }} | |
init-shell: >- | |
bash | |
powershell | |
- name: Conda info | |
shell: bash -l {0} | |
run: micromamba info | |
- name: Install Modflow executables | |
uses: modflowpy/install-modflow-action@v1 | |
with: | |
path: ~/.local/bin | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Modflow version | |
shell: bash -l {0} | |
run: mf6 --version | |
- name: Install ipykernel | |
shell: bash -l {0} | |
run: | | |
python -m ipykernel install --user --name pyclass --display-name "pyclass" | |
- name: Conda list | |
shell: bash -l {0} | |
run: micromamba list | |
- name: Workaround OpenGL issue on Linux | |
if: runner.os == 'Linux' | |
shell: bash -l {0} | |
run: | | |
# referenced from https://github.com/pyvista/pyvista/blob/main/.github/workflows/vtk-pre-test.yml#L53 | |
micromamba remove -y --force vtk | |
pip install --extra-index-url https://wheels.vtk.org trame vtk-osmesa | |
- name: Install fonts on Linux | |
if: runner.os == 'Linux' | |
run: | | |
echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections | |
sudo apt-get install ttf-mscorefonts-installer fonts-liberation | |
sudo rm -rf ~/.cache/matplotlib | |
- name: Install OpenGL on Windows | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
Set-StrictMode -Version Latest | |
$ErrorActionPreference = "Stop" | |
$PSDefaultParameterValues['*:ErrorAction']='Stop' | |
powershell .github/install_opengl.ps1 | |
- name: Run tests | |
shell: bash -l {0} | |
run: | | |
pytest tests/test_notebooks.py -v |