Skip to content

Commit a6a5397

Browse files
betatimogrisel
andauthored
CI Move CUDA CI to pull_request trigger (scikit-learn#29376)
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
1 parent df25e37 commit a6a5397

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

.github/workflows/cuda-gpu-ci.yml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,36 @@
11
name: CUDA GPU
2+
3+
# Only run this workflow when a Pull Request is labeled with the
4+
# 'CUDA CI' label.
25
on:
3-
workflow_dispatch:
4-
inputs:
5-
commit_hash:
6-
description: Commit hash to test
7-
required: true
6+
pull_request:
7+
types:
8+
- labeled
89

9-
permissions: read-all
10+
# In order to remove the "CUDA CI" label we need to have write permissions for PRs
11+
permissions:
12+
pull-requests: write
1013

1114
jobs:
1215
tests:
16+
if: contains(github.event.pull_request.labels.*.name, 'CUDA CI')
1317
runs-on:
1418
group: cuda-gpu-runner-group
19+
# Set this high enough so that the tests can comforatble run. We set a
20+
# timeout to make abusing this workflow less attractive.
21+
timeout-minutes: 20
1522
name: Run Array API unit tests
1623
steps:
24+
- uses: actions-ecosystem/action-remove-labels@v1
25+
with:
26+
labels: CUDA CI
1727
- uses: actions/setup-python@v5
1828
with:
1929
# XXX: The 3.12.4 release of Python on GitHub Actions is corrupted:
2030
# https://github.com/actions/setup-python/issues/886
2131
python-version: '3.12.3'
22-
- uses: actions/checkout@v4
23-
with:
24-
ref: ${{ inputs.commit_hash }}
25-
- name: PRs associated with commit
26-
run: |
27-
echo "This commit belongs to PR(s):"
28-
git ls-remote origin 'pull/*/head' | grep -F -f <(git rev-parse HEAD) | awk -F'/' '{print $3}'
32+
- name: Checkout main repository
33+
uses: actions/checkout@v4
2934
- name: Cache conda environment
3035
id: cache-conda
3136
uses: actions/cache@v4

.github/workflows/update-lock-files.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ on:
66
schedule:
77
- cron: '0 5 * * 1'
88

9-
# XXX Set the right permissions, per step??
10-
# Can we set read only at the global level here and then elevate to write for some steps?
11-
#permissions: read-all
9+
# In order to add the "CUDA CI" label we need to have write permissions for PRs
10+
permissions:
11+
pull-requests: write
1212

1313
jobs:
1414
update_lock_files:
@@ -68,7 +68,7 @@ jobs:
6868
env:
6969
GH_TOKEN: ${{ github.token }}
7070
run: |
71-
gh workflow run .github/workflows/cuda-gpu-ci.yml -f commit_hash=`git rev-parse HEAD`
71+
gh pr edit ${{steps.cpr.outputs.pull-request-number}} --add-label "CUDA CI"
7272
7373
- name: Check Pull Request
7474
if: steps.cpr.outputs.pull-request-number != ''

0 commit comments

Comments
 (0)