Skip to content

Commit

Permalink
internal/ci: test cuelang.org when CUE tip updates
Browse files Browse the repository at this point in the history
This triggers the cue-lang/cuelang.org trybot workflow when new commits
reach the default branch of cue-lang/cue.

This has the effect of testing the cuelang.org site build against the
(just updated) tip of cue-lang/cue, as that's one of the final things
that the cuelang.org trybot checks.

The tip_triggers workflow is used to achieve this. Its execution
conditions are modified slightly, so that its set of triggers are
invoked not only on new commits to the default branch, but also on new
commits to the default branch's designated test branch, "ci/test".
This is done to allow the new workflow dispatch to be tested ahead of CL
submission, but will also end up invoking the existing repo dispatch
trigger. This additional invocation is believed not to be problematic.

Signed-off-by: Jonathan Matthews <[email protected]>
Change-Id: I94db1710e546ce32f46bce583b7fffd7855e5dbb
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1201007
Reviewed-by: Paul Jolly <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
  • Loading branch information
jpluscplusm authored and myitcv committed Sep 12, 2024
1 parent ef83860 commit a558a4b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/tip_triggers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name: Triggers on push to tip
push:
branches:
- master
- ci/test
jobs:
push:
runs-on: ubuntu-22.04
Expand All @@ -15,3 +16,5 @@ jobs:
steps:
- name: Trigger unity build
run: 'curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.PORCUEPINE_GITHUB_PAT }}" -H "X-GitHub-Api-Version: 2022-11-28" --fail --request POST --data-binary "{\"event_type\":\"Check against ${GITHUB_SHA}\",\"client_payload\":{\"type\":\"unity\",\"payload\":{\"versions\":\"\\\"commit:${GITHUB_SHA}\\\"\"}}}" https://api.github.com/repos/cue-unity/unity-private/dispatches'
- name: Trigger cuelang.org trybot
run: 'curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.CUECKOO_GITHUB_PAT }}" -H "X-GitHub-Api-Version: 2022-11-28" --fail --request POST --data-binary "{\"ref\":\"master\"}" https://api.github.com/repos/cue-lang/cuelang.org/actions/workflows/trybot.yaml/dispatches'
16 changes: 14 additions & 2 deletions internal/ci/github/tip_triggers.cue
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
package github

// The tip_triggers workflow. This fires for each new commit that hits the
// default branch.
// default branch or the default branch's test branch.
workflows: tip_triggers: _repo.bashWorkflow & {

name: "Triggers on push to tip"
on: push: branches: [_repo.defaultBranch]
on: push: branches: [_repo.defaultBranch, _repo.testDefaultBranch]
jobs: push: {
"runs-on": _repo.linuxMachine
if: "${{github.repository == '\(_repo.githubRepositoryPath)'}}"
Expand All @@ -40,6 +40,18 @@ workflows: tip_triggers: _repo.bashWorkflow & {
}
}
},
// This triggers the cuelang.org trybot, which finishes by testing that
// the site builds successfully against the tip of cue-lang/cue.
// The specific commit that triggered this workflow (inside tip_triggers)
// isn't used by the cuelang.org build unless it also happens to be the
// tip of cue-lang/cue, therefore there's no dispatch payload/etc that
// communicates the commit ref.
_repo.workflowDispatch & {
name: "Trigger cuelang.org trybot"
#githubRepositoryPath: _repo.cuelangRepositoryPath
#botGitHubUserTokenSecretsKey: "CUECKOO_GITHUB_PAT"
#workflowID: "trybot.yaml"
},
]
}
}

0 comments on commit a558a4b

Please sign in to comment.