-
Notifications
You must be signed in to change notification settings - Fork 9
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@82995bbb
This moves us to use the Central Registry (temporary namespace) definitions for GitHub Actions. We also copy the current pattern for "authenticating" a step that requires access to the Central Registry. Not the cleanest of patterns, but changing that does not belong in this CL. Signed-off-by: Paul Jolly <[email protected]> Change-Id: I00b42fabdbec6dee8608974e86122724dce2fa9d Reviewed-on: https://review.gerrithub.io/c/cue-lang/vscode-cue/+/1200740 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
- Loading branch information
Showing
14 changed files
with
123 additions
and
108 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
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
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,10 @@ | ||
module: "github.com/cue-lang/vscode-cue" | ||
language: { | ||
version: "v0.10.0" | ||
version: "v0.8.0" | ||
} | ||
deps: { | ||
"github.com/cue-tmp/jsonschema-pub/exp1/githubactions@v0": { | ||
v: "v0.4.0" | ||
default: true | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,20 +3,20 @@ package base | |
// This file contains aspects principally related to GitHub workflows | ||
|
||
import ( | ||
encjson "encoding/json" | ||
"encoding/json" | ||
"list" | ||
"strings" | ||
"strconv" | ||
|
||
"github.com/SchemaStore/schemastore/src/schemas/json" | ||
"github.com/cue-tmp/jsonschema-pub/exp1/githubactions" | ||
) | ||
|
||
bashWorkflow: json.#Workflow & { | ||
bashWorkflow: githubactions.#Workflow & { | ||
jobs: [string]: defaults: run: shell: "bash" | ||
} | ||
|
||
installGo: { | ||
#setupGo: json.#step & { | ||
#setupGo: githubactions.#Step & { | ||
name: "Install Go" | ||
uses: "actions/setup-go@v5" | ||
with: { | ||
|
@@ -49,7 +49,7 @@ installGo: { | |
#setupGo, | ||
|
||
{ | ||
json.#step & { | ||
githubactions.#Step & { | ||
name: "Set common go env vars" | ||
run: """ | ||
go env -w GOTOOLCHAIN=local | ||
|
@@ -63,7 +63,7 @@ installGo: { | |
} | ||
|
||
checkoutCode: { | ||
#actionsCheckout: json.#step & { | ||
#actionsCheckout: githubactions.#Step & { | ||
name: "Checkout code" | ||
uses: "actions/checkout@v4" | ||
|
||
|
@@ -90,17 +90,17 @@ checkoutCode: { | |
// per the bug report at https://github.com/MestreLion/git-tools/issues/47, | ||
// so we first reset all directory timestamps to a static time as a fallback. | ||
// TODO(mvdan): May be unnecessary once the Go bug above is fixed. | ||
json.#step & { | ||
githubactions.#Step & { | ||
name: "Reset git directory modification times" | ||
run: "touch -t 202211302355 $(find * -type d)" | ||
}, | ||
json.#step & { | ||
githubactions.#Step & { | ||
name: "Restore git file modification times" | ||
uses: "chetan/git-restore-mtime-action@075f9bc9d159805603419d50f794bd9f33252ebe" | ||
}, | ||
|
||
{ | ||
json.#step & { | ||
githubactions.#Step & { | ||
name: "Try to extract \(dispatchTrailer)" | ||
id: dispatchTrailerStepID | ||
run: """ | ||
|
@@ -124,7 +124,7 @@ checkoutCode: { | |
|
||
// Safety nets to flag if we ever have a Dispatch-Trailer slip through the | ||
// net and make it to master | ||
json.#step & { | ||
githubactions.#Step & { | ||
name: "Check we don't have \(dispatchTrailer) on a protected branch" | ||
if: "\(isProtectedBranch) && \(containsDispatchTrailer)" | ||
run: """ | ||
|
@@ -135,9 +135,9 @@ checkoutCode: { | |
] | ||
} | ||
|
||
earlyChecks: json.#step & { | ||
earlyChecks: githubactions.#Step & { | ||
name: "Early git and code sanity checks" | ||
run: "go run cuelang.org/go/internal/ci/[email protected]" | ||
run: *"go run cuelang.org/go/internal/ci/[email protected]" | string | ||
} | ||
|
||
curlGitHubAPI: { | ||
|
@@ -177,7 +177,7 @@ setupGoActionsCaches: { | |
|
||
let cacheRestoreKeys = "\(#os)-\(#goVersion)" | ||
|
||
let cacheStep = json.#step & { | ||
let cacheStep = githubactions.#Step & { | ||
with: { | ||
path: strings.Join(cacheDirs, "\n") | ||
|
||
|
@@ -197,12 +197,12 @@ setupGoActionsCaches: { | |
[ | ||
// TODO: once https://github.com/actions/setup-go/issues/54 is fixed, | ||
// we could use `go env` outputs from the setup-go step. | ||
json.#step & { | ||
githubactions.#Step & { | ||
name: "Get go mod cache directory" | ||
id: goModCacheDirID | ||
run: #"echo "dir=$(go env GOMODCACHE)" >> ${GITHUB_OUTPUT}"# | ||
}, | ||
json.#step & { | ||
githubactions.#Step & { | ||
name: "Get go build/test cache directory" | ||
id: goCacheDirID | ||
run: #"echo "dir=$(go env GOCACHE)" >> ${GITHUB_OUTPUT}"# | ||
|
@@ -240,7 +240,7 @@ setupGoActionsCaches: { | |
// | ||
// Critically we only want to do this in the main repo, not the trybot | ||
// repo. | ||
json.#step & { | ||
githubactions.#Step & { | ||
if: "github.repository == '\(githubRepositoryPath)' && (\(isProtectedBranch) || github.ref == 'refs/heads/\(testDefaultBranch)')" | ||
run: "go clean -testcache" | ||
} | ||
|
@@ -270,13 +270,13 @@ isReleaseTag: { | |
(_matchPattern & {variable: "github.ref", pattern: "refs/tags/\(releaseTagPattern)"}).expr | ||
} | ||
|
||
checkGitClean: json.#step & { | ||
checkGitClean: githubactions.#Step & { | ||
name: "Check that git is clean at the end of the job" | ||
if: "always()" | ||
run: "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" | ||
} | ||
|
||
repositoryDispatch: json.#step & { | ||
repositoryDispatch: githubactions.#Step & { | ||
#githubRepositoryPath: *githubRepositoryPath | string | ||
#botGitHubUserTokenSecretsKey: *botGitHubUserTokenSecretsKey | string | ||
#arg: _ | ||
|
@@ -285,7 +285,25 @@ repositoryDispatch: json.#step & { | |
|
||
name: string | ||
run: #""" | ||
\#(_curlGitHubAPI) --fail --request POST --data-binary \#(strconv.Quote(encjson.Marshal(#arg))) https://api.github.com/repos/\#(#githubRepositoryPath)/dispatches | ||
\#(_curlGitHubAPI) --fail --request POST --data-binary \#(strconv.Quote(json.Marshal(#arg))) https://api.github.com/repos/\#(#githubRepositoryPath)/dispatches | ||
"""# | ||
} | ||
|
||
workflowDispatch: githubactions.#Step & { | ||
#githubRepositoryPath: *githubRepositoryPath | string | ||
#botGitHubUserTokenSecretsKey: *botGitHubUserTokenSecretsKey | string | ||
#workflowID: string | ||
|
||
// params are defined per https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event | ||
#params: *{ | ||
ref: defaultBranch | ||
} | _ | ||
|
||
_curlGitHubAPI: curlGitHubAPI & {#tokenSecretsKey: #botGitHubUserTokenSecretsKey, _} | ||
|
||
name: string | ||
run: #""" | ||
\#(_curlGitHubAPI) --fail --request POST --data-binary \#(strconv.Quote(json.Marshal(#params))) https://api.github.com/repos/\#(#githubRepositoryPath)/actions/workflows/\#(#workflowID)/dispatches | ||
"""# | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -14,5 +14,4 @@ | |
|
||
package ci | ||
|
||
//go:generate cue cmd importjsonschema ./vendor | ||
//go:generate cue cmd gen |
Oops, something went wrong.