Skip to content

Commit 9ce6e5b

Browse files
committed
ci: Test with the 3 latest major versions of scikit-learn
1 parent 29d3689 commit 9ce6e5b

File tree

1 file changed

+54
-10
lines changed

1 file changed

+54
-10
lines changed

.github/workflows/skore.yml

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,81 @@ on: [workflow_call]
55
defaults:
66
run:
77
shell: "bash"
8-
working-directory: "./skore"
98

109
jobs:
1110
test-skore:
1211
strategy:
13-
fail-fast: true
12+
fail-fast: false
1413
matrix:
1514
os: ["ubuntu-latest", "windows-latest"]
16-
python-version: ["3.9", "3.10", "3.11", "3.12"]
15+
python: ["3.9", "3.10", "3.11", "3.12"]
16+
scikit-learn: ["1.6"]
17+
include:
18+
- os: "ubuntu-latest"
19+
python: "3.12"
20+
scikit-learn: "1.4"
21+
- os: "ubuntu-latest"
22+
python: "3.12"
23+
scikit-learn: "1.5"
1724
runs-on: ${{ matrix.os }}
1825
steps:
1926
- uses: actions/checkout@v4
27+
2028
- uses: actions/setup-python@v5
2129
with:
22-
python-version: ${{ matrix.python-version }}
30+
python-version: ${{ matrix.python }}
2331
cache: "pip"
32+
33+
- uses: actions/cache/restore@v4
34+
id: cache-python-venv
35+
with:
36+
path: 'skore/venv'
37+
key: python-venv-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.scikit-learn }}-${{ hashFiles('skore/pyproject.toml') }}
38+
39+
- name: Setup python-venv
40+
working-directory: "skore/"
41+
run: |
42+
set -eu
43+
44+
# Ensure venv is created
45+
python -m venv venv
46+
47+
# Activate venv for each step depending on the OS
48+
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
49+
echo "${GITHUB_WORKSPACE}/skore/venv/bin" >> ${GITHUB_PATH}
50+
echo "VIRTUAL_ENV=${GITHUB_WORKSPACE}/skore/venv" >> ${GITHUB_ENV}
51+
else
52+
echo "${GITHUB_WORKSPACE}\\skore\\venv\\Scripts" >> ${GITHUB_PATH}
53+
echo "VIRTUAL_ENV=${GITHUB_WORKSPACE}\\skore\\venv" >> ${GITHUB_ENV}
54+
fi
55+
56+
- name: Install dependencies
57+
working-directory: "skore/"
58+
if: steps.cache-python-venv.outputs.cache-hit != 'true'
59+
run: |
60+
python -m pip install --upgrade "pip"
61+
python -m pip install --upgrade "build"
62+
python -m pip install --upgrade "scikit-learn ==${{ matrix.scikit-learn }}"
63+
python -m pip install --upgrade ".[test]"
64+
65+
- uses: actions/cache/save@v4
66+
if: steps.cache-python-venv.outputs.cache-hit != 'true'
67+
with:
68+
path: 'skore/venv'
69+
key: ${{ steps.cache-python-venv.outputs.cache-primary-key }}
70+
2471
- name:
2572
timeout-minutes: 10
73+
working-directory: "skore/"
2674
run: |
27-
# Install dependencies
28-
python -m pip install --upgrade pip
29-
python -m pip install --upgrade pre-commit
30-
python -m pip install --upgrade build
31-
3275
# Lint
3376
pre-commit run --all-files ruff
3477
3578
# Build
3679
python -m build
3780
3881
# Install
39-
wheel=(dist/*.whl); python -m pip install "${wheel}[test]"
82+
wheel=(dist/*.whl); python -m pip install --force-reinstall --no-deps "${wheel}"
4083
4184
# Test
4285
python -m pytest --no-cov src/ tests/ -n auto
@@ -51,6 +94,7 @@ jobs:
5194
python-version: 3.12
5295
cache: "pip"
5396
- name: pytest coverage
97+
working-directory: "skore/"
5498
run: |
5599
# Install dependencies
56100
python -m pip install --upgrade pip

0 commit comments

Comments
 (0)