Skip to content

Commit c71ede8

Browse files
authored
ci: with pull_request_target (#1992)
1 parent f057486 commit c71ede8

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

.github/workflows/cpu-tests.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: CPU tests
33
on:
44
push:
55
branches: [main]
6-
pull_request: {}
6+
pull_request_target:
7+
branches: [main]
8+
types: [opened, reopened, ready_for_review, labeled, synchronize]
79
workflow_dispatch: {}
810

911
concurrency:
@@ -31,6 +33,11 @@ jobs:
3133
timeout-minutes: 10
3234
steps:
3335
- uses: actions/checkout@v4
36+
if: github.event_name != 'pull_request'
37+
- uses: actions/checkout@v4
38+
if: github.event_name == 'pull_request'
39+
with:
40+
ref: ${{ github.event.pull_request.head.sha }}
3441
- uses: actions/setup-python@v5
3542
with:
3643
python-version: ${{ matrix.python-version }}
@@ -59,27 +66,33 @@ jobs:
5966
os: ["ubuntu-22.04"]
6067
python-version: ["3.9", "3.10", "3.11"]
6168
include:
62-
- { os: "macOS-14", python-version: "3.9" } # without Thunder
63-
- { os: "windows-2022", python-version: "3.9" } # without Thunder
69+
- { os: "macOS-14", python-version: "3.9" }
70+
- { os: "windows-2022", python-version: "3.9" }
6471
timeout-minutes: 25
6572
steps:
6673
- uses: actions/checkout@v4
74+
if: github.event_name != 'pull_request'
75+
- uses: actions/checkout@v4
76+
if: github.event_name == 'pull_request'
77+
with:
78+
ref: ${{ github.event.pull_request.head.sha }}
6779
- uses: actions/setup-python@v5
6880
with:
6981
python-version: ${{ matrix.python-version }}
7082
cache: "pip"
7183
cache-dependency-path: pyproject.toml
7284

7385
# Add caching for HF models and tokenizers
74-
- name: Restore HF cache
75-
uses: actions/cache/restore@v3
86+
- name: HF cache
87+
uses: actions/cache@v3
88+
continue-on-error: true
7689
with:
7790
path: .cache-HF
78-
key: |
91+
key: hf-cache-${{ runner.os }}-${{ matrix.python-version }}
92+
restore-keys: |
7993
hf-cache-${{ runner.os }}-${{ matrix.python-version }}
8094
hf-cache-${{ runner.os }}-
8195
hf-cache-
82-
fail-on-cache-miss: false
8396
8497
- name: Install dependencies
8598
run: |
@@ -96,13 +109,6 @@ jobs:
96109
pip install -q py-tree
97110
python -m py_tree -d 1 .cache-HF
98111
99-
- name: Dump HF cache
100-
if: github.event_name != 'pull_request'
101-
uses: actions/cache/save@v3
102-
with:
103-
path: .cache-HF
104-
key: hf-cache-${{ runner.os }}-${{ matrix.python-version }}
105-
106112
testing-guardian:
107113
runs-on: ubuntu-latest
108114
needs: [pytester, testing-imports]

0 commit comments

Comments
 (0)