Skip to content

CI: Test notebooks using pixi #656

CI: Test notebooks using pixi

CI: Test notebooks using pixi #656

name: Tests
on:
push:
pull_request:
schedule:
- cron: '0 6 1 * *'
jobs:
pytest:
name: Build and check
strategy:
fail-fast: false
matrix:
config:
- py39
- py310
- py311
- py312
runner:
- ubuntu-latest
- macos-14
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Set dependencies
id: dependencies
run: |
source ci/deps/${{ matrix.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 "py_version=$(cut -d'.' -f 1-2 <<< ${CI_PYTHON_VERSION})" >> $GITHUB_OUTPUT
echo "requirements=ci/deps/${{ matrix.config }}.sh" >> $GITHUB_OUTPUT
- name: Cache downloaded packages
uses: actions/cache@v4
with:
path: ${{ env.CONDA_PKGS_DIRS }}
key: ${{ runner.os }}-${{ runner.arch }}-conda-${{ steps.dependencies.outputs.py_version }}-${{ hashFiles(steps.dependencies.outputs.requirements, 'pyproject.toml', 'ci/deps/requirements.yaml.tmpl') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-conda-${{ steps.dependencies.outputs.py_version }}-
- 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 Xcode
run: |
sudo xcode-select -s "/Applications/Xcode_15.0.1.app"
if: runner.os == 'macOS'
- 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: Run Tests
run: |
source activate sksurv-test
ci/run_tests.sh
- name: Check whether to create coverage report
id: coverage
run: |
if [ ${{ env.CI_NO_SLOW }} = 'false' ] && [ ${{ runner.os }} = 'Linux' ] && [ ${{ github.actor }} != 'dependabot[bot]' ]; then
echo "do=true" >> $GITHUB_OUTPUT
else
echo "do=false" >> $GITHUB_OUTPUT
fi
- name: Submit Coverage to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: coverage.xml
fail_ci_if_error: true
disable_file_fixes: true
if: steps.coverage.outputs.do == 'true'
- name: Submit Coverage to Codacy
uses: codacy/codacy-coverage-reporter-action@master
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
if: ${{ steps.coverage.outputs.do == 'true' && github.event_name != 'pull_request' }}