Skip to content

Commit

Permalink
CI: Test notebooks using pixi
Browse files Browse the repository at this point in the history
  • Loading branch information
sebp committed Jul 6, 2024
1 parent 43b4433 commit bdf81f0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 55 deletions.
51 changes: 0 additions & 51 deletions .github/workflows/tests-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,54 +86,3 @@ jobs:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
if: ${{ steps.coverage.outputs.do == 'true' && github.event_name != 'pull_request' }}


nbval:
runs-on: ubuntu-latest
name: Build and check notebooks
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set dependencies
id: dependencies
env:
DEPS_CONFIG: py311
run: |
source ci/deps/${DEPS_CONFIG}.sh
echo "CI_PYTHON_VERSION=${CI_PYTHON_VERSION}" >> $GITHUB_ENV
echo "CI_PANDAS_VERSION=${CI_PANDAS_VERSION}" >> $GITHUB_ENV
echo "CI_NUMPY_VERSION=${CI_NUMPY_VERSION}" >> $GITHUB_ENV
echo "CI_SKLEARN_VERSION=${CI_SKLEARN_VERSION}" >> $GITHUB_ENV
echo "CI_NO_SLOW=${CI_NO_SLOW}" >> $GITHUB_ENV
echo "CONDA_PKGS_DIRS=${{ runner.temp }}/conda_pkgs_dir" >> $GITHUB_ENV
echo "requirements=ci/deps/${DEPS_CONFIG}.sh" >> $GITHUB_OUTPUT
- name: Cache downloaded packages
uses: actions/cache@v4
with:
path: ${{ env.CONDA_PKGS_DIRS }}
key: ${{ runner.os }}-${{ runner.arch }}-conda-3.11-${{ hashFiles(steps.dependencies.outputs.requirements, 'pyproject.toml', 'ci/deps/requirements.yaml.tmpl') }}
- name: Create Conda Environment
run: |
source ci/setup_conda.sh "${{ runner.os }}" "${{ runner.arch }}" "${{ env.CONDA_PKGS_DIRS }}"
ci/setup_env.sh "${{ runner.os }}"
- name: Configure matplotlib
run: |
mkdir -p ${XDG_CONFIG_HOME}/matplotlib
echo 'figure.figsize: 6.0, 4.0' > ${XDG_CONFIG_HOME}/matplotlib/matplotlibrc
echo 'figure.facecolor: white' >> ${XDG_CONFIG_HOME}/matplotlib/matplotlibrc
echo 'figure.edgecolor: white' >> ${XDG_CONFIG_HOME}/matplotlib/matplotlibrc
echo 'figure.dpi: 72' >> ${XDG_CONFIG_HOME}/matplotlib/matplotlibrc
echo 'font.size: 10' >> ${XDG_CONFIG_HOME}/matplotlib/matplotlibrc
- name: Build package
run: |
source activate sksurv-test
python -m build .
pip install --exists-action=w --pre --no-index --find-links dist/ scikit-survival
rm -fr build dist sksurv
- name: Test notebooks
run: |
source activate sksurv-test
pytest --nbval doc/user_guide/*.ipynb --nbval-sanitize-with ci/nb_sanitize.cfg
6 changes: 3 additions & 3 deletions .github/workflows/tox-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
RUFF_OUTPUT_FORMAT: github
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
pixi run ${{ matrix.tox_env }}
pixi run ${{ matrix.environment }}
- name: Archive documentation
uses: actions/upload-artifact@v4
with:
name: documentation
path: doc/_build/html
if: ${{ matrix.tox_env == 'build-docs' }}
if: ${{ matrix.environment == 'build-docs' }}
strategy:
fail-fast: false
matrix:
tox_env: [lint, build-docs]
environment: [lint, build-docs, test-nb]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ dev = { features = ["dev", "nbval"], solve-group = "default" }
docs = { features = ["docs"], solve-group = "default" }

[tool.pixi.dependencies]
# conda dependencies
"scikit-learn" = "1.5.*"

[tool.pixi.pypi-dependencies]
Expand All @@ -237,4 +238,3 @@ spellcheck = "sphinx-build -j auto -E -W -d doc/_build/doctrees -b spelling doc/

[tool.pixi.feature.docs.dependencies]
pandoc = "*"

0 comments on commit bdf81f0

Please sign in to comment.