-
Notifications
You must be signed in to change notification settings - Fork 165
Run GPU tests only on explicit trigger #3200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JoshuaLampert
wants to merge
11
commits into
main
Choose a base branch
from
trigger-gpu-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+135
−2
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d0a3845
run AMDGPU tests only on explicit trigger
JoshuaLampert 941df9e
use same setup as TrixiParticles.jl
JoshuaLampert a2be437
Merge branch 'main' into trigger-gpu-tests
JoshuaLampert e6c335b
Merge branch 'main' into trigger-gpu-tests
JoshuaLampert 6f2fc60
Merge branch 'main' into trigger-gpu-tests
ranocha fe8ef8a
only run GPU tests when comment starts with /run_gpu_tests
JoshuaLampert 7da7f38
only users with write access can trigger
JoshuaLampert 33bdf7c
try branch from TrixiTest.jl
JoshuaLampert e4bbb3c
Merge branch 'main' into trigger-gpu-tests
JoshuaLampert da53916
also pass commit sha to buildkite
JoshuaLampert 7913d91
revert TrixiTest.jl branch test again
JoshuaLampert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| name: Trigger GPU Tests | ||
|
|
||
| # The GPU tests run on dedicated machines with actual GPUs, which are provided via | ||
| # Buildkite (see `.buildkite/pipeline.yml`). Since they are irrelevant for the vast | ||
| # majority of pull requests and the GPU machines are a scarce resource, they are not run | ||
| # automatically. Instead, they are requested explicitly by commenting `/run_gpu_tests` on | ||
| # a pull request, which is what this workflow reacts to. | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: | ||
| - created | ||
|
|
||
| permissions: | ||
| # Required to look up whether the author of the comment has write access. | ||
| contents: read | ||
| # Required to look up the head commit of the pull request. | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| trigger_buildkite: | ||
| # Only react to comments on pull requests (not on issues) that *start* with the | ||
| # command. Matching it anywhere in the comment would also trigger on comments that | ||
| # merely mention it, e.g., "Do not run /run_gpu_tests before the CPU tests are green" | ||
| # or a quote of the documentation. | ||
| # The `author_association` check is only a cheap pre-filter to avoid starting a job | ||
| # for arbitrary users; the authoritative permission check happens in the first step. | ||
| if: > | ||
| github.event.issue.pull_request && | ||
| startsWith(github.event.comment.body, '/run_gpu_tests') && | ||
| contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), | ||
| github.event.comment.author_association) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
| steps: | ||
| # A `/run_gpu_tests` comment causes the code of the pull request to be executed on | ||
| # the GPU machines, so it must be restricted to people who can be trusted to have | ||
| # reviewed that code first. We require write access to this repository, which is the | ||
| # same bar GitHub uses for approving workflow runs of forked pull requests. | ||
| # Note that `author_association` alone is not sufficient for this: it reports | ||
| # `MEMBER` for everyone in the `trixi-framework` organization, including people who | ||
| # only have read access to this repository. | ||
| # | ||
| # We also resolve the head commit of the pull request here and pass it to Buildkite | ||
| # below. Otherwise, Buildkite would resolve `refs/pull/<number>/head` only when the | ||
| # build starts, i.e., we could end up testing a commit that was pushed after the | ||
| # GPU tests had been requested - and thus different code than the one that was | ||
| # reviewed before requesting them. | ||
| - name: Check write access and resolve the head commit | ||
| id: pr | ||
| uses: actions/github-script@v9 | ||
| with: | ||
| script: | | ||
| const user = context.payload.comment.user.login; | ||
| const { data: permission } = | ||
| await github.rest.repos.getCollaboratorPermissionLevel({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| username: user | ||
| }); | ||
| // `permission` is one of "admin", "write", "read", "none", where the | ||
| // "maintain" role is mapped to "write" and "triage" is mapped to "read". | ||
| if (!["admin", "write"].includes(permission.permission)) { | ||
| core.setFailed(`@${user} does not have write access to this repository ` + | ||
| `(permission: "${permission.permission}"), so the GPU ` + | ||
| `tests are not started. Please ask a maintainer to ` + | ||
| `request them.`); | ||
| return; | ||
| } | ||
| const { data: pullRequest } = await github.rest.pulls.get({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| pull_number: context.payload.issue.number | ||
| }); | ||
| core.setOutput("sha", pullRequest.head.sha); | ||
| core.info(`Requesting GPU tests for ${pullRequest.head.sha}.`); | ||
|
|
||
| - name: Trigger Buildkite pipeline | ||
| uses: buildkite/trigger-pipeline-action@v2.5.0 | ||
| with: | ||
| buildkite_api_access_token: ${{ secrets.TRIGGER_BK_BUILD_TOKEN }} | ||
| pipeline: "julialang/trixi-dot-jl" | ||
| commit: ${{ steps.pr.outputs.sha }} | ||
| branch: "refs/pull/${{ github.event.issue.number }}/head" | ||
| # The Buildkite pipeline only builds `main` automatically, so this explicitly | ||
| # requested build has to be exempt from that branch filter. | ||
| ignore_pipeline_branch_filter: true | ||
| message: >- | ||
| GPU tests requested by @${{ github.event.comment.user.login }} | ||
| on PR #${{ github.event.issue.number }} | ||
|
ranocha marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.