Skip to content

Commit d65fa8c

Browse files
committed
Cache GNU Stow download in CI to avoid rate limiting
- Add separate download-stow job that caches and artifacts GNU Stow - All test jobs depend on and download the shared artifact - Cache persists across CI runs with key gnu-stow-2.4.1
1 parent 094a357 commit d65fa8c

1 file changed

Lines changed: 44 additions & 12 deletions

File tree

.github/workflows/ci.yml

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,36 @@ on:
77
branches: [main]
88

99
jobs:
10+
download-stow:
11+
name: Download GNU Stow
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Cache GNU Stow
17+
id: cache-stow
18+
uses: actions/cache@v4
19+
with:
20+
path: tests/gnu_stow_for_testing
21+
key: gnu-stow-2.4.1
22+
23+
- name: Download and build GNU Stow
24+
if: steps.cache-stow.outputs.cache-hit != 'true'
25+
run: |
26+
cd tests
27+
./get_gnu_stow_for_testing_identical_behavior.sh
28+
29+
- name: Upload GNU Stow artifact
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: gnu-stow
33+
path: tests/gnu_stow_for_testing
34+
retention-days: 1
35+
1036
test:
1137
name: Test Python ${{ matrix.python-version }}
1238
runs-on: ubuntu-latest
39+
needs: download-stow
1340
strategy:
1441
fail-fast: false
1542
matrix:
@@ -26,17 +53,19 @@ jobs:
2653
- name: Install test dependencies
2754
run: pip install pytest
2855

29-
- name: Download GNU Stow for oracle tests
30-
run: |
31-
cd tests
32-
./get_gnu_stow_for_testing_identical_behavior.sh
56+
- name: Download GNU Stow artifact
57+
uses: actions/download-artifact@v4
58+
with:
59+
name: gnu-stow
60+
path: tests/gnu_stow_for_testing
3361

3462
- name: Run tests
3563
run: pytest tests/ -v
3664

3765
test-py36:
3866
name: Test Python 3.6
3967
runs-on: ubuntu-latest
68+
needs: download-stow
4069
container: python:3.6
4170
steps:
4271
- uses: actions/checkout@v4
@@ -50,17 +79,19 @@ jobs:
5079
- name: Install test dependencies
5180
run: pip install pytest
5281

53-
- name: Download GNU Stow for oracle tests
54-
run: |
55-
cd tests
56-
./get_gnu_stow_for_testing_identical_behavior.sh
82+
- name: Download GNU Stow artifact
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: gnu-stow
86+
path: tests/gnu_stow_for_testing
5787

5888
- name: Run tests
5989
run: pytest tests/ -v
6090

6191
test-py27:
6292
name: Test Python 2.7
6393
runs-on: ubuntu-latest
94+
needs: download-stow
6495
container: python:2.7
6596
steps:
6697
- uses: actions/checkout@v4
@@ -74,10 +105,11 @@ jobs:
74105
- name: Install test dependencies
75106
run: pip install pytest
76107

77-
- name: Download GNU Stow for oracle tests
78-
run: |
79-
cd tests
80-
./get_gnu_stow_for_testing_identical_behavior.sh
108+
- name: Download GNU Stow artifact
109+
uses: actions/download-artifact@v4
110+
with:
111+
name: gnu-stow
112+
path: tests/gnu_stow_for_testing
81113

82114
- name: Run tests
83115
run: pytest tests/ -v

0 commit comments

Comments
 (0)