Skip to content

Commit

Permalink
internal/ci: use unity and cuelang.org config from core
Browse files Browse the repository at this point in the history
This also includes some tidy up in base.

This change should not result in any .github/workflows changes.

Signed-off-by: Paul Jolly <paul@myitcv.io>
Change-Id: I22320295c62b4aa1105480b46d1dcfba6b1e2d59
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/551598
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
  • Loading branch information
myitcv committed Mar 26, 2023
1 parent 1195b3d commit 4cbb563
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 24 deletions.
17 changes: 4 additions & 13 deletions internal/ci/base/github.cue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package base

import (
encjson "encoding/json"
"path"
"strings"
"strconv"

Expand Down Expand Up @@ -198,22 +197,14 @@ checkGitClean: json.#step & {
run: "test -z \"$(git status --porcelain)\" || (git status; git diff; false)"
}

let _#repositoryURL = githubRepositoryURL
let _#botGitHubUser = botGitHubUser
let _#botGitHubUserTokenSecretsKey = botGitHubUserTokenSecretsKey

repositoryDispatch: json.#step & {
#repositoryURL: *_#repositoryURL | string
#botGitHubUser: *_#botGitHubUser | string
#botGitHubUserTokenSecretsKey: *_#botGitHubUserTokenSecretsKey | string
#githubRepositoryPath: *githubRepositoryPath | string
#botGitHubUser: *botGitHubUser | string
#botGitHubUserTokenSecretsKey: *botGitHubUserTokenSecretsKey | string
#arg: _

// Pending a nicer fix in cuelang.org/issue/1433
let _#repositoryURLNoScheme = strings.Split(#repositoryURL, "//")[1]
let _#repositoryPath = path.Base(path.Dir(_#repositoryURLNoScheme)) + "/" + path.Base(_#repositoryURLNoScheme)

name: string
run: #"""
\#(curlGitHubAPI) -f --request POST --data-binary \#(strconv.Quote(encjson.Marshal(#arg))) https://api.github.com/repos/\#(_#repositoryPath)/dispatches
\#(curlGitHubAPI) -f --request POST --data-binary \#(strconv.Quote(encjson.Marshal(#arg))) https://api.github.com/repos/\#(#githubRepositoryPath)/dispatches
"""#
}
6 changes: 5 additions & 1 deletion internal/ci/core/core.cue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import (
base

githubRepositoryPath: "cue-lang/cue"
unityRepositoryURL: "https://github.com/cue-unity/unity"

unityRepositoryPath: "cue-unity/unity"
unityRepositoryURL: "https://github.com/" + unityRepositoryPath

cuelangRepositoryPath: "cue-lang/cuelang.org"

defaultBranch: _
releaseBranchPrefix: "release-branch."
Expand Down
12 changes: 6 additions & 6 deletions internal/ci/github/release.cue
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@ workflows: release: core.bashWorkflow & {
"working-directory": "./internal/ci/goreleaser"
},
core.repositoryDispatch & {
name: "Re-test cuelang.org"
if: core.isReleaseTag
#repositoryURL: "https://github.com/cue-lang/cuelang.org"
name: "Re-test cuelang.org"
if: core.isReleaseTag
#githubRepositoryPath: core.cuelangRepositoryPath
#arg: {
event_type: "Re-test post release of \(_cueVersionRef)"
}
},
core.repositoryDispatch & {
name: "Trigger unity build"
if: core.isReleaseTag
#repositoryURL: core.unityRepositoryURL
name: "Trigger unity build"
if: core.isReleaseTag
#githubRepositoryPath: core.unityRepositoryPath
#arg: {
event_type: "Check against CUE \(_cueVersionRef)"
client_payload: {
Expand Down
8 changes: 4 additions & 4 deletions internal/ci/github/tip_triggers.cue
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ workflows: tip_triggers: core.bashWorkflow & {
if: "${{github.repository == '\(core.githubRepositoryPath)'}}"
steps: [
core.repositoryDispatch & {
name: "Trigger tip.cuelang.org deploy"
#repositoryURL: "https://github.com/cue-lang/cuelang.org"
name: "Trigger tip.cuelang.org deploy"
#githubRepositoryPath: core.cuelangRepositoryPath
#arg: {
event_type: "Rebuild tip against ${GITHUB_SHA}"
client_payload: {
Expand All @@ -39,8 +39,8 @@ workflows: tip_triggers: core.bashWorkflow & {
}
},
core.repositoryDispatch & {
name: "Trigger unity build"
#repositoryURL: "https://github.com/cue-unity/unity"
name: "Trigger unity build"
#githubRepositoryPath: core.unityRepositoryPath
#arg: {
event_type: "Check against ${GITHUB_SHA}"
client_payload: {
Expand Down

0 comments on commit 4cbb563

Please sign in to comment.