From 4afe39fe90ef5c2c83ebfe04c7c5213a0e84fcc0 Mon Sep 17 00:00:00 2001 From: Jonathan Matthews Date: Wed, 11 Sep 2024 14:03:32 +0100 Subject: [PATCH] internal/ci: test cuelang.org when CUE tip updates 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 Change-Id: I94db1710e546ce32f46bce583b7fffd7855e5dbb Dispatch-Trailer: {"type":"trybot","CL":1201007,"patchset":1,"ref":"refs/changes/07/1201007/1","targetBranch":"master"} --- .github/workflows/tip_triggers.yaml | 3 +++ internal/ci/github/tip_triggers.cue | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tip_triggers.yaml b/.github/workflows/tip_triggers.yaml index 7b5e723e0..27c4b56b3 100644 --- a/.github/workflows/tip_triggers.yaml +++ b/.github/workflows/tip_triggers.yaml @@ -5,6 +5,7 @@ name: Triggers on push to tip push: branches: - master + - ci/test jobs: push: runs-on: ubuntu-22.04 @@ -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 tip.cuelang.org build + 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' diff --git a/internal/ci/github/tip_triggers.cue b/internal/ci/github/tip_triggers.cue index f4ec066f6..d8dfd33ec 100644 --- a/internal/ci/github/tip_triggers.cue +++ b/internal/ci/github/tip_triggers.cue @@ -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)'}}" @@ -40,6 +40,12 @@ workflows: tip_triggers: _repo.bashWorkflow & { } } }, + _repo.workflowDispatch & { + name: "Trigger tip.cuelang.org build" + #githubRepositoryPath: _repo.cuelangRepositoryPath + #botGitHubUserTokenSecretsKey: "CUECKOO_GITHUB_PAT" + #workflowID: "trybot.yaml" + }, ] } }