Skip to content

Commit d8d8871

Browse files
committed
Merge branch 'fix/cache-workflow-resources'
2 parents e358045 + 4d7a32a commit d8d8871

File tree

4 files changed

+66
-4
lines changed

4 files changed

+66
-4
lines changed

.github/workflows/nightly.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@ permissions:
2323
jobs:
2424
linux:
2525
name: Nightly Linux
26-
if: github.repository_owner == 'NVIDIA'
26+
if: github.repository_owner == 'NVIDIA' || github.event_name == 'workflow_dispatch'
2727
uses: ./.github/workflows/test_linux.yml
2828
windows:
2929
name: Nightly Windows
30-
if: github.repository_owner == 'NVIDIA'
30+
if: github.repository_owner == 'NVIDIA' || github.event_name == 'workflow_dispatch'
3131
uses: ./.github/workflows/test_windows.yml
3232
macos:
3333
name: Nightly MacOS
34-
if: github.repository_owner == 'NVIDIA'
34+
if: github.repository_owner == 'NVIDIA' || github.event_name == 'workflow_dispatch'
3535
uses: ./.github/workflows/test_macos.yml
36+
with:
37+
store-cache: true
3638
package_test:
3739
name: Nightly Packaging
38-
if: github.repository_owner == 'NVIDIA'
40+
if: github.repository_owner == 'NVIDIA' || github.event_name == 'workflow_dispatch'
3941
uses: ./.github/workflows/remote_package_install.yml

.github/workflows/test_linux.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ permissions:
2323
security-events: none
2424
statuses: none
2525

26+
env:
27+
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
28+
2629
jobs:
2730
build:
2831
runs-on: ubuntu-latest
@@ -35,11 +38,22 @@ jobs:
3538
uses: actions/setup-python@v4
3639
with:
3740
python-version: ${{ matrix.python-version }}
41+
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-shared
50+
3851
- name: Install dependencies
3952
run: |
4053
python -m pip install --upgrade pip
4154
pip install -r requirements.txt
4255
python -m pip cache purge
56+
4357
- name: Test with pytest
4458
run: |
4559
python -m pytest tests/

.github/workflows/test_macos.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ on:
77
pull_request:
88
workflow_dispatch:
99
workflow_call:
10+
inputs:
11+
store-cache:
12+
description: "Store resource cache"
13+
required: false
14+
type: boolean
15+
1016

1117
permissions:
1218
actions: none
@@ -23,6 +29,9 @@ permissions:
2329
security-events: none
2430
statuses: none
2531

32+
env:
33+
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
34+
2635
jobs:
2736
build_macos:
2837
runs-on: macos-latest
@@ -39,6 +48,15 @@ jobs:
3948
with:
4049
python-version: ${{ matrix.python-version }}
4150

51+
- name: Restore test cache artifacts
52+
id: cache-artifacts-restore
53+
uses: actions/cache/restore@v4
54+
with:
55+
path: |
56+
.cache/garak/data
57+
.cache/huggingface
58+
key: hf-cache-shared
59+
4260
- name: Install dependencies
4361
run: |
4462
brew install libmagic
@@ -51,3 +69,18 @@ jobs:
5169
run: |
5270
cd garak
5371
python -m pytest tests/
72+
73+
- name: Prepare resources for cache
74+
run: |
75+
rm -rf .cache/huggingface/hub/*facebook*
76+
rm -rf .cache/huggingface/hub/*Helsinki*
77+
78+
- name: Save test cache
79+
if: inputs.store-cache
80+
uses: actions/cache@v4
81+
with:
82+
path: |
83+
.cache/garak/data
84+
.cache/huggingface
85+
enableCrossOsArchive: true
86+
key: hf-cache-shared

.github/workflows/test_windows.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ permissions:
2323
security-events: none
2424
statuses: none
2525

26+
env:
27+
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
28+
2629
jobs:
2730
build_windows:
2831
runs-on: windows-latest
@@ -39,6 +42,16 @@ jobs:
3942
with:
4043
python-version: ${{ matrix.python-version }}
4144

45+
- name: Restore test cache artifacts
46+
id: cache-artifacts-restore
47+
uses: actions/cache/restore@v4
48+
with:
49+
path: |
50+
.cache/garak/data
51+
.cache/huggingface
52+
enableCrossOsArchive: true
53+
key: hf-cache-shared
54+
4255
- name: Install dependencies
4356
run: |
4457
python -m pip install --upgrade pip

0 commit comments

Comments
 (0)