Skip to content

Commit 8c4a618

Browse files
committed
Merge branch 'fix/cache-workflow-resources'
2 parents ded0d45 + e9b927f commit 8c4a618

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

.github/workflows/test_linux.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,22 @@ jobs:
3535
uses: actions/setup-python@v4
3636
with:
3737
python-version: ${{ matrix.python-version }}
38+
39+
- name: Restore test cache artifacts
40+
id: cache-artifacts-restore
41+
uses: actions/cache/restore@v4
42+
with:
43+
path: |
44+
~/.cache/garak/data
45+
~/.cache/huggingface
46+
key: hf-cache-${{ hashFiles('**/pyproject.toml') }}
47+
3848
- name: Install dependencies
3949
run: |
4050
python -m pip install --upgrade pip
4151
pip install -r requirements.txt
4252
python -m pip cache purge
53+
4354
- name: Test with pytest
4455
run: |
4556
python -m pytest tests/

.github/workflows/test_macos.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ jobs:
3939
with:
4040
python-version: ${{ matrix.python-version }}
4141

42+
- name: Restore test cache artifacts
43+
id: cache-artifacts-restore
44+
uses: actions/cache/restore@v4
45+
with:
46+
path: |
47+
~/.cache/garak/data
48+
~/.cache/huggingface
49+
key: hf-cache--${{ hashFiles('**/pyproject.toml') }}
50+
4251
- name: Install dependencies
4352
run: |
4453
brew install libmagic
@@ -51,3 +60,18 @@ jobs:
5160
run: |
5261
cd garak
5362
python -m pytest tests/
63+
64+
- name: Prepare resources for cache
65+
run: |
66+
rm -rf ~/.cache/huggingface/hub/*facebook*
67+
rm -rf ~/.cache/huggingface/hub/*Helsinki*
68+
69+
- name: Save test cache
70+
if: steps.cache-artifacts-restore.outputs.cache-hit != 'true'
71+
uses: actions/cache@v4
72+
with:
73+
path: |
74+
~/.cache/garak/data
75+
~/.cache/huggingface
76+
enableCrossOsArchive: true
77+
key: hf-cache-${{ hashFiles('**/pyproject.toml') }}

.github/workflows/test_windows.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ jobs:
3939
with:
4040
python-version: ${{ matrix.python-version }}
4141

42+
- name: Restore test cache artifacts
43+
id: cache-artifacts-restore
44+
uses: actions/cache/restore@v4
45+
with:
46+
path: |
47+
~/.cache/garak/data
48+
~/.cache/huggingface
49+
enableCrossOsArchive: true
50+
key: hf-cache-${{ hashFiles('**/pyproject.toml') }}
51+
4252
- name: Install dependencies
4353
run: |
4454
python -m pip install --upgrade pip

0 commit comments

Comments
 (0)