Merge pull request #421 from sebp/dependabot/github_actions/actions/u… #418
This file contains 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: Tests | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 6 1 * *' | |
jobs: | |
pytest: | |
name: Build and check | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- py38_pandas11_numpy121_sklearn13 | |
- py39_pandas14_numpy122_sklearn13 | |
- py310_pandas15_numpy124_sklearn13 | |
- py311_pandas20_numpy124_sklearn13 | |
runner: | |
- ubuntu-latest | |
- macos-latest | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Adding conda to PATH | |
run: echo "${CONDA}/bin" >> $GITHUB_PATH | |
- 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_DIR=${HOME}/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@v3 | |
with: | |
path: ${{ env.CONDA_PKGS_DIR }} | |
key: ${{ runner.os }}-conda-${{ steps.dependencies.outputs.py_version }}-${{ hashFiles(steps.dependencies.outputs.requirements, 'pyproject.toml', 'ci/deps/requirements.yaml.tmpl') }} | |
restore-keys: | | |
${{ runner.os }}-conda-${{ steps.dependencies.outputs.py_version }}- | |
- name: Create Conda Environment | |
run: | | |
sudo chown -R $USER $CONDA | |
ci/setup_env.sh ${{ runner.os }} | |
- name: Configure Xcode | |
run: | | |
sudo xcode-select -s "/Applications/Xcode_13.2.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@v3 | |
with: | |
file: coverage.xml | |
fail_ci_if_error: 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' }} | |
nbval: | |
runs-on: ubuntu-latest | |
name: Build and check notebooks | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Adding conda to PATH | |
run: echo "${CONDA}/bin" >> $GITHUB_PATH | |
- name: Set dependencies | |
id: dependencies | |
env: | |
DEPS_CONFIG: py311_pandas20_numpy124_sklearn13 | |
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_DIR=${HOME}/conda_pkgs_dir" >> $GITHUB_ENV | |
echo "requirements=ci/deps/${DEPS_CONFIG}.sh" >> $GITHUB_OUTPUT | |
- name: Cache downloaded packages | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CONDA_PKGS_DIR }} | |
key: ${{ runner.os }}-conda-3.10-${{ hashFiles(steps.dependencies.outputs.requirements, 'pyproject.toml', 'ci/deps/requirements.yaml.tmpl') }} | |
- name: Create Conda Environment | |
run: | | |
sudo chown -R $USER $CONDA | |
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 |