-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/ci: update base from cue-lang/cue@bb24c7ce
With the one exception we we do: go run cuelang.org/go/internal/ci/[email protected] in the earlyChecks to side-step the fact that those checks are internal to the main CUE repo. Fixing that properly is covered by https://cuelang.org/issue/3435, which also includes more information on the root cause of this variation. In adapting to the new baseline of internal/ci/base we also: * Use the updated installGo step as a multi-step task (where go env -w is used after the install step) * Run the earlyChecks after installing Go, using the aforementioned checks package) * Name the trybot workflow, following the pattern from the main CUE repo. Signed-off-by: Paul Jolly <[email protected]> Change-Id: Id4d1b1e34b01483efaca87339e51acca31c87135 Dispatch-Trailer: {"type":"trybot","CL":1200598,"patchset":5,"ref":"refs/changes/98/1200598/5","targetBranch":"master"}
- Loading branch information
Showing
5 changed files
with
65 additions
and
91 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 |
---|---|---|
|
@@ -15,14 +15,51 @@ bashWorkflow: json.#Workflow & { | |
jobs: [string]: defaults: run: shell: "bash" | ||
} | ||
|
||
installGo: json.#step & { | ||
name: "Install Go" | ||
uses: "actions/setup-go@v5" | ||
with: { | ||
// We do our own caching in setupGoActionsCaches. | ||
cache: false | ||
"go-version": string | ||
installGo: { | ||
#setupGo: json.#step & { | ||
name: "Install Go" | ||
uses: "actions/setup-go@v5" | ||
with: { | ||
// We do our own caching in setupGoActionsCaches. | ||
cache: false | ||
"go-version": string | ||
} | ||
} | ||
|
||
// Why set GOTOOLCHAIN here? As opposed to an environment variable | ||
// elsewhere? No perfect answer to this question but here is the thinking: | ||
// | ||
// Setting the variable here localises it with the installation of Go. Doing | ||
// it elsewhere creates distance between the two steps which are | ||
// intrinsically related. And it's also hard to do: "when we use this step, | ||
// also ensure that we establish an environment variable in the job for | ||
// GOTOOLCHAIN". | ||
// | ||
// Environment variables can only be set at a workflow, job or step level. | ||
// Given we currently use a matrix strategy which varies the Go version, | ||
// that rules out using an environment variable based approach, because the | ||
// Go version is only available at runtime via GitHub actions provided | ||
// context. Whether we should instead be templating multiple workflows (i.e. | ||
// exploding the matrix ourselves) is a different question, but one that | ||
// has performance implications. | ||
// | ||
// So as clumsy as it is to use a step "template" that includes more than | ||
// one step, it's the best option available to us for now. | ||
[ | ||
#setupGo, | ||
|
||
{ | ||
json.#step & { | ||
name: "Set common go env vars" | ||
run: """ | ||
go env -w GOTOOLCHAIN=local | ||
# Dump env for good measure | ||
go env | ||
""" | ||
} | ||
}, | ||
] | ||
} | ||
|
||
checkoutCode: { | ||
|
@@ -100,44 +137,7 @@ checkoutCode: { | |
|
||
earlyChecks: json.#step & { | ||
name: "Early git and code sanity checks" | ||
run: #""" | ||
# Ensure that commit messages have a blank second line. | ||
# We know that a commit message must be longer than a single | ||
# line because each commit must be signed-off. | ||
if git log --format=%B -n 1 HEAD | sed -n '2{/^$/{q1}}'; then | ||
echo "second line of commit message must be blank" | ||
exit 1 | ||
fi | ||
# All authors, including co-authors, must have a signed-off trailer by email. | ||
# Note that trailers are in the form "Name <email>", so grab the email with sed. | ||
# For now, we require the sorted lists of author and signer emails to match. | ||
# Note that this also fails if a commit isn't signed-off at all. | ||
# | ||
# In Gerrit we already enable a form of this via https://gerrit-review.googlesource.com/Documentation/project-configuration.html#require-signed-off-by, | ||
# but it does not support co-authors nor can it be used when testing GitHub PRs. | ||
commit_authors="$( | ||
{ | ||
git log -1 --pretty='%ae' | ||
git log -1 --pretty='%(trailers:key=Co-authored-by,valueonly)' | sed -ne 's/.* <\(.*\)>/\1/p' | ||
} | sort -u | ||
)" | ||
commit_signers="$( | ||
{ | ||
git log -1 --pretty='%(trailers:key=Signed-off-by,valueonly)' | sed -ne 's/.* <\(.*\)>/\1/p' | ||
} | sort -u | ||
)" | ||
if [[ "${commit_authors}" != "${commit_signers}" ]]; then | ||
echo "Error: commit author email addresses do not match signed-off-by trailers" | ||
echo | ||
echo "Authors:" | ||
echo "${commit_authors}" | ||
echo | ||
echo "Signers:" | ||
echo "${commit_signers}" | ||
exit 1 | ||
fi | ||
"""# | ||
run: "go run cuelang.org/go/internal/ci/[email protected]" | ||
} | ||
|
||
curlGitHubAPI: { | ||
|
This file contains 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