Skip to content

Commit 0a70e9c

Browse files
authored
revert testing setup (#575)
1 parent d038a23 commit 0a70e9c

2 files changed

Lines changed: 19 additions & 130 deletions

File tree

.github/workflows/test-gpu-pending.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/test-gpu.yml

Lines changed: 19 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,25 @@
11
name: GPU Tests
22

33
on:
4-
workflow_dispatch:
5-
issue_comment:
6-
types: [created]
74
push:
85
branches: [main]
6+
pull_request:
7+
types:
8+
- labeled
9+
- opened
10+
- synchronize
911
# Cancel the job if new commits are pushed
1012
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre
1113
concurrency:
12-
group: ${{ github.workflow }}-${{ github.event.issue.number || github.ref }}
14+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1315
cancel-in-progress: true
1416
jobs:
1517
check:
1618
runs-on: ubuntu-latest
17-
# Skip issue_comment unless it's /test-gpu on a PR
18-
if: >-
19-
github.event_name != 'issue_comment' ||
20-
(github.event.issue.pull_request && startsWith(github.event.comment.body, '/test-gpu'))
21-
outputs:
22-
head-sha: ${{ steps.get-sha.outputs.sha }}
23-
permissions:
24-
pull-requests: write
25-
statuses: write
2619
steps:
27-
- name: Check permissions
28-
if: github.event_name == 'issue_comment' || github.event_name == 'workflow_dispatch'
29-
run: |
30-
PERMISSION=$(gh api repos/${{ github.repository }}/collaborators/${{ github.actor }}/permission --jq '.permission')
31-
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "maintain" ]]; then
32-
echo "::error::Only maintainers or admins can trigger this workflow. Your permission: $PERMISSION"
33-
exit 1
34-
fi
35-
env:
36-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
38-
- name: React to comment
39-
if: github.event_name == 'issue_comment'
40-
run: |
41-
gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions -f content=rocket
42-
env:
43-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
45-
- name: Get PR head SHA
46-
id: get-sha
47-
if: github.event_name == 'issue_comment'
48-
run: |
49-
SHA=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json headRefOid -q .headRefOid)
50-
echo "sha=$SHA" >> $GITHUB_OUTPUT
51-
env:
52-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53-
54-
- name: Set pending status on PR
55-
if: github.event_name == 'issue_comment'
56-
run: |
57-
for context in "CI-Pass" "All Tests Green"; do
58-
gh api repos/${{ github.repository }}/statuses/${{ steps.get-sha.outputs.sha }} \
59-
-f state=pending \
60-
-f context="$context" \
61-
-f description="GPU tests running..." \
62-
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
63-
done
64-
env:
65-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
- uses: flying-sheep/check@v1
21+
with:
22+
success: ${{ github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'run-gpu-ci') }}
6623

6724
get-envs:
6825
runs-on: ubuntu-latest
@@ -75,7 +32,6 @@ jobs:
7532
with:
7633
filter: blob:none
7734
fetch-depth: 0
78-
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || '' }}
7935
- uses: astral-sh/setup-uv@v6
8036
with:
8137
enable-cache: false
@@ -122,7 +78,6 @@ jobs:
12278
with:
12379
fetch-depth: 0
12480
filter: blob:none
125-
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || '' }}
12681

12782
- uses: astral-sh/setup-uv@v6
12883
with:
@@ -180,7 +135,6 @@ jobs:
180135
with:
181136
fetch-depth: 0
182137
filter: blob:none
183-
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || '' }}
184138

185139
- uses: astral-sh/setup-uv@v6
186140
with:
@@ -192,78 +146,38 @@ jobs:
192146
- name: Run tests
193147
run: uvx hatch run ${{ matrix.env.name }}:run -v --color=yes
194148

149+
remove-label:
150+
name: Remove 'run-gpu-ci' Label
151+
runs-on: ubuntu-latest
152+
if: ${{ always() && github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'run-gpu-ci') }}
153+
steps:
154+
- uses: actions-ecosystem/action-remove-labels@v1
155+
with:
156+
labels: 'run-gpu-ci'
157+
github_token: ${{ secrets.GITHUB_TOKEN }}
158+
195159
stable-dev-green:
196160
name: CI-Pass
197161
if: always()
198162
needs:
199-
- check
200163
- get-envs
201164
- test-stable-dev
202165
runs-on: ubuntu-latest
203-
permissions:
204-
statuses: write
205166
steps:
206167
- uses: re-actors/alls-green@release/v1
207168
with:
208169
jobs: ${{ toJSON(needs) }}
209170

210-
- name: Set success status on PR
211-
if: success() && github.event_name == 'issue_comment'
212-
run: |
213-
gh api repos/${{ github.repository }}/statuses/${{ needs.check.outputs.head-sha }} \
214-
-f state=success \
215-
-f context="CI-Pass" \
216-
-f description="GPU tests passed" \
217-
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
218-
env:
219-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
220-
221-
- name: Set failure status on PR
222-
if: failure() && github.event_name == 'issue_comment'
223-
run: |
224-
gh api repos/${{ github.repository }}/statuses/${{ needs.check.outputs.head-sha }} \
225-
-f state=failure \
226-
-f context="CI-Pass" \
227-
-f description="GPU tests failed" \
228-
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
229-
env:
230-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
231-
232171
all-green:
233172
name: All Tests Green
234173
if: always()
235174
needs:
236-
- check
237175
- get-envs
238176
- test-stable-dev
239177
- test-prerelease
240178
runs-on: ubuntu-latest
241-
permissions:
242-
statuses: write
243179
steps:
244180
- uses: re-actors/alls-green@release/v1
245181
with:
246182
allowed-failures: test-prerelease
247183
jobs: ${{ toJSON(needs) }}
248-
249-
- name: Set success status on PR
250-
if: success() && github.event_name == 'issue_comment'
251-
run: |
252-
gh api repos/${{ github.repository }}/statuses/${{ needs.check.outputs.head-sha }} \
253-
-f state=success \
254-
-f context="All Tests Green" \
255-
-f description="All GPU tests passed" \
256-
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
257-
env:
258-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
259-
260-
- name: Set failure status on PR
261-
if: failure() && github.event_name == 'issue_comment'
262-
run: |
263-
gh api repos/${{ github.repository }}/statuses/${{ needs.check.outputs.head-sha }} \
264-
-f state=failure \
265-
-f context="All Tests Green" \
266-
-f description="GPU tests failed" \
267-
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
268-
env:
269-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)