Separate environments for each talktorial #1414
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: | |
push: | |
branches: | |
- "master" | |
pull_request: | |
branches: | |
- "master" | |
- "dev" | |
schedule: | |
# every two weeks on Monday at 3 am | |
- cron: "0 3/336 * * 1" | |
jobs: | |
test: | |
name: Pytest | |
runs-on: ${{ matrix.cfg.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
directory: | |
- T002_compound_adme | |
#- T003_compound_unwanted_structures | |
cfg: | |
- os: ubuntu-latest | |
#- os: macos-latest | |
#- os: windows-latest | |
env: | |
PYVER: ${{ matrix.cfg.python-version }} | |
PACKAGE: teachopencadd | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
use-mamba: true | |
auto-activate-base: true | |
- name: Cache Conda packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.conda/pkgs | |
key: ${{ runner.os }}-conda-${{ hashFiles('**/environment.yml') }} | |
restore-keys: | | |
${{ runner.os }}-conda- | |
- name: Install package | |
shell: bash -l {0} | |
run: | | |
ls | |
pwd | |
ls teachopencadd | |
ls teachopencadd/talktorials | |
- name: Install Conda environment | |
run: | | |
echo `pwd` | |
mamba env create -f environment.yml -n ${{ matrix.directory }} | |
working-directory: teachopencadd/talktorials/${{ matrix.directory }} | |
- name: Activate Conda environment | |
run: conda activate ${{ matrix.directory }} | |
- name: Install pytest | |
run: mamba install pytest -c conda-forge -y | |
- name: Run tests | |
shell: bash -l {0} | |
run: | | |
PYTEST_ARGS="--nbval-lax --current-env --dist loadscope" | |
pytest $PYTEST_ARGS teachopencadd/talktorials/ $IGNORE | |
working-directory: teachopencadd/talktorials/${{ matrix.directory }} | |
format: | |
name: Black | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
- name: Install format dependencies | |
run: python -m pip install black-nb shyaml | |
- name: Run black-nb | |
run: | | |
black-nb -l 99 --check teachopencadd/talktorials/T*/talktorial.ipynb | |
readmes: | |
name: READMEs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
- name: Install nbformat | |
run: python -m pip install nbformat shyaml | |
- name: Check READMEs are up-to-date | |
run: | | |
for path in teachopencadd/talktorials/T*/talktorial.ipynb; do | |
python devtools/regenerate_readmes.py --output README.md $path | |
done | |
# If the script above introduced changes (it shouldn't!), git diff will have output and an error code | |
git diff --exit-code |