|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +env: |
| 12 | + ENV_NAME: aenet-torch |
| 13 | + PYTHON_VERSION: "3.11" |
| 14 | + |
| 15 | +jobs: |
| 16 | + unit-tests: |
| 17 | + name: Unit Tests |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Check out repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up micromamba environment |
| 25 | + uses: mamba-org/setup-micromamba@v2 |
| 26 | + with: |
| 27 | + environment-name: ${{ env.ENV_NAME }} |
| 28 | + create-args: >- |
| 29 | + python=${{ env.PYTHON_VERSION }} |
| 30 | + pip |
| 31 | + cache-environment: true |
| 32 | + cache-downloads: true |
| 33 | + init-shell: bash |
| 34 | + |
| 35 | + - name: Install project and dependencies |
| 36 | + run: | |
| 37 | + micromamba run -n "${ENV_NAME}" python -m pip install --upgrade pip |
| 38 | + micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev,torch]" |
| 39 | +
|
| 40 | + - name: Run general pytest suite |
| 41 | + run: | |
| 42 | + micromamba run -n "${ENV_NAME}" pytest -q -m "not docs_examples" |
| 43 | +
|
| 44 | + docs: |
| 45 | + name: Docs |
| 46 | + runs-on: ubuntu-latest |
| 47 | + |
| 48 | + steps: |
| 49 | + - name: Check out repository |
| 50 | + uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - name: Set up micromamba environment |
| 53 | + uses: mamba-org/setup-micromamba@v2 |
| 54 | + with: |
| 55 | + environment-name: ${{ env.ENV_NAME }} |
| 56 | + create-args: >- |
| 57 | + python=${{ env.PYTHON_VERSION }} |
| 58 | + pip |
| 59 | + cache-environment: true |
| 60 | + cache-downloads: true |
| 61 | + init-shell: bash |
| 62 | + |
| 63 | + - name: Install project and dependencies |
| 64 | + run: | |
| 65 | + micromamba run -n "${ENV_NAME}" python -m pip install --upgrade pip |
| 66 | + micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev,torch]" |
| 67 | +
|
| 68 | + - name: Run pytest docs examples |
| 69 | + run: | |
| 70 | + micromamba run -n "${ENV_NAME}" pytest -q -m docs_examples |
| 71 | +
|
| 72 | + - name: Run Sphinx doctest |
| 73 | + run: | |
| 74 | + micromamba run -n "${ENV_NAME}" \ |
| 75 | + python -m sphinx -b doctest docs/source docs/build/doctest |
| 76 | +
|
| 77 | + - name: Run warning-clean Sphinx HTML build |
| 78 | + run: | |
| 79 | + micromamba run -n "${ENV_NAME}" \ |
| 80 | + python -m sphinx -W --keep-going -b html docs/source docs/build/html |
| 81 | +
|
| 82 | + notebooks: |
| 83 | + name: Notebook (${{ matrix.notebook_name }}) |
| 84 | + runs-on: ubuntu-latest |
| 85 | + strategy: |
| 86 | + fail-fast: false |
| 87 | + matrix: |
| 88 | + include: |
| 89 | + - notebook: notebooks/example-01-featurization.ipynb |
| 90 | + notebook_name: example-01-featurization |
| 91 | + - notebook: notebooks/example-04-torch-featurization.ipynb |
| 92 | + notebook_name: example-04-torch-featurization |
| 93 | + - notebook: notebooks/example-05-torch-training.ipynb |
| 94 | + notebook_name: example-05-torch-training |
| 95 | + - notebook: notebooks/example-06-torch-inference.ipynb |
| 96 | + notebook_name: example-06-torch-inference |
| 97 | + - notebook: notebooks/example-07-neighbor-list.ipynb |
| 98 | + notebook_name: example-07-neighbor-list |
| 99 | + |
| 100 | + steps: |
| 101 | + - name: Check out repository |
| 102 | + uses: actions/checkout@v4 |
| 103 | + |
| 104 | + - name: Set up micromamba environment |
| 105 | + uses: mamba-org/setup-micromamba@v2 |
| 106 | + with: |
| 107 | + environment-name: ${{ env.ENV_NAME }} |
| 108 | + create-args: >- |
| 109 | + python=${{ env.PYTHON_VERSION }} |
| 110 | + pip |
| 111 | + cache-environment: true |
| 112 | + cache-downloads: true |
| 113 | + init-shell: bash |
| 114 | + |
| 115 | + - name: Install project and dependencies |
| 116 | + run: | |
| 117 | + micromamba run -n "${ENV_NAME}" python -m pip install --upgrade pip |
| 118 | + micromamba run -n "${ENV_NAME}" python -m pip install -e ".[dev,torch]" |
| 119 | +
|
| 120 | + - name: Prepare disposable notebook worktree |
| 121 | + run: | |
| 122 | + mkdir -p "${RUNNER_TEMP}/notebook-worktree" |
| 123 | + rsync -a --delete --exclude ".git" ./ "${RUNNER_TEMP}/notebook-worktree/" |
| 124 | +
|
| 125 | + - name: Execute notebook |
| 126 | + run: | |
| 127 | + mkdir -p "${RUNNER_TEMP}/executed-notebooks" |
| 128 | + micromamba run -n "${ENV_NAME}" \ |
| 129 | + python -m jupyter nbconvert --to notebook --execute \ |
| 130 | + "${RUNNER_TEMP}/notebook-worktree/${{ matrix.notebook }}" \ |
| 131 | + --output-dir "${RUNNER_TEMP}/executed-notebooks" \ |
| 132 | + --ExecutePreprocessor.timeout=600 |
0 commit comments