CI #486
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: CI | |
on: | |
# GitHub has started calling new repo's first branch "main" https://github.com/github/renaming | |
# Existing codes likely still have "master" as the primary branch | |
# Both are tracked here to keep legacy and new codes working | |
push: | |
branches: | |
- "master" | |
- "main" | |
pull_request: | |
branches: | |
- "master" | |
- "main" | |
schedule: | |
# Nightly tests run on master by default: | |
# Scheduled workflows run on the latest commit on the default or base branch. | |
# (from https://help.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) | |
- cron: "0 3 10 * *" | |
jobs: | |
test: | |
name: Test on ${{ matrix.cfg.os }}, Python ${{ matrix.cfg.python-version }} | |
runs-on: ${{ matrix.cfg.os }} | |
strategy: | |
matrix: | |
cfg: | |
- os: ubuntu-latest | |
python-version: "3.12" | |
- os: macos-latest | |
python-version: "3.12" | |
- os: windows-latest | |
python-version: "3.12" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Additional info about the build | |
shell: bash | |
run: | | |
uname -a | |
df -h | |
ulimit -a | |
# More info on options: https://github.com/marketplace/actions/provision-with-micromamba | |
- uses: mamba-org/provision-with-micromamba@main | |
with: | |
environment-file: devtools/conda-envs/test_env.yaml | |
environment-name: test | |
channels: conda-forge,defaults | |
extra-specs: | | |
python=${{ matrix.python-version }} | |
- name: Install package | |
shell: bash -l {0} | |
run: | | |
python -m pip install . --no-deps | |
micromamba list | |
- name: Run tests | |
shell: bash -l {0} | |
run: | | |
pytest -v --cov=dynophores --cov-report=xml --color=yes dynophores/tests/ | |
- name: Run docs notebooks tests | |
shell: bash -l {0} | |
run: | | |
PYTEST_ARGS="--nbval-lax --current-env --nbval-cell-timeout=900" | |
pytest $PYTEST_ARGS docs/tutorials/*.ipynb -vvv | |
pytest $PYTEST_ARGS dynophores/notebooks/*.ipynb -vvv | |
- name: CodeCov | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
name: codecov-${{ matrix.os }}-py${{ matrix.python-version }} | |
lint-format: | |
name: Lint/format test on ${{ matrix.os }}, Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.12] | |
steps: | |
- uses: actions/checkout@v3 | |
# More info on options: https://github.com/marketplace/actions/provision-with-micromamba | |
- uses: mamba-org/provision-with-micromamba@main | |
with: | |
environment-file: devtools/conda-envs/test_env.yaml | |
environment-name: test | |
channels: conda-forge,defaults | |
extra-specs: | | |
python=${{ matrix.python-version }} | |
- name: Install linter and formatter | |
shell: bash -l {0} | |
run: | | |
python -m pip install shyaml flake8 black black-nb flake8-nb | |
- name: Run black check | |
shell: bash -l {0} | |
run: | | |
black --check -l 99 dynophores | |
- name: Run flake8 | |
shell: bash -l {0} | |
run: | | |
flake8 --config setup.cfg dynophores | |
docs: | |
name: Docs test on ${{ matrix.os }}, Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.12] | |
steps: | |
- uses: actions/checkout@v3 | |
# More info on options: https://github.com/marketplace/actions/provision-with-micromamba | |
- uses: mamba-org/provision-with-micromamba@main | |
with: | |
environment-file: devtools/conda-envs/test_env.yaml | |
environment-name: test | |
channels: conda-forge,defaults | |
extra-specs: | | |
python=${{ matrix.python-version }} | |
- name: Install package | |
shell: bash -l {0} | |
run: | | |
python -m pip install . --no-deps | |
micromamba list | |
- name: Run sphinx | |
shell: bash -l {0} | |
run: | | |
cd docs | |
make clean | |
SPHINXOPTS="-W -T --keep-going" make html |