Skip to content

Commit 8147866

Browse files
committed
cache testing resources on version and dep changes
Signed-off-by: Jeffrey Martin <[email protected]>
1 parent 06a4c51 commit 8147866

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

.github/workflows/test_linux.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ 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: ${{ runner.os }}-${{ hashFiles('**/pyproject.toml') }}
47+
3848
- name: Install dependencies
3949
run: |
4050
python -m pip install --upgrade pip
@@ -43,3 +53,12 @@ jobs:
4353
- name: Test with pytest
4454
run: |
4555
python -m pytest tests/
56+
57+
- name: Save test cache
58+
if: steps.cache-artifacts-restore.outputs.cache-hit != 'true'
59+
uses: actions/cache@v4
60+
with:
61+
path: |
62+
~/.cache/garak/data
63+
~/.cache/huggingface
64+
key: ${{ runner.os }}-${{ hashFiles('**/pyproject.toml') }}

.github/workflows/test_macos.yml

Lines changed: 18 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: ${{ runner.os }}-${{ hashFiles('**/pyproject.toml') }}
50+
4251
- name: Install dependencies
4352
run: |
4453
brew install libmagic
@@ -51,3 +60,12 @@ jobs:
5160
run: |
5261
cd garak
5362
python -m pytest tests/
63+
64+
- name: Save test cache
65+
if: steps.cache-artifacts-restore.outputs.cache-hit != 'true'
66+
uses: actions/cache@v4
67+
with:
68+
path: |
69+
~/.cache/garak/data
70+
~/.cache/huggingface
71+
key: ${{ runner.os }}-${{ hashFiles('**/pyproject.toml') }}

.github/workflows/test_windows.yml

Lines changed: 18 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: ${{ runner.os }}-${{ hashFiles('**/pyproject.toml') }}
50+
4251
- name: Install dependencies
4352
run: |
4453
python -m pip install --upgrade pip
@@ -50,3 +59,12 @@ jobs:
5059
run: |
5160
cd garak
5261
python -m pytest tests/
62+
63+
- name: Save test cache
64+
if: steps.cache-artifacts-restore.outputs.cache-hit != 'true'
65+
uses: actions/cache@v4
66+
with:
67+
path: |
68+
~/.cache/garak/data
69+
~/.cache/huggingface
70+
key: ${{ runner.os }}-${{ hashFiles('**/pyproject.toml') }}

0 commit comments

Comments
 (0)