-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/ci: use githubactions schema from registry
This change uses the WIP githubactions schema from `github.com/cue-tmp/jsonschema-pub/exp1/githubactions`, This enables us to remove the code that vendors the schema from the SchemaStore repository. Signed-off-by: Roger Peppe <[email protected]> Change-Id: Ib57d02be507ad08e7ad726b6c85696d662f50cec Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1201986 Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
- Loading branch information
Showing
10 changed files
with
69 additions
and
1,080 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
977 changes: 0 additions & 977 deletions
977
cue.mod/pkg/github.com/SchemaStore/schemastore/src/schemas/json/github-workflow.cue
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
cue.mod/usr/github.com/SchemaStore/schemastore/src/schemas/json/workflow.cue
This file was deleted.
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
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,7 +135,7 @@ checkoutCode: { | |
] | ||
} | ||
|
||
earlyChecks: json.#step & { | ||
earlyChecks: githubactions.#Step & { | ||
name: "Early git and code sanity checks" | ||
run: *"go run cuelang.org/go/internal/ci/[email protected]" | string | ||
} | ||
|
@@ -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,11 +285,11 @@ 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: json.#step & { | ||
workflowDispatch: githubactions.#Step & { | ||
#githubRepositoryPath: *githubRepositoryPath | string | ||
#botGitHubUserTokenSecretsKey: *botGitHubUserTokenSecretsKey | string | ||
#workflowID: string | ||
|
@@ -303,7 +303,7 @@ workflowDispatch: json.#step & { | |
|
||
name: string | ||
run: #""" | ||
\#(_curlGitHubAPI) --fail --request POST --data-binary \#(strconv.Quote(encjson.Marshal(#params))) https://api.github.com/repos/\#(#githubRepositoryPath)/actions/workflows/\#(#workflowID)/dispatches | ||
\#(_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
Oops, something went wrong.