[go: up one dir, main page]

Skip to content

CI

CI #518

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "1 0 * * *"
workflow_dispatch:
inputs:
tags:
description: Manual dabl run aux info
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
prep-vars:
name: Prepare some variables for other jobs
runs-on: ubuntu-latest
outputs:
PythonVersionMatrix: ${{ steps.set-python-version-matrix.outputs.PythonVersionMatrix }}
ScikitLearnVersionMatrix: ${{ steps.set-scikit-learn-version-matrix.outputs.ScikitLearnVersionMatrix }}
steps:
- id: set-python-version-matrix
name: Determine Python version matrix
run: |
if [ "$GITHUB_REF" == 'refs/heads/main' ] || [ "$GITHUB_EVENT_NAME" == 'schedule' ] || [ "$GITHUB_EVENT_NAME" == 'manual' ]; then
echo 'PythonVersionMatrix=["3.8", "3.9", "3.10", "3.11", "3.12"]' >> $GITHUB_OUTPUT
else
echo 'PythonVersionMatrix=["3.8", "3.10", "3.12"]' >> $GITHUB_OUTPUT
fi
- id: set-scikit-learn-version-matrix
name: Determine scikit-learn version matrix
run: |
if [ "$GITHUB_REF" == 'refs/heads/main' ] || [ "$GITHUB_EVENT_NAME" == 'schedule' ] || [ "$GITHUB_EVENT_NAME" == 'manual' ]; then
echo 'ScikitLearnVersionMatrix=["1.1.*", "1.2.*", "1.3.*", "1.4.*", "1.5.*", "dev"]' >> $GITHUB_OUTPUT
else
echo 'ScikitLearnVersionMatrix=["1.1.*", "1.2.*", "1.3.*", "dev"]' >> $GITHUB_OUTPUT
fi
test:
needs: prep-vars
name: Test Python ${{ matrix.python-version }}, scikit-learn ${{ matrix.scikit-learn-version }}
strategy:
fail-fast: false
matrix:
# For nightly and manual triggers we want to run a more comprehensive test
# matrix than we do for PRs so we make this value dynamic.
python-version: ${{ fromJson(needs.prep-vars.outputs.PythonVersionMatrix) }}
scikit-learn-version: ${{ fromJson(needs.prep-vars.outputs.ScikitLearnVersionMatrix) }}
exclude:
# Not supported:
# See Also: setup.py
- python-version: "3.8"
scikit-learn-version: "1.4.*"
- python-version: "3.8"
scikit-learn-version: "1.5.*"
- python-version: "3.8"
scikit-learn-version: "dev"
- python-version: "3.9"
scikit-learn-version: "1.1.*"
- python-version: "3.9"
scikit-learn-version: "1.2.*"
- python-version: "3.10"
scikit-learn-version: "1.1.*"
- python-version: "3.10"
scikit-learn-version: "1.2.*"
- python-version: "3.11"
scikit-learn-version: "1.1.*"
- python-version: "3.11"
scikit-learn-version: "1.2.*"
- python-version: "3.12"
scikit-learn-version: "1.1.*"
- python-version: "3.12"
scikit-learn-version: "1.2.*"
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
channels: conda-forge
channel-priority: true
activate-environment: testenv
- name: Conda info
shell: bash -el {0}
run: conda info
# TODO: Add a cache for the conda steps?
- name: Install dependencies
run: |
conda update --yes -n base conda
conda install --yes pip pytest pytest-xdist wheel build
conda list
- name: Install scikit-learn
run: |
if [[ "$SKLEARN_VERSION" == "dev" ]]; then
python -m pip install --verbose --pre --extra-index https://pypi.anaconda.org/scipy-wheels-nightly/simple scikit-learn
else
python -m pip --verbose install scikit-learn==$SKLEARN_VERSION
fi
env:
SKLEARN_VERSION: ${{ matrix.scikit-learn-version }}
- name: Show versions and install dabl
run: |
python --version
python -m pip install -e .
python -c "import numpy; print('numpy %s' % numpy.__version__)"
python -c "import scipy; print('scipy %s' % scipy.__version__)"
python -c "import matplotlib; print('matplotlib %s' % matplotlib.__version__)"
python -c "import pandas; print('pandas %s' % pandas.__version__)"
python -c "import sklearn; print('sklearn %s' % sklearn.__version__)"
- name: Test dabl
run: |
TEST_DIR=/tmp/test_dir
mkdir -p $TEST_DIR
cd $TEST_DIR
pytest -n auto --pyargs dabl
- name: Test docs
run: pytest doc
build-check:
name: Check the package build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U build
- name: Check build
run: scripts/check_build.sh