CI #306
Workflow file for this run
This file contains hidden or 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: | |
| - "**" | |
| pull_request: | |
| branches: | |
| - main | |
| schedule: | |
| - cron: "0 0 * * MON" | |
| workflow_dispatch: | |
| jobs: | |
| test_library: | |
| runs-on: ubuntu-latest | |
| container: debian:testing | |
| steps: | |
| - name: Install git | |
| run: | | |
| apt update -y -q | |
| apt install -y -qq ca-certificates git | |
| - name: Mark workspace as safe | |
| run: | | |
| git config --global --add safe.directory "${GITHUB_WORKSPACE}" | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| set-safe-directory: false | |
| - name: Install non-pip dependencies of the image cache tester library | |
| run: | | |
| export DEBIAN_FRONTEND="noninteractive" | |
| apt install -y -qq libegl1 libgl1-mesa-dri python3-mpi4py python3-pip | |
| rm /usr/lib/python3.*/EXTERNALLY-MANAGED | |
| - name: Install the image cache tester library | |
| run: | | |
| python3 -m pip install .[bin,docs,lint,tests] | |
| - name: Clean build files | |
| run: | | |
| git clean -xdf | |
| - name: Run ruff on python files | |
| run: | | |
| python3 -m ruff check . | |
| - name: Run isort on python files | |
| run: | | |
| python3 -m isort --check --diff . | |
| - name: Run mypy on python files | |
| run: | | |
| python3 -m mypy --exclude=conftest.py . | |
| python3 -m mypy tests/notebooks/basic/conftest.py | |
| python3 -m mypy tests/unit/conftest.py | |
| - name: Run yamllint on workflows | |
| run: | | |
| python3 -m yamllint -d "{extends: default, rules: {document-start: {present: false}, line-length: disable, truthy: {check-keys: false}}}" . | |
| - name: Run documentation generation | |
| run: | | |
| cd docs && python3 -m sphinx -W -b html . build/html | |
| - name: Run unit tests | |
| run: | | |
| COVERAGE_FILE=.coverage_unit python3 -m coverage run --source=image_cache_tester -m pytest tests/unit | |
| - name: Run ruff on notebooks test files | |
| run: | | |
| python3 -m nbqa ruff . | |
| - name: Run isort on notebooks test files | |
| run: | | |
| python3 -m nbqa isort --check --diff . | |
| - name: Run mypy on notebooks test files | |
| run: | | |
| python3 -m nbqa mypy . | |
| - name: Check for stray outputs, counts and metadata in ipynb files | |
| uses: RBniCS/check-jupyter-metadata-action@6df653e5d45f7620d888c6a1bd85d07b4f903045 # v1.0.0 | |
| with: | |
| pattern: "**/*.ipynb" | |
| - name: Run basic notebooks tests | |
| run: | | |
| COVERAGE_FILE=.coverage_notebooks_basic python3 -m coverage run --source=image_cache_tester -m pytest --coverage-run-allow tests/notebooks/basic | |
| - name: Upload notebooks logs as an artifact in case of failure | |
| if: failure() || cancelled() | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: "notebooks-logs" | |
| path: | | |
| tests/notebooks/**/.ipynb_pytest/**/*.log* | |
| include-hidden-files: true | |
| - name: Generate viskex notebooks tests | |
| run: | | |
| NO_TESTS_COLLECTED=5 | |
| COVERAGE_FILE=.coverage_notebooks_viskex_generation_serial python3 -m coverage run --source=image_cache_tester -m pytest --coverage-run-allow --verify-images --refresh-image-cache --ipynb-action=create-notebooks tests/notebooks/viskex || (($?==$NO_TESTS_COLLECTED)) | |
| COVERAGE_FILE=.coverage_notebooks_viskex_generation_parallel python3 -m coverage run --source=image_cache_tester -m pytest --coverage-run-allow --verify-images --refresh-image-cache --ipynb-action=create-notebooks --np=2 tests/notebooks/viskex || (($?==$NO_TESTS_COLLECTED)) | |
| shell: bash | |
| - name: Run viskex notebooks tests to check that they are skipped because of missing backends | |
| run: | | |
| COVERAGE_FILE=.coverage_notebooks_viskex_run_serial python3 -m coverage run --source=image_cache_tester -m pytest --coverage-run-allow --verify-images --refresh-image-cache tests/notebooks/viskex | |
| COVERAGE_FILE=.coverage_notebooks_viskex_run_parallel python3 -m coverage run --source=image_cache_tester -m pytest --coverage-run-allow --verify-images --refresh-image-cache --np=2 tests/notebooks/viskex | |
| - name: Combine coverage reports | |
| run: | | |
| python3 -m coverage combine .coverage* | |
| python3 -m coverage report --fail-under=100 --show-missing --skip-covered | |
| test_workflow_call: | |
| needs: [test_library] | |
| uses: viskex/image_cache_tester/.github/workflows/workflow_call.yml@main | |
| with: | |
| notebook_repository: viskex/image_cache_tester | |
| notebook_branch: ${{ github.ref }} | |
| image_cache_branch: image-cache-viskex-tests | |
| notebook_preparation: | | |
| git clone https://github.com/viskex/viskex.git | |
| cd viskex | |
| python3 -m pip install .[tests] | |
| notebook_directory: tests/notebooks/viskex | |
| warn: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'viskex/image_cache_tester' && github.ref == 'refs/heads/main' && github.event_name == 'schedule' | |
| steps: | |
| - name: Warn if scheduled workflow is about to be disabled | |
| uses: fem-on-colab/warn-workflow-about-to-be-disabled-action@58c6022d9aeb22accfa8df9bf5b58c3d8867208c # v1.0.0 | |
| with: | |
| workflow-filename: ci.yml | |
| days-elapsed: 50 |