Skip to content

Commit 2ff0711

Browse files
committed
Always use run_tpu_tests label to run the TPU tests.
Problem: the current approach creates two entries for TPU tests: one for `pull_request` and one for `pull_request_review`. But we only want one entry and one run of the tests. Solution: add a new labeler workflow to label the PR on approval, which in turn triggers the TPU tests. Also rename `welcome` workflow.
1 parent 7631c1a commit 2ff0711

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

.github/workflows/labeler.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ permissions:
3131
pull-requests: write
3232

3333
jobs:
34-
welcome:
34+
add_labels:
3535
runs-on: ubuntu-latest
3636
steps:
3737
- uses: actions/checkout@v5

.github/workflows/tpu_tests.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
name: Keras Tests
2-
3-
# TODO: Consider enabling all tests (pytest, applications, etc.) with NNX in the future
4-
# Currently only basic flow tests run with NNX enabled
1+
name: Keras TPU Tests
52

63
on:
74
push:
85
branches: [ master ]
96
pull_request:
107
types: [labeled]
11-
pull_request_review:
12-
types: [submitted]
138
release:
149
types: [created]
1510

@@ -21,12 +16,11 @@ jobs:
2116
test-in-container:
2217
name: Run tests on TPU
2318
runs-on: linux-x86-ct6e-44-1tpu
24-
# Only run on approved PRs, pushes to master, releases or "run_tpu_tests" labels
19+
# Only run on pushes to master, releases or "run_tpu_tests" labels
2520
if: |
2621
github.event_name == 'push' ||
2722
github.event_name == 'release' ||
28-
(github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'run_tpu_tests') ||
29-
(github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
23+
(github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'run_tpu_tests')
3024
3125
strategy:
3226
fail-fast: false
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Labeler for TPU Tests
2+
3+
on:
4+
pull_request_review:
5+
types: [submitted]
6+
7+
permissions:
8+
contents: read
9+
issues: write
10+
pull-requests: write
11+
12+
jobs:
13+
add_run_tpu_tests_label:
14+
runs-on: ubuntu-latest
15+
16+
# Only run on "approved" reviews for the "pull_request_review" event.
17+
if: |
18+
github.event_name == 'pull_request_review' &&
19+
github.event.review.state == 'approved'
20+
21+
steps:
22+
- uses: actions/github-script@v8
23+
with:
24+
github-token: ${{ secrets.GITHUB_TOKEN }}
25+
script: |
26+
github.rest.issues.addLabels({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
issue_number: context.payload.pull_request.number,
30+
labels: ['run_tpu_tests']
31+
})

0 commit comments

Comments
 (0)