From d79c18c6701a8952125340571d3afceaa1640954 Mon Sep 17 00:00:00 2001 From: ArinaDanilina <98481272+ArinaDanilina@users.noreply.github.com> Date: Tue, 26 Mar 2024 09:36:53 +0100 Subject: [PATCH] test example in CI (new) (#579) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test example CI * try to correct path * update * update test * add to tox * rename * fix tox * add to tox * update * update path * add kernel * fix deps * readd deps * add env * update * update ci * add submodules * add recursive * change command to build the docs * new name just to test CI * specify kernel * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove display name * rename kernel * fix tox env * use jupytext * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * print notebook name * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Arina Danilina Co-authored-by: giovp Co-authored-by: Giovanni Palla <25887487+giovp@users.noreply.github.com> Co-authored-by: Dominik Klein Co-authored-by: selmanozleyen Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Selman Ă–zleyen <32667648+selmanozleyen@users.noreply.github.com> --- .github/workflows/test-examples.yml | 41 +++++++++++++++++++++++++++++ pyproject.toml | 17 +++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-examples.yml diff --git a/.github/workflows/test-examples.yml b/.github/workflows/test-examples.yml new file mode 100644 index 000000000..3c05d35fc --- /dev/null +++ b/.github/workflows/test-examples.yml @@ -0,0 +1,41 @@ +name: Test examples + +on: + push: + branches: [main] + pull_request: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python: ["3.10"] + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + - name: Install pip dependencies + run: | + python -m pip install --upgrade pip + pip install tox + - name: Test examples + env: + MPLBACKEND: agg + PLATFORM: ${{ matrix.os }} + DISPLAY: :42 + run: | + tox -e examples-docs diff --git a/pyproject.toml b/pyproject.toml index 10102d26b..3190970f9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -282,7 +282,6 @@ commands = [testenv:lint-docs] description = Lint the documentation. -deps = extras = docs ignore_errors = true allowlist_externals = make @@ -294,6 +293,22 @@ commands = # TODO(michalk8): uncomment after https://github.com/theislab/moscot/issues/490 # make spelling {posargs} +[testenv:examples-docs] +allowlist_externals = bash +description = Run the notebooks. +use_develop = true +deps = + ipykernel + jupytext + nbconvert + leidenalg +extras = docs +changedir = {tox_root}{/}docs +commands = + python -m ipykernel install --user --name=moscot + bash -c "for nb in notebooks/examples/plotting/*.ipynb notebooks/examples/problems/*ipynb notebooks/examples/solvers/*ipynb; do echo Running $nb; jupytext -k moscot --execute $nb; done" + + [testenv:clean-docs] description = Remove the documentation. deps =