Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 57 additions & 33 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ on:
branches:
- main
- develop

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand All @@ -23,74 +22,98 @@ jobs:
test:
name: (${{ matrix.os }}, Py${{ matrix.python-version }}, sk${{ matrix.scikit-learn }}, sk-only:${{ matrix.sklearn-only }})
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
scikit-learn: ["1.3.*", "1.4.*", "1.5.*"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
scikit-learn: ["1.3.*", "1.4.*", "1.5.*", "1.6.*", "1.7.*"]
os: [ubuntu-latest]
sklearn-only: ["true"]
fail-fast: false

exclude:
# incompatible version combinations
- python-version: "3.13"
scikit-learn: "1.3.*"
- python-version: "3.13"
scikit-learn: "1.4.*"

include:
# Full test run on Windows
- os: ubuntu-latest
# - os: windows-latest
python-version: "3.12"
scikit-learn: "1.5.*"
sklearn-only: "true"

# Coverage run
- os: ubuntu-latest
python-version: "3.12"
scikit-learn: "1.5.*"
sklearn-only: "true"
# code-cov: true

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 2

- name: Setup Python ${{ matrix.python-version }}
if: matrix.os != 'windows-latest' # windows-latest only uses preinstalled Python (3.9.13)
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies

- name: Install test dependencies and scikit-learn
run: |
python -m pip install --upgrade pip
pip install -e .[test]
- name: Install scikit-learn ${{ matrix.scikit-learn }}
run: |
pip install scikit-learn==${{ matrix.scikit-learn }}
- name: Install numpy for Python 3.8
# Python 3.8 & scikit-learn<0.24 requires numpy<=1.23.5
if: ${{ matrix.python-version == '3.8' && matrix.scikit-learn == '0.23.1' }}
run: |
pip install numpy==1.23.5
- name: "Install NumPy 1.x and SciPy <1.11 for scikit-learn < 1.4"
if: ${{ contains(fromJSON('["1.0.*", "1.1.*", "1.2.*", "1.3.*"]'), matrix.scikit-learn) }}
run: |
# scipy has a change to the 'mode' behavior which breaks scikit-learn < 1.4
# numpy 2.0 has several breaking changes
pip install "numpy<2.0" "scipy<1.11"
- name: Install scipy ${{ matrix.scipy }}
if: ${{ matrix.scipy }}
run: |
pip install scipy==${{ matrix.scipy }}
pip install -e .[test] scikit-learn==${{ matrix.scikit-learn }}

- name: Store repository status
id: status-before
if: matrix.os != 'windows-latest'
run: |
git_status=$(git status --porcelain -b)
echo "BEFORE=$git_status" >> $GITHUB_ENV
echo "Repository status before tests: $git_status"

- name: Show installed dependencies
run: python -m pip list

- name: Run tests on Ubuntu Test
if: matrix.os == 'ubuntu-latest'
run: |
if [ ${{ matrix.code-cov }} ]; then codecov='--cov=openml --long --cov-report=xml'; fi
# Most of the time, running only the scikit-learn tests is sufficient
if [ ${{ matrix.sklearn-only }} = 'true' ]; then marks='sklearn and not production'; else marks='not production'; fi
echo pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks"
if [ "${{ matrix.code-cov }}" = "true" ]; then
codecov="--cov=openml --long --cov-report=xml"
fi

if [ "${{ matrix.sklearn-only }}" = "true" ]; then
marks="sklearn and not production"
else
marks="not production"
fi

pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks"

- name: Run tests on Ubuntu Production
if: matrix.os == 'ubuntu-latest'
run: |
if [ ${{ matrix.code-cov }} ]; then codecov='--cov=openml --long --cov-report=xml'; fi
# Most of the time, running only the scikit-learn tests is sufficient
if [ ${{ matrix.sklearn-only }} = 'true' ]; then marks='sklearn and production'; else marks='production'; fi
echo pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks"
if [ "${{ matrix.code-cov }}" = "true" ]; then
codecov="--cov=openml --long --cov-report=xml"
fi

if [ "${{ matrix.sklearn-only }}" = "true" ]; then
marks="sklearn and production"
else
marks="production"
fi

pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks"

- name: Run tests on Windows
if: matrix.os == 'windows-latest'
run: | # we need a separate step because of the bash-specific if-statement in the previous one.
pytest -n 4 --durations=20 --dist load -sv --reruns 5 --reruns-delay 1

- name: Check for files left behind by test
if: matrix.os != 'windows-latest' && always()
run: |
Expand All @@ -102,6 +125,7 @@ jobs:
echo "Not all generated files have been deleted!"
exit 1
fi

- name: Upload coverage
if: matrix.code-cov && always()
uses: codecov/codecov-action@v4
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ classifiers = [
"Operating System :: Unix",
"Operating System :: MacOS",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
license = { file = "LICENSE" }

Expand Down