Skip to content

Commit 88e6af4

Browse files
committed
CI: try caching sklearn data to prevent HTTP errors
1 parent 84f12c9 commit 88e6af4

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/main.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ jobs:
7070
build_sdist:
7171
name: sdist on ${{ matrix.os }} with py ${{ matrix.ver.py }} numpy${{ matrix.ver.np }}
7272
runs-on: ${{ matrix.os }}
73+
env:
74+
SCIKIT_LEARN_DATA: ${{ github.workspace }}/.cache/scikit_learn_data
7375
strategy:
7476
fail-fast: false
7577
matrix:
@@ -93,6 +95,12 @@ jobs:
9395
with:
9496
fetch-depth: "0"
9597

98+
- name: Cache scikit-learn dataset
99+
uses: actions/cache@v4
100+
with:
101+
path: .cache/scikit_learn_data
102+
key: ${{ runner.os }}-sklearn-data
103+
96104
- name: Set up Python ${{ matrix.ver.py }}
97105
uses: actions/setup-python@v5
98106
with:
@@ -107,6 +115,9 @@ jobs:
107115
run: |
108116
pip install -v --editable .[test]
109117
118+
- name: Pre-fetch scikit-learn datasets
119+
run: python -c "from sklearn.datasets import fetch_california_housing; fetch_california_housing()"
120+
110121
- name: Run tests
111122
run: |
112123
pip install "numpy${{ matrix.ver.np }}" "scipy${{ matrix.ver.sp }}"
@@ -126,12 +137,20 @@ jobs:
126137
coverage:
127138
name: coverage
128139
runs-on: ubuntu-latest
140+
env:
141+
SCIKIT_LEARN_DATA: ${{ github.workspace }}/.cache/scikit_learn_data
129142

130143
steps:
131144
- uses: actions/checkout@v4
132145
with:
133146
fetch-depth: '0'
134147

148+
- name: Cache scikit-learn dataset
149+
uses: actions/cache@v4
150+
with:
151+
path: .cache/scikit_learn_data
152+
key: ${{ runner.os }}-sklearn-data
153+
135154
- name: Set up Python 3.11
136155
uses: actions/setup-python@v5
137156
with:
@@ -146,6 +165,9 @@ jobs:
146165
run: |
147166
pip install -v --editable .[test]
148167
168+
- name: Pre-fetch scikit-learn datasets
169+
run: python -c "from sklearn.datasets import fetch_california_housing; fetch_california_housing()"
170+
149171
- name: Run tests
150172
env:
151173
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)