CI: Use github output format for ruff #588
Workflow file for this run
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: | |
- 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' }} | |
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 |