[pre-commit.ci] pre-commit autoupdate #984
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
name: Pytest | |
on: | |
workflow_dispatch: | |
release: | |
types: [created] | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
test: | |
name: '${{ matrix.test }} on ${{ matrix.os }}, py${{ matrix.python-version }}' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: False | |
matrix: | |
test: [full, partial, minimal] | |
python-version: ['3.8', '3.9', '3.10'] | |
os: [ubuntu-latest, ubuntu-20.04] | |
exclude: | |
- test: full | |
python-version: '3.9' | |
- test: full | |
python-version: '3.10' | |
# Disabled in #183, as there is some recurring synda - issue | |
- test: full | |
python-version: '3.8' | |
- test: full | |
os: ubuntu-20.04 | |
- test: minimal | |
os: ubuntu-latest | |
defaults: | |
run: | |
# This is needed otherwise we can't activate the conda installation | |
shell: bash -l {0} | |
steps: | |
- name: Setup python | |
if: matrix.test == 'minimal' | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: minimal install | |
if: matrix.test == 'minimal' | |
run: | |
| | |
pip install -r requirements.txt | |
pip install ../optim_esm_tools | |
python -c "import optim_esm_tools; optim_esm_tools.utils.print_versions()" | |
- uses: conda-incubator/setup-miniconda@v2 | |
if: matrix.test != 'minimal' | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
use-mamba: true | |
auto-update-conda: true | |
python-version: ${{ matrix.python-version }} | |
activate-environment: 'synda' | |
mamba-version: '*' | |
# PARTIAL (speed up testing) | |
- name: run partial install | |
if: matrix.test == 'partial' | |
run: | | |
conda activate synda | |
bash .github/scripts/install_env.sh "--no_synda" | |
# ALL | |
- name: run full install | |
if: matrix.test == 'full' | |
run: | | |
conda activate synda | |
bash .github/scripts/install_env.sh | |
bash .github/scripts/install_tex.sh | |
- name: set Synda config | |
if: matrix.test == 'full' | |
env: | |
OPEN_ID: ${{ secrets.OPEN_ID }} | |
OPEN_ID_KEY: ${{ secrets.OPEN_ID_KEY }} | |
run: bash .github/scripts/write_synda_cridentials.sh | |
- name: Download data with Synda | |
if: matrix.test == 'full' | |
run: bash .github/scripts/download_example_data.sh | |
- name: Run the tests | |
if: matrix.test != 'minimal' | |
env: | |
NUMBA_DISABLE_JIT: 1 | |
_CACHE_TRUE: 1 | |
run: | |
| | |
coverage run --source=optim_esm_tools -m pytest -v --durations 0 | |
# coverage run --append --source=optim_esm_tools -m pytest --nbmake -n=auto ./notebooks | |
coverage report | |
- name: Upload coverage | |
if: matrix.test != 'minimal' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: coveralls --service=github | |
- name: goodbye | |
run: echo goodbye |