-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/ci: re-baseline base from cue-lang/cue@2d329b54
Includes: * Use CUE v0.10.0 in go:generate steps (we need a better way of driving this). * Define language.version in the repo's CUE module. * Changes to use new multi-step installGo. * Use go1.23.x as the Go version for the repo. Signed-off-by: Paul Jolly <[email protected]> Change-Id: Icbd05ac770aaf6b49ab400cf9654a1ef7d02e0e1 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue-api-java/+/1200743 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
- Loading branch information
Showing
12 changed files
with
232 additions
and
245 deletions.
There are no files selected for viewing
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
File renamed without changes.
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 |
---|---|---|
|
@@ -66,6 +66,12 @@ jobs: | |
with: | ||
cache: false | ||
go-version: ${{ matrix.go-version }} | ||
- name: Set common go env vars | ||
run: |- | ||
go env -w GOTOOLCHAIN=local | ||
# Dump env for good measure | ||
go env | ||
- name: Install Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
|
@@ -113,43 +119,7 @@ jobs: | |
cp libcue.so cue.dll | ||
working-directory: libcue | ||
- 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] | ||
- name: Test | ||
run: mvn clean install package | ||
env: | ||
|
File renamed without changes.
293 changes: 149 additions & 144 deletions
293
cue.mod/pkg/github.com/SchemaStore/schemastore/src/schemas/json/github-workflow.cue
Large diffs are not rendered by default.
Oops, something went wrong.
15 changes: 13 additions & 2 deletions
15
cue.mod/usr/github.com/SchemaStore/schemastore/src/schemas/json/workflow.cue
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 |
---|---|---|
@@ -1,4 +1,15 @@ | ||
package json | ||
|
||
#job: ((#Workflow & {}).jobs & {x: _}).x | ||
#step: ((#job & {steps: _}).steps & [_])[0] | ||
#job: ((#Workflow & {jobs: _}).jobs & {x: _}).x | ||
#step: ((#job & {steps: _}).steps & [_])[0] | ||
|
||
// CUE does not properly encode a JSON Schema oneOf; see | ||
// https://cuelang.org/issue/3165. For now, apply a temporary workaround which | ||
// forces the other option to bottom. | ||
#Workflow: jobs?: [string]: steps?: [...( | ||
{ | ||
uses?: _|_ | ||
} | { | ||
run?: _|_ | ||
}), | ||
] |
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]" | string | ||
} | ||
|
||
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
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