github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/cue/testdata/eval/github.txtar (about) 1 #noformat 2 3 # A txtar test version of evaluation phase of the process behind our 4 # CI workflow generation. 5 # 6 # Note: all the non-golden files below are updated automatically by 7 # the internal/ci updateTxtarTests CUE command (with the exception 8 # of the cue.mod/module.cue file). 9 10 -- workflows.cue -- 11 package ci 12 13 import ( 14 "github.com/SchemaStore/schemastore/src/schemas/json" 15 "strconv" 16 encjson "encoding/json" 17 ) 18 19 workflowsDir: *"./" | string @tag(workflowsDir) 20 _#masterBranch: "master" 21 _#releaseTagPattern: "v*" 22 workflows: [...{ 23 file: string 24 schema: json.#Workflow 25 }] & [{ 26 file: "test.yml" 27 schema: test 28 }, { 29 file: "repository_dispatch.yml" 30 schema: repository_dispatch 31 }, { 32 file: "release.yml" 33 schema: release 34 }, { 35 file: "tip_triggers.yml" 36 schema: tip_triggers 37 }] 38 test: _#bashWorkflow & { 39 name: "Test" 40 on: { 41 push: { 42 branches: ["**"] 43 "tags-ignore": [_#releaseTagPattern] 44 } 45 pull_request: {} 46 } 47 jobs: { 48 start: { 49 "runs-on": _#linuxMachine 50 steps: [..._ & { 51 if: "${{ \(_#isCLCITestBranch) }}" 52 }] & [_#writeNetrcFile, _#startCLBuild] 53 } 54 test: { 55 needs: "start" 56 strategy: _#testStrategy 57 "runs-on": "${{ matrix.os }}" 58 steps: [_#writeNetrcFile, _#installGo, _#checkoutCode, _#cacheGoModules, _#setGoBuildTags & { 59 _#tags: "long" 60 if: "${{ \(_#isMaster) }}" 61 }, _#goGenerate, _#goTest, _#goTestRace & { 62 if: "${{ matrix.go-version == '\(_#latestStableGo)' && matrix.os == '\(_#linuxMachine)' }}" 63 }, _#goReleaseCheck, _#checkGitClean, _#pullThroughProxy, _#failCLBuild] 64 } 65 mark_ci_success: { 66 "runs-on": _#linuxMachine 67 if: "${{ \(_#isCLCITestBranch) }}" 68 needs: "test" 69 steps: [_#writeNetrcFile, _#passCLBuild] 70 } 71 delete_build_branch: { 72 "runs-on": _#linuxMachine 73 if: "${{ \(_#isCLCITestBranch) && always() }}" 74 needs: "test" 75 steps: [_#step & { 76 run: """ 77 \(_#tempCueckooGitDir) 78 git push https://github.com/cue-lang/cue :${GITHUB_REF#\(_#branchRefPrefix)} 79 """ 80 }] 81 } 82 } 83 84 // _#isCLCITestBranch is an expression that evaluates to true 85 // if the job is running as a result of a CL triggered CI build 86 _#isCLCITestBranch: "startsWith(github.ref, '\(_#branchRefPrefix)ci/')" 87 88 // _#isMaster is an expression that evaluates to true if the 89 // job is running as a result of a master commit push 90 _#isMaster: "github.ref == '\(_#branchRefPrefix+_#masterBranch)'" 91 _#pullThroughProxy: _#step & { 92 name: "Pull this commit through the proxy on \(_#masterBranch)" 93 run: """ 94 v=$(git rev-parse HEAD) 95 cd $(mktemp -d) 96 go mod init mod.com 97 GOPROXY=https://proxy.golang.org go get -d github.com/joomcode/cue/cmd/cue@$v 98 """ 99 if: "${{ \(_#isMaster) }}" 100 } 101 _#startCLBuild: _#step & { 102 name: "Update Gerrit CL message with starting message" 103 run: (_#gerrit._#setCodeReview & { 104 #args: { 105 message: "Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}" 106 } 107 }).res 108 } 109 _#failCLBuild: _#step & { 110 if: "${{ \(_#isCLCITestBranch) && failure() }}" 111 name: "Post any failures for this matrix entry" 112 run: (_#gerrit._#setCodeReview & { 113 #args: { 114 message: "Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details" 115 labels: "TryBot-Result": -1 116 } 117 }).res 118 } 119 _#passCLBuild: _#step & { 120 name: "Update Gerrit CL message with success message" 121 run: (_#gerrit._#setCodeReview & { 122 #args: { 123 message: "Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}" 124 labels: "TryBot-Result": 1 125 } 126 }).res 127 } 128 _#gerrit: { 129 // _#setCodeReview assumes that it is invoked from a job where 130 // _#isCLCITestBranch is true 131 _#setCodeReview: { 132 #args: { 133 tag: "trybot" 134 message: string 135 labels?: "TryBot-Result": int 136 } 137 res: "\(_#curl) -n -H \"Content-Type: application/json\" --request POST --data \(strconv.Quote(encjson.Marshal(#args))) https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" 138 } 139 } 140 } 141 repository_dispatch: _#bashWorkflow & { 142 // These constants are defined by github.com/cue-sh/tools/cmd/cueckoo 143 _#runtrybot: "runtrybot" 144 _#unity: "unity" 145 _#dispatchJob: _#job & { 146 _#type: string 147 "runs-on": _#linuxMachine 148 if: "${{ github.event.client_payload.type == '\(_#type)' }}" 149 } 150 name: "Repository Dispatch" 151 on: ["repository_dispatch"] 152 jobs: "\(_#runtrybot)": _#dispatchJob & { 153 _#type: _#runtrybot 154 steps: [_#writeNetrcFile, _#step & { 155 name: "Trigger trybot" 156 run: """ 157 \(_#tempCueckooGitDir) 158 git fetch https://review.gerrithub.io/a/cue-lang/cue ${{ github.event.client_payload.payload.ref }} 159 git checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD 160 git push https://github.com/cue-lang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} 161 """ 162 }] 163 } 164 } 165 release: _#bashWorkflow & { 166 name: "Release" 167 on: push: tags: [_#releaseTagPattern] 168 jobs: goreleaser: { 169 "runs-on": _#linuxMachine 170 steps: [_#checkoutCode & { 171 with: "fetch-depth": 0 172 }, _#installGo & { 173 with: "go-version": _#pinnedReleaseGo 174 }, _#step & { 175 name: "Setup qemu" 176 uses: "docker/setup-qemu-action@v1" 177 }, _#step & { 178 name: "Set up Docker Buildx" 179 uses: "docker/setup-buildx-action@v1" 180 }, _#step & { 181 name: "Docker Login" 182 uses: "docker/login-action@v1" 183 with: { 184 registry: "docker.io" 185 username: "cueckoo" 186 password: "${{ secrets.CUECKOO_DOCKER_PAT }}" 187 } 188 }, _#step & { 189 name: "Run GoReleaser" 190 env: GITHUB_TOKEN: "${{ secrets.CUECKOO_GITHUB_PAT }}" 191 uses: "goreleaser/goreleaser-action@v2" 192 with: { 193 args: "release --rm-dist" 194 version: "v1.8.2" 195 } 196 }, _#step & { 197 _#arg: { 198 event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}" 199 } 200 name: "Re-test cuelang.org" 201 run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(strconv.Quote(encjson.Marshal(_#arg))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches" 202 }, _#step & { 203 _#arg: { 204 event_type: "Check against CUE ${GITHUB_REF##refs/tags/}" 205 client_payload: { 206 type: "unity" 207 payload: versions: """ 208 "${GITHUB_REF##refs/tags/}" 209 """ 210 } 211 } 212 name: "Trigger unity build" 213 run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(strconv.Quote(encjson.Marshal(_#arg))) https://api.github.com/repos/cue-unity/unity/dispatches" 214 }] 215 } 216 } 217 tip_triggers: _#bashWorkflow & { 218 name: "Push to tip triggers" 219 on: push: branches: [_#masterBranch] 220 jobs: push: { 221 "runs-on": _#linuxMachine 222 steps: [{ 223 name: "Rebuild tip.cuelang.org" 224 run: "\(_#curl) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" 225 }, { 226 _#arg: { 227 event_type: "Check against ${GITHUB_SHA}" 228 client_payload: { 229 type: "unity" 230 payload: versions: """ 231 "commit:${GITHUB_SHA}" 232 """ 233 } 234 } 235 name: "Trigger unity build" 236 run: "\(_#curl) -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(strconv.Quote(encjson.Marshal(_#arg))) https://api.github.com/repos/cue-unity/unity/dispatches" 237 }] 238 } 239 } 240 _#bashWorkflow: json.#Workflow & { 241 jobs: [string]: defaults: run: shell: "bash" 242 } 243 244 // TODO: drop when cuelang.org/issue/390 is fixed. 245 // Declare definitions for sub-schemas 246 _#job: ((json.#Workflow & {}).jobs & { 247 x: _ 248 }).x 249 _#step: ((_#job & { 250 steps: _ 251 }).steps & [_])[0] 252 253 // We use the oldest supported Go version for code generation. 254 // TODO(mvdan): now that we don't use qgo via go:generate, 255 // we should try to use latestStableGo for code generation, 256 // which is closer to how developers will run go generate. 257 _#codeGenGo: "1.16.x" 258 259 // Use the latest Go version for extra checks, 260 // such as running tests with the data race detector. 261 _#latestStableGo: "1.18.x" 262 263 // Use a specific latest version for release builds. 264 // Note that we don't want ".x" for the sake of reproducibility, 265 // so we instead pin a specific Go release. 266 _#pinnedReleaseGo: "1.18.1" 267 _#linuxMachine: "ubuntu-18.04" 268 _#macosMachine: "macos-10.15" 269 _#windowsMachine: "windows-2019" 270 _#testStrategy: { 271 "fail-fast": false 272 matrix: { 273 "go-version": [_#codeGenGo, "1.17.x", _#latestStableGo] 274 os: [_#linuxMachine, _#macosMachine, _#windowsMachine] 275 } 276 } 277 _#setGoBuildTags: _#step & { 278 _#tags: string 279 name: "Set go build tags" 280 run: "go env -w GOFLAGS=-tags=\(_#tags)" 281 } 282 _#installGo: _#step & { 283 name: "Install Go" 284 uses: "actions/setup-go@v3" 285 with: "go-version": *"${{ matrix.go-version }}" | string 286 } 287 _#checkoutCode: _#step & { 288 name: "Checkout code" 289 uses: "actions/checkout@v3" 290 } 291 _#cacheGoModules: _#step & { 292 name: "Cache Go modules" 293 uses: "actions/cache@v3" 294 with: { 295 path: "~/go/pkg/mod" 296 key: "${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}" 297 "restore-keys": """ 298 ${{ runner.os }}-${{ matrix.go-version }}-go- 299 """ 300 } 301 } 302 _#goGenerate: _#step & { 303 name: "Generate" 304 run: "go generate ./..." 305 // The Go version corresponds to the precise version specified in 306 // the matrix. Skip windows for now until we work out why re-gen is flaky 307 if: "matrix.go-version == '\(_#codeGenGo)' && matrix.os == '\(_#linuxMachine)'" 308 } 309 _#goTest: _#step & { 310 name: "Test" 311 run: "go test ./..." 312 } 313 _#goTestRace: _#step & { 314 name: "Test with -race" 315 run: "go test -race ./..." 316 } 317 _#goReleaseCheck: _#step & { 318 name: "gorelease check" 319 run: "go run golang.org/x/exp/cmd/gorelease" 320 } 321 _#checkGitClean: _#step & { 322 name: "Check that git is clean post generate and tests" 323 run: "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" 324 } 325 _#writeNetrcFile: _#step & { 326 name: "Write netrc file for cueckoo Gerrithub" 327 run: """ 328 cat <<EOD > ~/.netrc 329 machine review.gerrithub.io 330 login cueckoo 331 password ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }} 332 EOD 333 chmod 600 ~/.netrc 334 """ 335 } 336 _#branchRefPrefix: "refs/heads/" 337 _#tempCueckooGitDir: """ 338 mkdir tmpgit 339 cd tmpgit 340 git init 341 git config user.name cueckoo 342 git config user.email cueckoo@gmail.com 343 git config http.https://github.com/.extraheader "AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)" 344 """ 345 _#curl: "curl -f -s" 346 -- cue.mod/module.cue -- 347 module: "mod.com" 348 -- cue.mod/pkg/github.com/SchemaStore/schemastore/src/schemas/json/github-workflow.cue -- 349 package json 350 351 import "strings" 352 353 #Workflow: { 354 @jsonschema(schema="http://json-schema.org/draft-07/schema") 355 null | bool | number | string | [...] | { 356 // The name of your workflow. GitHub displays the names of your 357 // workflows on your repository's actions page. If you omit this 358 // field, GitHub sets the name to the workflow's filename. 359 name?: string 360 361 // The name of the GitHub event that triggers the workflow. You 362 // can provide a single event string, array of events, array of 363 // event types, or an event configuration map that schedules a 364 // workflow or restricts the execution of a workflow to specific 365 // files, tags, or branch changes. For a list of available 366 // events, see 367 // https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows. 368 on: #event | [...#event] & [_, ...] | { 369 // Runs your workflow anytime the check_run event occurs. More 370 // than one activity type triggers this event. For information 371 // about the REST API, see 372 // https://developer.github.com/v3/checks/runs. 373 check_run?: #eventObject & { 374 types?: #types & [..."created" | "rerequested" | "completed" | "requested_action"] | *["created", "rerequested", "completed", "requested_action"] 375 ... 376 } 377 378 // Runs your workflow anytime the check_suite event occurs. More 379 // than one activity type triggers this event. For information 380 // about the REST API, see 381 // https://developer.github.com/v3/checks/suites/. 382 check_suite?: #eventObject & { 383 types?: #types & [..."completed" | "requested" | "rerequested"] | *["completed", "requested", "rerequested"] 384 ... 385 } 386 387 // Runs your workflow anytime someone creates a branch or tag, 388 // which triggers the create event. For information about the 389 // REST API, see 390 // https://developer.github.com/v3/git/refs/#create-a-reference. 391 create?: #eventObject 392 393 // Runs your workflow anytime someone deletes a branch or tag, 394 // which triggers the delete event. For information about the 395 // REST API, see 396 // https://developer.github.com/v3/git/refs/#delete-a-reference. 397 delete?: #eventObject 398 399 // Runs your workflow anytime someone creates a deployment, which 400 // triggers the deployment event. Deployments created with a 401 // commit SHA may not have a Git ref. For information about the 402 // REST API, see 403 // https://developer.github.com/v3/repos/deployments/. 404 deployment?: #eventObject 405 406 // Runs your workflow anytime a third party provides a deployment 407 // status, which triggers the deployment_status event. 408 // Deployments created with a commit SHA may not have a Git ref. 409 // For information about the REST API, see 410 // https://developer.github.com/v3/repos/deployments/#create-a-deployment-status. 411 deployment_status?: #eventObject 412 413 // Runs your workflow anytime when someone forks a repository, 414 // which triggers the fork event. For information about the REST 415 // API, see 416 // https://developer.github.com/v3/repos/forks/#create-a-fork. 417 fork?: #eventObject 418 419 // Runs your workflow when someone creates or updates a Wiki page, 420 // which triggers the gollum event. 421 gollum?: #eventObject 422 423 // Runs your workflow anytime the issue_comment event occurs. More 424 // than one activity type triggers this event. For information 425 // about the REST API, see 426 // https://developer.github.com/v3/issues/comments/. 427 issue_comment?: #eventObject & { 428 types?: #types & [..."created" | "edited" | "deleted"] | *["created", "edited", "deleted"] 429 ... 430 } 431 432 // Runs your workflow anytime the issues event occurs. More than 433 // one activity type triggers this event. For information about 434 // the REST API, see https://developer.github.com/v3/issues. 435 issues?: #eventObject & { 436 types?: #types & [..."opened" | "edited" | "deleted" | "transferred" | "pinned" | "unpinned" | "closed" | "reopened" | "assigned" | "unassigned" | "labeled" | "unlabeled" | "locked" | "unlocked" | "milestoned" | "demilestoned"] | *["opened", "edited", "deleted", "transferred", "pinned", "unpinned", "closed", "reopened", "assigned", "unassigned", "labeled", "unlabeled", "locked", "unlocked", "milestoned", "demilestoned"] 437 ... 438 } 439 440 // Runs your workflow anytime the label event occurs. More than 441 // one activity type triggers this event. For information about 442 // the REST API, see 443 // https://developer.github.com/v3/issues/labels/. 444 label?: #eventObject & { 445 types?: #types & [..."created" | "edited" | "deleted"] | *["created", "edited", "deleted"] 446 ... 447 } 448 449 // Runs your workflow anytime the member event occurs. More than 450 // one activity type triggers this event. For information about 451 // the REST API, see 452 // https://developer.github.com/v3/repos/collaborators/. 453 member?: #eventObject & { 454 types?: #types & [..."added" | "edited" | "deleted"] | *["added", "edited", "deleted"] 455 ... 456 } 457 458 // Runs your workflow anytime the milestone event occurs. More 459 // than one activity type triggers this event. For information 460 // about the REST API, see 461 // https://developer.github.com/v3/issues/milestones/. 462 milestone?: #eventObject & { 463 types?: #types & [..."created" | "closed" | "opened" | "edited" | "deleted"] | *["created", "closed", "opened", "edited", "deleted"] 464 ... 465 } 466 467 // Runs your workflow anytime someone pushes to a GitHub 468 // Pages-enabled branch, which triggers the page_build event. For 469 // information about the REST API, see 470 // https://developer.github.com/v3/repos/pages/. 471 page_build?: #eventObject 472 473 // Runs your workflow anytime the project event occurs. More than 474 // one activity type triggers this event. For information about 475 // the REST API, see https://developer.github.com/v3/projects/. 476 project?: #eventObject & { 477 types?: #types & [..."created" | "updated" | "closed" | "reopened" | "edited" | "deleted"] | *["created", "updated", "closed", "reopened", "edited", "deleted"] 478 ... 479 } 480 481 // Runs your workflow anytime the project_card event occurs. More 482 // than one activity type triggers this event. For information 483 // about the REST API, see 484 // https://developer.github.com/v3/projects/cards. 485 project_card?: #eventObject & { 486 types?: #types & [..."created" | "moved" | "converted" | "edited" | "deleted"] | *["created", "moved", "converted", "edited", "deleted"] 487 ... 488 } 489 490 // Runs your workflow anytime the project_column event occurs. 491 // More than one activity type triggers this event. For 492 // information about the REST API, see 493 // https://developer.github.com/v3/projects/columns. 494 project_column?: #eventObject & { 495 types?: #types & [..."created" | "updated" | "moved" | "deleted"] | *["created", "updated", "moved", "deleted"] 496 ... 497 } 498 499 // Runs your workflow anytime someone makes a private repository 500 // public, which triggers the public event. For information about 501 // the REST API, see https://developer.github.com/v3/repos/#edit. 502 public?: #eventObject 503 504 // Runs your workflow anytime the pull_request event occurs. More 505 // than one activity type triggers this event. For information 506 // about the REST API, see https://developer.github.com/v3/pulls. 507 // Note: Workflows do not run on private base repositories when 508 // you open a pull request from a forked repository. 509 // When you create a pull request from a forked repository to the 510 // base repository, GitHub sends the pull_request event to the 511 // base repository and no pull request events occur on the forked 512 // repository. 513 // Workflows don't run on forked repositories by default. You must 514 // enable GitHub Actions in the Actions tab of the forked 515 // repository. 516 // The permissions for the GITHUB_TOKEN in forked repositories is 517 // read-only. For more information about the GITHUB_TOKEN, see 518 // https://help.github.com/en/articles/virtual-environments-for-github-actions. 519 pull_request?: #ref & { 520 types?: #types & [..."assigned" | "unassigned" | "labeled" | "unlabeled" | "opened" | "edited" | "closed" | "reopened" | "synchronize" | "ready_for_review" | "locked" | "unlocked" | "review_requested" | "review_request_removed"] | *["opened", "synchronize", "reopened"] 521 522 {[=~"^(branche|tag|path)s(-ignore)?$" & !~"^(types)$"]: _} 523 } 524 525 // Runs your workflow anytime the pull_request_review event 526 // occurs. More than one activity type triggers this event. For 527 // information about the REST API, see 528 // https://developer.github.com/v3/pulls/reviews. 529 // Note: Workflows do not run on private base repositories when 530 // you open a pull request from a forked repository. 531 // When you create a pull request from a forked repository to the 532 // base repository, GitHub sends the pull_request event to the 533 // base repository and no pull request events occur on the forked 534 // repository. 535 // Workflows don't run on forked repositories by default. You must 536 // enable GitHub Actions in the Actions tab of the forked 537 // repository. 538 // The permissions for the GITHUB_TOKEN in forked repositories is 539 // read-only. For more information about the GITHUB_TOKEN, see 540 // https://help.github.com/en/articles/virtual-environments-for-github-actions. 541 pull_request_review?: #eventObject & { 542 types?: #types & [..."submitted" | "edited" | "dismissed"] | *["submitted", "edited", "dismissed"] 543 ... 544 } 545 546 // Runs your workflow anytime a comment on a pull request's 547 // unified diff is modified, which triggers the 548 // pull_request_review_comment event. More than one activity type 549 // triggers this event. For information about the REST API, see 550 // https://developer.github.com/v3/pulls/comments. 551 // Note: Workflows do not run on private base repositories when 552 // you open a pull request from a forked repository. 553 // When you create a pull request from a forked repository to the 554 // base repository, GitHub sends the pull_request event to the 555 // base repository and no pull request events occur on the forked 556 // repository. 557 // Workflows don't run on forked repositories by default. You must 558 // enable GitHub Actions in the Actions tab of the forked 559 // repository. 560 // The permissions for the GITHUB_TOKEN in forked repositories is 561 // read-only. For more information about the GITHUB_TOKEN, see 562 // https://help.github.com/en/articles/virtual-environments-for-github-actions. 563 pull_request_review_comment?: #eventObject & { 564 types?: #types & [..."created" | "edited" | "deleted"] | *["created", "edited", "deleted"] 565 ... 566 } 567 568 // This event is similar to pull_request, except that it runs in 569 // the context of the base repository of the pull request, rather 570 // than in the merge commit. This means that you can more safely 571 // make your secrets available to the workflows triggered by the 572 // pull request, because only workflows defined in the commit on 573 // the base repository are run. For example, this event allows 574 // you to create workflows that label and comment on pull 575 // requests, based on the contents of the event payload. 576 pull_request_target?: #ref & { 577 types?: #types & [..."assigned" | "unassigned" | "labeled" | "unlabeled" | "opened" | "edited" | "closed" | "reopened" | "synchronize" | "ready_for_review" | "locked" | "unlocked" | "review_requested" | "review_request_removed"] | *["opened", "synchronize", "reopened"] 578 579 {[=~"^(branche|tag|path)s(-ignore)?$" & !~"^(types)$"]: _} 580 } 581 582 // Runs your workflow when someone pushes to a repository branch, 583 // which triggers the push event. 584 // Note: The webhook payload available to GitHub Actions does not 585 // include the added, removed, and modified attributes in the 586 // commit object. You can retrieve the full commit object using 587 // the REST API. For more information, see 588 // https://developer.github.com/v3/repos/commits/#get-a-single-commit. 589 push?: #ref & { 590 {[=~"^(branche|tag|path)s(-ignore)?$" & !~"^()$"]: _} 591 } 592 593 // Runs your workflow anytime a package is published or updated. 594 // For more information, see 595 // https://help.github.com/en/github/managing-packages-with-github-packages. 596 registry_package?: #eventObject & { 597 types?: #types & [..."published" | "updated"] | *["published", "updated"] 598 ... 599 } 600 601 // Runs your workflow anytime the release event occurs. More than 602 // one activity type triggers this event. For information about 603 // the REST API, see 604 // https://developer.github.com/v3/repos/releases/ in the GitHub 605 // Developer documentation. 606 release?: #eventObject & { 607 types?: #types & [..."published" | "unpublished" | "created" | "edited" | "deleted" | "prereleased" | "released"] | *["published", "unpublished", "created", "edited", "deleted", "prereleased", "released"] 608 ... 609 } 610 611 // Runs your workflow anytime the status of a Git commit changes, 612 // which triggers the status event. For information about the 613 // REST API, see https://developer.github.com/v3/repos/statuses/. 614 status?: #eventObject 615 616 // Runs your workflow anytime the watch event occurs. More than 617 // one activity type triggers this event. For information about 618 // the REST API, see 619 // https://developer.github.com/v3/activity/starring/. 620 watch?: #eventObject 621 622 // You can now create workflows that are manually triggered with 623 // the new workflow_dispatch event. You will then see a 'Run 624 // workflow' button on the Actions tab, enabling you to easily 625 // trigger a run. 626 workflow_dispatch?: null | bool | number | string | [...] | { 627 // Input parameters allow you to specify data that the action 628 // expects to use during runtime. GitHub stores input parameters 629 // as environment variables. Input ids with uppercase letters are 630 // converted to lowercase during runtime. We recommended using 631 // lowercase input ids. 632 inputs?: { 633 {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$" & !~"^()$"]: { 634 // A string description of the input parameter. 635 description: string 636 637 // A string shown to users using the deprecated input. 638 deprecationMessage?: string 639 640 // A boolean to indicate whether the action requires the input 641 // parameter. Set to true when the parameter is required. 642 required: bool 643 644 // A string representing the default value. The default value is 645 // used when an input parameter isn't specified in a workflow 646 // file. 647 default?: string 648 }} 649 } 650 ... 651 } 652 653 // This event occurs when a workflow run is requested or 654 // completed, and allows you to execute a workflow based on the 655 // finished result of another workflow. For example, if your 656 // pull_request workflow generates build artifacts, you can 657 // create a new workflow that uses workflow_run to analyze the 658 // results and add a comment to the original pull request. 659 workflow_run?: #eventObject & { 660 types?: #types & [..."requested" | "completed"] | *["requested", "completed"] 661 workflows?: [...string] & [_, ...] 662 663 {[=~"^branches(-ignore)?$" & !~"^(types|workflows)$"]: _} 664 ... 665 } 666 667 // You can use the GitHub API to trigger a webhook event called 668 // repository_dispatch when you want to trigger a workflow for 669 // activity that happens outside of GitHub. For more information, 670 // see 671 // https://developer.github.com/v3/repos/#create-a-repository-dispatch-event. 672 // To trigger the custom repository_dispatch webhook event, you 673 // must send a POST request to a GitHub API endpoint and provide 674 // an event_type name to describe the activity type. To trigger a 675 // workflow run, you must also configure your workflow to use the 676 // repository_dispatch event. 677 repository_dispatch?: #eventObject 678 679 // You can schedule a workflow to run at specific UTC times using 680 // POSIX cron syntax 681 // (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07). 682 // Scheduled workflows run on the latest commit on the default or 683 // base branch. The shortest interval you can run scheduled 684 // workflows is once every 5 minutes. 685 // Note: GitHub Actions does not support the non-standard syntax 686 // @yearly, @monthly, @weekly, @daily, @hourly, and @reboot. 687 // You can use crontab guru (https://crontab.guru/). to help 688 // generate your cron syntax and confirm what time it will run. 689 // To help you get started, there is also a list of crontab guru 690 // examples (https://crontab.guru/examples.html). 691 schedule?: [...null | bool | number | string | [...] | { 692 cron?: =~"^(((\\d+,)+\\d+|((\\d+|\\*)\\/\\d+|JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|(\\d+-\\d+)|\\d+|\\*|MON|TUE|WED|THU|FRI|SAT|SUN) ?){5,7}$" 693 }] & [_, ...] 694 } 695 696 // A map of environment variables that are available to all jobs 697 // and steps in the workflow. 698 env?: #env 699 700 // A map of default settings that will apply to all jobs in the 701 // workflow. 702 defaults?: #defaults 703 704 // A workflow run is made up of one or more jobs. Jobs run in 705 // parallel by default. To run jobs sequentially, you can define 706 // dependencies on other jobs using the jobs.<job_id>.needs 707 // keyword. 708 // Each job runs in a fresh instance of the virtual environment 709 // specified by runs-on. 710 // You can run an unlimited number of jobs as long as you are 711 // within the workflow usage limits. For more information, see 712 // https://help.github.com/en/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#usage-limits. 713 jobs: { 714 {[=~"^[_a-zA-Z][a-zA-Z0-9_-]*$" & !~"^()$"]: { 715 // The name of the job displayed on GitHub. 716 name?: string 717 718 // Identifies any jobs that must complete successfully before this 719 // job will run. It can be a string or array of strings. If a job 720 // fails, all jobs that need it are skipped unless the jobs use a 721 // conditional statement that causes the job to continue. 722 needs?: [...#name] & [_, ...] | #name 723 724 // The type of machine to run the job on. The machine can be 725 // either a GitHub-hosted runner, or a self-hosted runner. 726 "runs-on": "macos-10.15" | "macos-11.0" | "macos-latest" | "self-hosted" | "ubuntu-16.04" | "ubuntu-18.04" | "ubuntu-20.04" | "ubuntu-latest" | "windows-2016" | "windows-2019" | "windows-latest" | (["self-hosted"] | ["self-hosted", #machine] | ["self-hosted", #architecture] | ["self-hosted", #machine, #architecture] | ["self-hosted", #architecture, #machine]) & [...] | #expressionSyntax 727 728 // The environment that the job references. 729 environment?: string | #environment 730 731 // A map of outputs for a job. Job outputs are available to all 732 // downstream jobs that depend on this job. 733 outputs?: { 734 [string]: string 735 } 736 737 // A map of environment variables that are available to all steps 738 // in the job. 739 env?: #env 740 741 // A map of default settings that will apply to all steps in the 742 // job. 743 defaults?: #defaults 744 745 // You can use the if conditional to prevent a job from running 746 // unless a condition is met. You can use any supported context 747 // and expression to create a conditional. 748 // Expressions in an if conditional do not require the ${{ }} 749 // syntax. For more information, see 750 // https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions. 751 if?: string 752 753 // A job contains a sequence of tasks called steps. Steps can run 754 // commands, run setup tasks, or run an action in your 755 // repository, a public repository, or an action published in a 756 // Docker registry. Not all steps run actions, but all actions 757 // run as a step. Each step runs in its own process in the 758 // virtual environment and has access to the workspace and 759 // filesystem. Because steps run in their own process, changes to 760 // environment variables are not preserved between steps. GitHub 761 // provides built-in steps to set up and complete a job. 762 steps?: [...{ 763 // A unique identifier for the step. You can use the id to 764 // reference the step in contexts. For more information, see 765 // https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions. 766 id?: string 767 768 // You can use the if conditional to prevent a step from running 769 // unless a condition is met. You can use any supported context 770 // and expression to create a conditional. 771 // Expressions in an if conditional do not require the ${{ }} 772 // syntax. For more information, see 773 // https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions. 774 if?: string 775 776 // A name for your step to display on GitHub. 777 name?: string 778 779 // Selects an action to run as part of a step in your job. An 780 // action is a reusable unit of code. You can use an action 781 // defined in the same repository as the workflow, a public 782 // repository, or in a published Docker container image 783 // (https://hub.docker.com/). 784 // We strongly recommend that you include the version of the 785 // action you are using by specifying a Git ref, SHA, or Docker 786 // tag number. If you don't specify a version, it could break 787 // your workflows or cause unexpected behavior when the action 788 // owner publishes an update. 789 // - Using the commit SHA of a released action version is the 790 // safest for stability and security. 791 // - Using the specific major action version allows you to receive 792 // critical fixes and security patches while still maintaining 793 // compatibility. It also assures that your workflow should still 794 // work. 795 // - Using the master branch of an action may be convenient, but 796 // if someone releases a new major version with a breaking 797 // change, your workflow could break. 798 // Some actions require inputs that you must set using the with 799 // keyword. Review the action's README file to determine the 800 // inputs required. 801 // Actions are either JavaScript files or Docker containers. If 802 // the action you're using is a Docker container you must run the 803 // job in a Linux virtual environment. For more details, see 804 // https://help.github.com/en/articles/virtual-environments-for-github-actions. 805 uses?: string 806 807 // Runs command-line programs using the operating system's shell. 808 // If you do not provide a name, the step name will default to 809 // the text specified in the run command. 810 // Commands run using non-login shells by default. You can choose 811 // a different shell and customize the shell used to run 812 // commands. For more information, see 813 // https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#using-a-specific-shell. 814 // Each run keyword represents a new process and shell in the 815 // virtual environment. When you provide multi-line commands, 816 // each line runs in the same shell. 817 run?: string, "working-directory"?: #["working-directory"], shell?: #shell 818 819 // A map of the input parameters defined by the action. Each input 820 // parameter is a key/value pair. Input parameters are set as 821 // environment variables. The variable is prefixed with INPUT_ 822 // and converted to upper case. 823 with?: #env & { 824 args?: string, entrypoint?: string, ... 825 } 826 827 // Sets environment variables for steps to use in the virtual 828 // environment. You can also set environment variables for the 829 // entire workflow or a job. 830 env?: #env 831 832 // Prevents a job from failing when a step fails. Set to true to 833 // allow a job to pass when this step fails. 834 "continue-on-error"?: bool | #expressionSyntax | *false 835 836 // The maximum number of minutes to run the step before killing 837 // the process. 838 "timeout-minutes"?: number 839 }] & [_, ...] 840 841 // The maximum number of minutes to let a workflow run before 842 // GitHub automatically cancels it. Default: 360 843 "timeout-minutes"?: number | *360 844 845 // A strategy creates a build matrix for your jobs. You can define 846 // different variations of an environment to run each job in. 847 strategy?: { 848 // A build matrix is a set of different configurations of the 849 // virtual environment. For example you might run a job against 850 // more than one supported version of a language, operating 851 // system, or tool. Each configuration is a copy of the job that 852 // runs and reports a status. 853 // You can specify a matrix by supplying an array for the 854 // configuration options. For example, if the GitHub virtual 855 // environment supports Node.js versions 6, 8, and 10 you could 856 // specify an array of those versions in the matrix. 857 // When you define a matrix of operating systems, you must set the 858 // required runs-on keyword to the operating system of the 859 // current job, rather than hard-coding the operating system 860 // name. To access the operating system name, you can use the 861 // matrix.os context parameter to set runs-on. For more 862 // information, see 863 // https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions. 864 matrix: ({ 865 ... 866 } | #expressionSyntax) & { 867 {[=~"^(in|ex)clude$" & !~"^()$"]: [...{ 868 [string]: #configuration 869 }] & [_, ...]} 870 {[!~"^(in|ex)clude$" & !~"^()$"]: [...#configuration] & [_, ...]} 871 } 872 873 // When set to true, GitHub cancels all in-progress jobs if any 874 // matrix job fails. Default: true 875 "fail-fast"?: bool | *true 876 877 // The maximum number of jobs that can run simultaneously when 878 // using a matrix job strategy. By default, GitHub will maximize 879 // the number of jobs run in parallel depending on the available 880 // runners on GitHub-hosted virtual machines. 881 "max-parallel"?: number 882 } 883 884 // Prevents a workflow run from failing when a job fails. Set to 885 // true to allow a workflow run to pass when this job fails. 886 "continue-on-error"?: bool | #expressionSyntax 887 888 // A container to run any steps in a job that don't already 889 // specify a container. If you have steps that use both script 890 // and container actions, the container actions will run as 891 // sibling containers on the same network with the same volume 892 // mounts. 893 // If you do not set a container, all steps will run directly on 894 // the host specified by runs-on unless a step refers to an 895 // action configured to run in a container. 896 container?: string | #container 897 898 // Additional containers to host services for a job in a workflow. 899 // These are useful for creating databases or cache services like 900 // redis. The runner on the virtual machine will automatically 901 // create a network and manage the life cycle of the service 902 // containers. 903 // When you use a service container for a job or your step uses 904 // container actions, you don't need to set port information to 905 // access the service. Docker automatically exposes all ports 906 // between containers on the same network. 907 // When both the job and the action run in a container, you can 908 // directly reference the container by its hostname. The hostname 909 // is automatically mapped to the service name. 910 // When a step does not use a container action, you must access 911 // the service using localhost and bind the ports. 912 services?: { 913 [string]: #container 914 } 915 }} 916 } 917 } 918 919 #architecture: "ARM32" | "x64" | "x86" 920 921 #branch: #globs 922 923 #configuration: string | number | bool | { 924 [string]: #configuration 925 } | [...#configuration] 926 927 #container: { 928 // The Docker image to use as the container to run the action. The 929 // value can be the Docker Hub image name or a registry name. 930 image: string 931 932 // If the image's container registry requires authentication to 933 // pull the image, you can use credentials to set a map of the 934 // username and password. The credentials are the same values 935 // that you would provide to the `docker login` command. 936 credentials?: { 937 username?: string 938 password?: string 939 ... 940 } 941 942 // Sets an array of environment variables in the container. 943 env?: #env 944 945 // Sets an array of ports to expose on the container. 946 ports?: [...number | string] & [_, ...] 947 948 // Sets an array of volumes for the container to use. You can use 949 // volumes to share data between services or other steps in a 950 // job. You can specify named Docker volumes, anonymous Docker 951 // volumes, or bind mounts on the host. 952 // To specify a volume, you specify the source and destination 953 // path: <source>:<destinationPath> 954 // The <source> is a volume name or an absolute path on the host 955 // machine, and <destinationPath> is an absolute path in the 956 // container. 957 volumes?: [...=~"^[^:]+:[^:]+$"] & [_, ...] 958 959 // Additional Docker container resource options. For a list of 960 // options, see 961 // https://docs.docker.com/engine/reference/commandline/create/#options. 962 options?: string 963 } 964 965 #defaults: run?: { 966 shell?: #shell 967 "working-directory"?: #["working-directory"] 968 } 969 970 #env: [string]: bool | number | string 971 972 #environment: { 973 // The name of the environment configured in the repo. 974 name: string 975 976 // A deployment URL 977 url?: string 978 } 979 980 #event: "check_run" | "check_suite" | "create" | "delete" | "deployment" | "deployment_status" | "fork" | "gollum" | "issue_comment" | "issues" | "label" | "member" | "milestone" | "page_build" | "project" | "project_card" | "project_column" | "public" | "pull_request" | "pull_request_review" | "pull_request_review_comment" | "pull_request_target" | "push" | "registry_package" | "release" | "status" | "watch" | "workflow_dispatch" | "workflow_run" | "repository_dispatch" 981 982 #eventObject: null | { 983 ... 984 } 985 986 #expressionSyntax: =~"^\\$\\{\\{.*\\}\\}$" 987 988 #globs: [...strings.MinRunes(1)] & [_, ...] 989 990 #machine: "linux" | "macos" | "windows" 991 992 #name: =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" 993 994 #path: #globs 995 996 #ref: null | { 997 branches?: #branch 998 "branches-ignore"?: #branch 999 tags?: #branch 1000 "tags-ignore"?: #branch 1001 paths?: #path 1002 "paths-ignore"?: #path 1003 ... 1004 } 1005 1006 #shell: (string | ("bash" | "pwsh" | "python" | "sh" | "cmd" | "powershell")) & string 1007 1008 #types: [_, ...] 1009 1010 #: "working-directory": string 1011 } 1012 -- out/eval -- 1013 (struct){ 1014 workflowsDir: (string){ |(*(string){ "./" }, (string){ string }) } 1015 _#masterBranch(:ci): (string){ "master" } 1016 _#releaseTagPattern(:ci): (string){ "v*" } 1017 workflows: (#list){ 1018 0: (struct){ 1019 file: (string){ "test.yml" } 1020 schema: (#struct){ 1021 #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 1022 #branch: (list){ 1023 0: (string){ strings.MinRunes(1) } 1024 } 1025 #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ 1026 }, (list){ 1027 }) } 1028 #container: (#struct){ 1029 image: (string){ string } 1030 } 1031 #defaults: (#struct){ 1032 } 1033 #env: (#struct){ 1034 } 1035 #environment: (#struct){ 1036 name: (string){ string } 1037 } 1038 #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } 1039 #eventObject: ((null|struct)){ |((null){ null }, (#struct){ 1040 }) } 1041 #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } 1042 #globs: (list){ 1043 0: (string){ strings.MinRunes(1) } 1044 } 1045 #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 1046 #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } 1047 #path: (list){ 1048 0: (string){ strings.MinRunes(1) } 1049 } 1050 #ref: ((null|struct)){ |((null){ null }, (#struct){ 1051 }) } 1052 #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } 1053 #types: (list){ 1054 0: (_){ _ } 1055 } 1056 #: (#struct){ 1057 "working-directory": (string){ string } 1058 } 1059 jobs: (#struct){ 1060 start: (#struct){ 1061 "runs-on": (string){ "ubuntu-18.04" } 1062 steps: (#list){ 1063 0: (#struct){ 1064 name: (string){ "Write netrc file for cueckoo Gerrithub" } 1065 run: (string){ "cat <<EOD > ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } 1066 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') }}" } 1067 } 1068 1: (#struct){ 1069 name: (string){ "Update Gerrit CL message with starting message" } 1070 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\\\"}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1071 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') }}" } 1072 } 1073 } 1074 defaults: (#struct){ 1075 run: (#struct){ 1076 shell: (string){ "bash" } 1077 } 1078 } 1079 } 1080 test: (#struct){ 1081 needs: (string){ "start" } 1082 strategy: (#struct){ 1083 "fail-fast": (bool){ false } 1084 matrix: (#struct){ 1085 "go-version": (#list){ 1086 0: (string){ "1.16.x" } 1087 1: (string){ "1.17.x" } 1088 2: (string){ "1.18.x" } 1089 } 1090 os: (#list){ 1091 0: (string){ "ubuntu-18.04" } 1092 1: (string){ "macos-10.15" } 1093 2: (string){ "windows-2019" } 1094 } 1095 } 1096 } 1097 "runs-on": (string){ "${{ matrix.os }}" } 1098 steps: (#list){ 1099 0: (#struct){ 1100 name: (string){ "Write netrc file for cueckoo Gerrithub" } 1101 run: (string){ "cat <<EOD > ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } 1102 } 1103 1: (#struct){ 1104 name: (string){ "Install Go" } 1105 uses: (string){ "actions/setup-go@v3" } 1106 with: (#struct){ 1107 "go-version": (string){ |(*(string){ "${{ matrix.go-version }}" }, (string){ string }) } 1108 } 1109 } 1110 2: (#struct){ 1111 name: (string){ "Checkout code" } 1112 uses: (string){ "actions/checkout@v3" } 1113 } 1114 3: (#struct){ 1115 name: (string){ "Cache Go modules" } 1116 uses: (string){ "actions/cache@v3" } 1117 with: (#struct){ 1118 path: (string){ "~/go/pkg/mod" } 1119 key: (string){ "${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}" } 1120 "restore-keys": (string){ "${{ runner.os }}-${{ matrix.go-version }}-go-" } 1121 } 1122 } 1123 4: (#struct){ 1124 _#tags(:ci): (string){ "long" } 1125 name: (string){ "Set go build tags" } 1126 run: (string){ "go env -w GOFLAGS=-tags=long" } 1127 if: (string){ "${{ github.ref == 'refs/heads/master' }}" } 1128 } 1129 5: (#struct){ 1130 name: (string){ "Generate" } 1131 run: (string){ "go generate ./..." } 1132 if: (string){ "matrix.go-version == '1.16.x' && matrix.os == 'ubuntu-18.04'" } 1133 } 1134 6: (#struct){ 1135 name: (string){ "Test" } 1136 run: (string){ "go test ./..." } 1137 } 1138 7: (#struct){ 1139 name: (string){ "Test with -race" } 1140 run: (string){ "go test -race ./..." } 1141 if: (string){ "${{ matrix.go-version == '1.18.x' && matrix.os == 'ubuntu-18.04' }}" } 1142 } 1143 8: (#struct){ 1144 name: (string){ "gorelease check" } 1145 run: (string){ "go run golang.org/x/exp/cmd/gorelease" } 1146 } 1147 9: (#struct){ 1148 name: (string){ "Check that git is clean post generate and tests" } 1149 run: (string){ "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" } 1150 } 1151 10: (#struct){ 1152 name: (string){ "Pull this commit through the proxy on master" } 1153 run: (string){ "v=$(git rev-parse HEAD)\ncd $(mktemp -d)\ngo mod init mod.com\nGOPROXY=https://proxy.golang.org go get -d github.com/joomcode/cue/cmd/cue@$v" } 1154 if: (string){ "${{ github.ref == 'refs/heads/master' }}" } 1155 } 1156 11: (#struct){ 1157 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') && failure() }}" } 1158 name: (string){ "Post any failures for this matrix entry" } 1159 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\\\",\\\"labels\\\":{\\\"TryBot-Result\\\":-1}}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1160 } 1161 } 1162 defaults: (#struct){ 1163 run: (#struct){ 1164 shell: (string){ "bash" } 1165 } 1166 } 1167 } 1168 mark_ci_success: (#struct){ 1169 "runs-on": (string){ "ubuntu-18.04" } 1170 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') }}" } 1171 needs: (string){ "test" } 1172 steps: (#list){ 1173 0: (#struct){ 1174 name: (string){ "Write netrc file for cueckoo Gerrithub" } 1175 run: (string){ "cat <<EOD > ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } 1176 } 1177 1: (#struct){ 1178 name: (string){ "Update Gerrit CL message with success message" } 1179 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\\\",\\\"labels\\\":{\\\"TryBot-Result\\\":1}}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1180 } 1181 } 1182 defaults: (#struct){ 1183 run: (#struct){ 1184 shell: (string){ "bash" } 1185 } 1186 } 1187 } 1188 delete_build_branch: (#struct){ 1189 "runs-on": (string){ "ubuntu-18.04" } 1190 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') && always() }}" } 1191 needs: (string){ "test" } 1192 steps: (#list){ 1193 0: (#struct){ 1194 run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit push https://github.com/cue-lang/cue :${GITHUB_REF#refs/heads/}" } 1195 } 1196 } 1197 defaults: (#struct){ 1198 run: (#struct){ 1199 shell: (string){ "bash" } 1200 } 1201 } 1202 } 1203 } 1204 name: (string){ "Test" } 1205 on: (#struct){ 1206 push: (#struct){ 1207 branches: (#list){ 1208 0: (string){ "**" } 1209 } 1210 "tags-ignore": (#list){ 1211 0: (string){ "v*" } 1212 } 1213 } 1214 pull_request: (#struct){ 1215 } 1216 } 1217 _#isCLCITestBranch(:ci): (string){ "startsWith(github.ref, 'refs/heads/ci/')" } 1218 _#isMaster(:ci): (string){ "github.ref == 'refs/heads/master'" } 1219 _#pullThroughProxy(:ci): (#struct){ 1220 name: (string){ "Pull this commit through the proxy on master" } 1221 run: (string){ "v=$(git rev-parse HEAD)\ncd $(mktemp -d)\ngo mod init mod.com\nGOPROXY=https://proxy.golang.org go get -d github.com/joomcode/cue/cmd/cue@$v" } 1222 if: (string){ "${{ github.ref == 'refs/heads/master' }}" } 1223 } 1224 _#startCLBuild(:ci): (#struct){ 1225 name: (string){ "Update Gerrit CL message with starting message" } 1226 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\\\"}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1227 } 1228 _#failCLBuild(:ci): (#struct){ 1229 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') && failure() }}" } 1230 name: (string){ "Post any failures for this matrix entry" } 1231 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\\\",\\\"labels\\\":{\\\"TryBot-Result\\\":-1}}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1232 } 1233 _#passCLBuild(:ci): (#struct){ 1234 name: (string){ "Update Gerrit CL message with success message" } 1235 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\\\",\\\"labels\\\":{\\\"TryBot-Result\\\":1}}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1236 } 1237 _#gerrit(:ci): (#struct){ 1238 _#setCodeReview(:ci): (#struct){ 1239 #args: (#struct){ 1240 tag: (string){ "trybot" } 1241 message: (string){ string } 1242 } 1243 res: (_|_){ 1244 // [incomplete] invalid interpolation: cannot convert incomplete value "string" to JSON: 1245 // ./workflows.cue:127:9 1246 // ./workflows.cue:124:14 1247 } 1248 } 1249 } 1250 } 1251 } 1252 1: (struct){ 1253 file: (string){ "repository_dispatch.yml" } 1254 schema: (#struct){ 1255 #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 1256 #branch: (list){ 1257 0: (string){ strings.MinRunes(1) } 1258 } 1259 #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ 1260 }, (list){ 1261 }) } 1262 #container: (#struct){ 1263 image: (string){ string } 1264 } 1265 #defaults: (#struct){ 1266 } 1267 #env: (#struct){ 1268 } 1269 #environment: (#struct){ 1270 name: (string){ string } 1271 } 1272 #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } 1273 #eventObject: ((null|struct)){ |((null){ null }, (#struct){ 1274 }) } 1275 #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } 1276 #globs: (list){ 1277 0: (string){ strings.MinRunes(1) } 1278 } 1279 #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 1280 #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } 1281 #path: (list){ 1282 0: (string){ strings.MinRunes(1) } 1283 } 1284 #ref: ((null|struct)){ |((null){ null }, (#struct){ 1285 }) } 1286 #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } 1287 #types: (list){ 1288 0: (_){ _ } 1289 } 1290 #: (#struct){ 1291 "working-directory": (string){ string } 1292 } 1293 jobs: (#struct){ 1294 runtrybot: (#struct){ 1295 "runs-on": (string){ "ubuntu-18.04" } 1296 _#type(:ci): (string){ "runtrybot" } 1297 if: (string){ "${{ github.event.client_payload.type == 'runtrybot' }}" } 1298 steps: (#list){ 1299 0: (#struct){ 1300 name: (string){ "Write netrc file for cueckoo Gerrithub" } 1301 run: (string){ "cat <<EOD > ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } 1302 } 1303 1: (#struct){ 1304 name: (string){ "Trigger trybot" } 1305 run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit fetch https://review.gerrithub.io/a/cue-lang/cue ${{ github.event.client_payload.payload.ref }}\ngit checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD\ngit push https://github.com/cue-lang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}" } 1306 } 1307 } 1308 defaults: (#struct){ 1309 run: (#struct){ 1310 shell: (string){ "bash" } 1311 } 1312 } 1313 } 1314 } 1315 _#runtrybot(:ci): (string){ "runtrybot" } 1316 _#unity(:ci): (string){ "unity" } 1317 _#dispatchJob(:ci): (#struct){ 1318 "runs-on": (string){ "ubuntu-18.04" } 1319 _#type(:ci): (string){ string } 1320 if: (_|_){ 1321 // [incomplete] workflows.1.schema._#dispatchJob.if: invalid interpolation: non-concrete value string (type string): 1322 // ./workflows.cue:138:14 1323 // ./workflows.cue:136:14 1324 } 1325 } 1326 name: (string){ "Repository Dispatch" } 1327 on: (#list){ 1328 0: (string){ "repository_dispatch" } 1329 } 1330 } 1331 } 1332 2: (struct){ 1333 file: (string){ "release.yml" } 1334 schema: (#struct){ 1335 #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 1336 #branch: (list){ 1337 0: (string){ strings.MinRunes(1) } 1338 } 1339 #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ 1340 }, (list){ 1341 }) } 1342 #container: (#struct){ 1343 image: (string){ string } 1344 } 1345 #defaults: (#struct){ 1346 } 1347 #env: (#struct){ 1348 } 1349 #environment: (#struct){ 1350 name: (string){ string } 1351 } 1352 #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } 1353 #eventObject: ((null|struct)){ |((null){ null }, (#struct){ 1354 }) } 1355 #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } 1356 #globs: (list){ 1357 0: (string){ strings.MinRunes(1) } 1358 } 1359 #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 1360 #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } 1361 #path: (list){ 1362 0: (string){ strings.MinRunes(1) } 1363 } 1364 #ref: ((null|struct)){ |((null){ null }, (#struct){ 1365 }) } 1366 #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } 1367 #types: (list){ 1368 0: (_){ _ } 1369 } 1370 #: (#struct){ 1371 "working-directory": (string){ string } 1372 } 1373 jobs: (#struct){ 1374 goreleaser: (#struct){ 1375 "runs-on": (string){ "ubuntu-18.04" } 1376 steps: (#list){ 1377 0: (#struct){ 1378 name: (string){ "Checkout code" } 1379 uses: (string){ "actions/checkout@v3" } 1380 with: (#struct){ 1381 "fetch-depth": (int){ 0 } 1382 } 1383 } 1384 1: (#struct){ 1385 name: (string){ "Install Go" } 1386 uses: (string){ "actions/setup-go@v3" } 1387 with: (#struct){ 1388 "go-version": (string){ "1.18.1" } 1389 } 1390 } 1391 2: (#struct){ 1392 name: (string){ "Setup qemu" } 1393 uses: (string){ "docker/setup-qemu-action@v1" } 1394 } 1395 3: (#struct){ 1396 name: (string){ "Set up Docker Buildx" } 1397 uses: (string){ "docker/setup-buildx-action@v1" } 1398 } 1399 4: (#struct){ 1400 name: (string){ "Docker Login" } 1401 uses: (string){ "docker/login-action@v1" } 1402 with: (#struct){ 1403 registry: (string){ "docker.io" } 1404 username: (string){ "cueckoo" } 1405 password: (string){ "${{ secrets.CUECKOO_DOCKER_PAT }}" } 1406 } 1407 } 1408 5: (#struct){ 1409 name: (string){ "Run GoReleaser" } 1410 env: (#struct){ 1411 GITHUB_TOKEN: (string){ "${{ secrets.CUECKOO_GITHUB_PAT }}" } 1412 } 1413 uses: (string){ "goreleaser/goreleaser-action@v2" } 1414 with: (#struct){ 1415 args: (string){ "release --rm-dist" } 1416 version: (string){ "v1.8.2" } 1417 } 1418 } 1419 6: (#struct){ 1420 _#arg(:ci): (#struct){ 1421 event_type: (string){ "Re-test post release of ${GITHUB_REF##refs/tags/}" } 1422 } 1423 name: (string){ "Re-test cuelang.org" } 1424 run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cue-lang/cuelang.org/dispatches" } 1425 } 1426 7: (#struct){ 1427 _#arg(:ci): (#struct){ 1428 event_type: (string){ "Check against CUE ${GITHUB_REF##refs/tags/}" } 1429 client_payload: (#struct){ 1430 type: (string){ "unity" } 1431 payload: (#struct){ 1432 versions: (string){ "\"${GITHUB_REF##refs/tags/}\"" } 1433 } 1434 } 1435 } 1436 name: (string){ "Trigger unity build" } 1437 run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Check against CUE ${GITHUB_REF##refs/tags/}\\\",\\\"client_payload\\\":{\\\"type\\\":\\\"unity\\\",\\\"payload\\\":{\\\"versions\\\":\\\"\\\\\\\"${GITHUB_REF##refs/tags/}\\\\\\\"\\\"}}}\" https://api.github.com/repos/cue-unity/unity/dispatches" } 1438 } 1439 } 1440 defaults: (#struct){ 1441 run: (#struct){ 1442 shell: (string){ "bash" } 1443 } 1444 } 1445 } 1446 } 1447 name: (string){ "Release" } 1448 on: (#struct){ 1449 push: (#struct){ 1450 tags: (#list){ 1451 0: (string){ "v*" } 1452 } 1453 } 1454 } 1455 } 1456 } 1457 3: (struct){ 1458 file: (string){ "tip_triggers.yml" } 1459 schema: (#struct){ 1460 #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 1461 #branch: (list){ 1462 0: (string){ strings.MinRunes(1) } 1463 } 1464 #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ 1465 }, (list){ 1466 }) } 1467 #container: (#struct){ 1468 image: (string){ string } 1469 } 1470 #defaults: (#struct){ 1471 } 1472 #env: (#struct){ 1473 } 1474 #environment: (#struct){ 1475 name: (string){ string } 1476 } 1477 #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } 1478 #eventObject: ((null|struct)){ |((null){ null }, (#struct){ 1479 }) } 1480 #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } 1481 #globs: (list){ 1482 0: (string){ strings.MinRunes(1) } 1483 } 1484 #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 1485 #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } 1486 #path: (list){ 1487 0: (string){ strings.MinRunes(1) } 1488 } 1489 #ref: ((null|struct)){ |((null){ null }, (#struct){ 1490 }) } 1491 #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } 1492 #types: (list){ 1493 0: (_){ _ } 1494 } 1495 #: (#struct){ 1496 "working-directory": (string){ string } 1497 } 1498 jobs: (#struct){ 1499 push: (#struct){ 1500 "runs-on": (string){ "ubuntu-18.04" } 1501 steps: (#list){ 1502 0: (#struct){ 1503 name: (string){ "Rebuild tip.cuelang.org" } 1504 run: (string){ "curl -f -s -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" } 1505 } 1506 1: (#struct){ 1507 _#arg(:ci): (#struct){ 1508 event_type: (string){ "Check against ${GITHUB_SHA}" } 1509 client_payload: (#struct){ 1510 type: (string){ "unity" } 1511 payload: (#struct){ 1512 versions: (string){ "\"commit:${GITHUB_SHA}\"" } 1513 } 1514 } 1515 } 1516 name: (string){ "Trigger unity build" } 1517 run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Check against ${GITHUB_SHA}\\\",\\\"client_payload\\\":{\\\"type\\\":\\\"unity\\\",\\\"payload\\\":{\\\"versions\\\":\\\"\\\\\\\"commit:${GITHUB_SHA}\\\\\\\"\\\"}}}\" https://api.github.com/repos/cue-unity/unity/dispatches" } 1518 } 1519 } 1520 defaults: (#struct){ 1521 run: (#struct){ 1522 shell: (string){ "bash" } 1523 } 1524 } 1525 } 1526 } 1527 name: (string){ "Push to tip triggers" } 1528 on: (#struct){ 1529 push: (#struct){ 1530 branches: (#list){ 1531 0: (string){ "master" } 1532 } 1533 } 1534 } 1535 } 1536 } 1537 } 1538 test: (#struct){ 1539 #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 1540 #branch: (list){ 1541 0: (string){ strings.MinRunes(1) } 1542 } 1543 #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ 1544 }, (list){ 1545 }) } 1546 #container: (#struct){ 1547 image: (string){ string } 1548 } 1549 #defaults: (#struct){ 1550 } 1551 #env: (#struct){ 1552 } 1553 #environment: (#struct){ 1554 name: (string){ string } 1555 } 1556 #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } 1557 #eventObject: ((null|struct)){ |((null){ null }, (#struct){ 1558 }) } 1559 #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } 1560 #globs: (list){ 1561 0: (string){ strings.MinRunes(1) } 1562 } 1563 #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 1564 #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } 1565 #path: (list){ 1566 0: (string){ strings.MinRunes(1) } 1567 } 1568 #ref: ((null|struct)){ |((null){ null }, (#struct){ 1569 }) } 1570 #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } 1571 #types: (list){ 1572 0: (_){ _ } 1573 } 1574 #: (#struct){ 1575 "working-directory": (string){ string } 1576 } 1577 jobs: (#struct){ 1578 start: (#struct){ 1579 "runs-on": (string){ "ubuntu-18.04" } 1580 steps: (#list){ 1581 0: (#struct){ 1582 name: (string){ "Write netrc file for cueckoo Gerrithub" } 1583 run: (string){ "cat <<EOD > ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } 1584 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') }}" } 1585 } 1586 1: (#struct){ 1587 name: (string){ "Update Gerrit CL message with starting message" } 1588 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\\\"}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1589 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') }}" } 1590 } 1591 } 1592 defaults: (#struct){ 1593 run: (#struct){ 1594 shell: (string){ "bash" } 1595 } 1596 } 1597 } 1598 test: (#struct){ 1599 needs: (string){ "start" } 1600 strategy: (#struct){ 1601 "fail-fast": (bool){ false } 1602 matrix: (#struct){ 1603 "go-version": (#list){ 1604 0: (string){ "1.16.x" } 1605 1: (string){ "1.17.x" } 1606 2: (string){ "1.18.x" } 1607 } 1608 os: (#list){ 1609 0: (string){ "ubuntu-18.04" } 1610 1: (string){ "macos-10.15" } 1611 2: (string){ "windows-2019" } 1612 } 1613 } 1614 } 1615 "runs-on": (string){ "${{ matrix.os }}" } 1616 steps: (#list){ 1617 0: (#struct){ 1618 name: (string){ "Write netrc file for cueckoo Gerrithub" } 1619 run: (string){ "cat <<EOD > ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } 1620 } 1621 1: (#struct){ 1622 name: (string){ "Install Go" } 1623 uses: (string){ "actions/setup-go@v3" } 1624 with: (#struct){ 1625 "go-version": (string){ |(*(string){ "${{ matrix.go-version }}" }, (string){ string }) } 1626 } 1627 } 1628 2: (#struct){ 1629 name: (string){ "Checkout code" } 1630 uses: (string){ "actions/checkout@v3" } 1631 } 1632 3: (#struct){ 1633 name: (string){ "Cache Go modules" } 1634 uses: (string){ "actions/cache@v3" } 1635 with: (#struct){ 1636 path: (string){ "~/go/pkg/mod" } 1637 key: (string){ "${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}" } 1638 "restore-keys": (string){ "${{ runner.os }}-${{ matrix.go-version }}-go-" } 1639 } 1640 } 1641 4: (#struct){ 1642 _#tags(:ci): (string){ "long" } 1643 name: (string){ "Set go build tags" } 1644 run: (string){ "go env -w GOFLAGS=-tags=long" } 1645 if: (string){ "${{ github.ref == 'refs/heads/master' }}" } 1646 } 1647 5: (#struct){ 1648 name: (string){ "Generate" } 1649 run: (string){ "go generate ./..." } 1650 if: (string){ "matrix.go-version == '1.16.x' && matrix.os == 'ubuntu-18.04'" } 1651 } 1652 6: (#struct){ 1653 name: (string){ "Test" } 1654 run: (string){ "go test ./..." } 1655 } 1656 7: (#struct){ 1657 name: (string){ "Test with -race" } 1658 run: (string){ "go test -race ./..." } 1659 if: (string){ "${{ matrix.go-version == '1.18.x' && matrix.os == 'ubuntu-18.04' }}" } 1660 } 1661 8: (#struct){ 1662 name: (string){ "gorelease check" } 1663 run: (string){ "go run golang.org/x/exp/cmd/gorelease" } 1664 } 1665 9: (#struct){ 1666 name: (string){ "Check that git is clean post generate and tests" } 1667 run: (string){ "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" } 1668 } 1669 10: (#struct){ 1670 name: (string){ "Pull this commit through the proxy on master" } 1671 run: (string){ "v=$(git rev-parse HEAD)\ncd $(mktemp -d)\ngo mod init mod.com\nGOPROXY=https://proxy.golang.org go get -d github.com/joomcode/cue/cmd/cue@$v" } 1672 if: (string){ "${{ github.ref == 'refs/heads/master' }}" } 1673 } 1674 11: (#struct){ 1675 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') && failure() }}" } 1676 name: (string){ "Post any failures for this matrix entry" } 1677 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\\\",\\\"labels\\\":{\\\"TryBot-Result\\\":-1}}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1678 } 1679 } 1680 defaults: (#struct){ 1681 run: (#struct){ 1682 shell: (string){ "bash" } 1683 } 1684 } 1685 } 1686 mark_ci_success: (#struct){ 1687 "runs-on": (string){ "ubuntu-18.04" } 1688 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') }}" } 1689 needs: (string){ "test" } 1690 steps: (#list){ 1691 0: (#struct){ 1692 name: (string){ "Write netrc file for cueckoo Gerrithub" } 1693 run: (string){ "cat <<EOD > ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } 1694 } 1695 1: (#struct){ 1696 name: (string){ "Update Gerrit CL message with success message" } 1697 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\\\",\\\"labels\\\":{\\\"TryBot-Result\\\":1}}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1698 } 1699 } 1700 defaults: (#struct){ 1701 run: (#struct){ 1702 shell: (string){ "bash" } 1703 } 1704 } 1705 } 1706 delete_build_branch: (#struct){ 1707 "runs-on": (string){ "ubuntu-18.04" } 1708 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') && always() }}" } 1709 needs: (string){ "test" } 1710 steps: (#list){ 1711 0: (#struct){ 1712 run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit push https://github.com/cue-lang/cue :${GITHUB_REF#refs/heads/}" } 1713 } 1714 } 1715 defaults: (#struct){ 1716 run: (#struct){ 1717 shell: (string){ "bash" } 1718 } 1719 } 1720 } 1721 } 1722 name: (string){ "Test" } 1723 on: (#struct){ 1724 push: (#struct){ 1725 branches: (#list){ 1726 0: (string){ "**" } 1727 } 1728 "tags-ignore": (#list){ 1729 0: (string){ "v*" } 1730 } 1731 } 1732 pull_request: (#struct){ 1733 } 1734 } 1735 _#isCLCITestBranch(:ci): (string){ "startsWith(github.ref, 'refs/heads/ci/')" } 1736 _#isMaster(:ci): (string){ "github.ref == 'refs/heads/master'" } 1737 _#pullThroughProxy(:ci): (#struct){ 1738 name: (string){ "Pull this commit through the proxy on master" } 1739 run: (string){ "v=$(git rev-parse HEAD)\ncd $(mktemp -d)\ngo mod init mod.com\nGOPROXY=https://proxy.golang.org go get -d github.com/joomcode/cue/cmd/cue@$v" } 1740 if: (string){ "${{ github.ref == 'refs/heads/master' }}" } 1741 } 1742 _#startCLBuild(:ci): (#struct){ 1743 name: (string){ "Update Gerrit CL message with starting message" } 1744 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\\\"}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1745 } 1746 _#failCLBuild(:ci): (#struct){ 1747 if: (string){ "${{ startsWith(github.ref, 'refs/heads/ci/') && failure() }}" } 1748 name: (string){ "Post any failures for this matrix entry" } 1749 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details\\\",\\\"labels\\\":{\\\"TryBot-Result\\\":-1}}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1750 } 1751 _#passCLBuild(:ci): (#struct){ 1752 name: (string){ "Update Gerrit CL message with success message" } 1753 run: (string){ "curl -f -s -n -H \"Content-Type: application/json\" --request POST --data \"{\\\"tag\\\":\\\"trybot\\\",\\\"message\\\":\\\"Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}\\\",\\\"labels\\\":{\\\"TryBot-Result\\\":1}}\" https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" } 1754 } 1755 _#gerrit(:ci): (#struct){ 1756 _#setCodeReview(:ci): (#struct){ 1757 #args: (#struct){ 1758 tag: (string){ "trybot" } 1759 message: (string){ string } 1760 } 1761 res: (_|_){ 1762 // [incomplete] invalid interpolation: cannot convert incomplete value "string" to JSON: 1763 // ./workflows.cue:127:9 1764 // ./workflows.cue:124:14 1765 } 1766 } 1767 } 1768 } 1769 repository_dispatch: (#struct){ 1770 #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 1771 #branch: (list){ 1772 0: (string){ strings.MinRunes(1) } 1773 } 1774 #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ 1775 }, (list){ 1776 }) } 1777 #container: (#struct){ 1778 image: (string){ string } 1779 } 1780 #defaults: (#struct){ 1781 } 1782 #env: (#struct){ 1783 } 1784 #environment: (#struct){ 1785 name: (string){ string } 1786 } 1787 #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } 1788 #eventObject: ((null|struct)){ |((null){ null }, (#struct){ 1789 }) } 1790 #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } 1791 #globs: (list){ 1792 0: (string){ strings.MinRunes(1) } 1793 } 1794 #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 1795 #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } 1796 #path: (list){ 1797 0: (string){ strings.MinRunes(1) } 1798 } 1799 #ref: ((null|struct)){ |((null){ null }, (#struct){ 1800 }) } 1801 #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } 1802 #types: (list){ 1803 0: (_){ _ } 1804 } 1805 #: (#struct){ 1806 "working-directory": (string){ string } 1807 } 1808 jobs: (#struct){ 1809 runtrybot: (#struct){ 1810 "runs-on": (string){ "ubuntu-18.04" } 1811 _#type(:ci): (string){ "runtrybot" } 1812 if: (string){ "${{ github.event.client_payload.type == 'runtrybot' }}" } 1813 steps: (#list){ 1814 0: (#struct){ 1815 name: (string){ "Write netrc file for cueckoo Gerrithub" } 1816 run: (string){ "cat <<EOD > ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } 1817 } 1818 1: (#struct){ 1819 name: (string){ "Trigger trybot" } 1820 run: (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"\ngit fetch https://review.gerrithub.io/a/cue-lang/cue ${{ github.event.client_payload.payload.ref }}\ngit checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD\ngit push https://github.com/cue-lang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}" } 1821 } 1822 } 1823 defaults: (#struct){ 1824 run: (#struct){ 1825 shell: (string){ "bash" } 1826 } 1827 } 1828 } 1829 } 1830 _#runtrybot(:ci): (string){ "runtrybot" } 1831 _#unity(:ci): (string){ "unity" } 1832 _#dispatchJob(:ci): (#struct){ 1833 "runs-on": (string){ "ubuntu-18.04" } 1834 _#type(:ci): (string){ string } 1835 if: (_|_){ 1836 // [incomplete] repository_dispatch._#dispatchJob.if: invalid interpolation: non-concrete value string (type string): 1837 // ./workflows.cue:138:14 1838 // ./workflows.cue:136:14 1839 } 1840 } 1841 name: (string){ "Repository Dispatch" } 1842 on: (#list){ 1843 0: (string){ "repository_dispatch" } 1844 } 1845 } 1846 release: (#struct){ 1847 #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 1848 #branch: (list){ 1849 0: (string){ strings.MinRunes(1) } 1850 } 1851 #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ 1852 }, (list){ 1853 }) } 1854 #container: (#struct){ 1855 image: (string){ string } 1856 } 1857 #defaults: (#struct){ 1858 } 1859 #env: (#struct){ 1860 } 1861 #environment: (#struct){ 1862 name: (string){ string } 1863 } 1864 #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } 1865 #eventObject: ((null|struct)){ |((null){ null }, (#struct){ 1866 }) } 1867 #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } 1868 #globs: (list){ 1869 0: (string){ strings.MinRunes(1) } 1870 } 1871 #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 1872 #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } 1873 #path: (list){ 1874 0: (string){ strings.MinRunes(1) } 1875 } 1876 #ref: ((null|struct)){ |((null){ null }, (#struct){ 1877 }) } 1878 #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } 1879 #types: (list){ 1880 0: (_){ _ } 1881 } 1882 #: (#struct){ 1883 "working-directory": (string){ string } 1884 } 1885 jobs: (#struct){ 1886 goreleaser: (#struct){ 1887 "runs-on": (string){ "ubuntu-18.04" } 1888 steps: (#list){ 1889 0: (#struct){ 1890 name: (string){ "Checkout code" } 1891 uses: (string){ "actions/checkout@v3" } 1892 with: (#struct){ 1893 "fetch-depth": (int){ 0 } 1894 } 1895 } 1896 1: (#struct){ 1897 name: (string){ "Install Go" } 1898 uses: (string){ "actions/setup-go@v3" } 1899 with: (#struct){ 1900 "go-version": (string){ "1.18.1" } 1901 } 1902 } 1903 2: (#struct){ 1904 name: (string){ "Setup qemu" } 1905 uses: (string){ "docker/setup-qemu-action@v1" } 1906 } 1907 3: (#struct){ 1908 name: (string){ "Set up Docker Buildx" } 1909 uses: (string){ "docker/setup-buildx-action@v1" } 1910 } 1911 4: (#struct){ 1912 name: (string){ "Docker Login" } 1913 uses: (string){ "docker/login-action@v1" } 1914 with: (#struct){ 1915 registry: (string){ "docker.io" } 1916 username: (string){ "cueckoo" } 1917 password: (string){ "${{ secrets.CUECKOO_DOCKER_PAT }}" } 1918 } 1919 } 1920 5: (#struct){ 1921 name: (string){ "Run GoReleaser" } 1922 env: (#struct){ 1923 GITHUB_TOKEN: (string){ "${{ secrets.CUECKOO_GITHUB_PAT }}" } 1924 } 1925 uses: (string){ "goreleaser/goreleaser-action@v2" } 1926 with: (#struct){ 1927 args: (string){ "release --rm-dist" } 1928 version: (string){ "v1.8.2" } 1929 } 1930 } 1931 6: (#struct){ 1932 _#arg(:ci): (#struct){ 1933 event_type: (string){ "Re-test post release of ${GITHUB_REF##refs/tags/}" } 1934 } 1935 name: (string){ "Re-test cuelang.org" } 1936 run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Re-test post release of ${GITHUB_REF##refs/tags/}\\\"}\" https://api.github.com/repos/cue-lang/cuelang.org/dispatches" } 1937 } 1938 7: (#struct){ 1939 _#arg(:ci): (#struct){ 1940 event_type: (string){ "Check against CUE ${GITHUB_REF##refs/tags/}" } 1941 client_payload: (#struct){ 1942 type: (string){ "unity" } 1943 payload: (#struct){ 1944 versions: (string){ "\"${GITHUB_REF##refs/tags/}\"" } 1945 } 1946 } 1947 } 1948 name: (string){ "Trigger unity build" } 1949 run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Check against CUE ${GITHUB_REF##refs/tags/}\\\",\\\"client_payload\\\":{\\\"type\\\":\\\"unity\\\",\\\"payload\\\":{\\\"versions\\\":\\\"\\\\\\\"${GITHUB_REF##refs/tags/}\\\\\\\"\\\"}}}\" https://api.github.com/repos/cue-unity/unity/dispatches" } 1950 } 1951 } 1952 defaults: (#struct){ 1953 run: (#struct){ 1954 shell: (string){ "bash" } 1955 } 1956 } 1957 } 1958 } 1959 name: (string){ "Release" } 1960 on: (#struct){ 1961 push: (#struct){ 1962 tags: (#list){ 1963 0: (string){ "v*" } 1964 } 1965 } 1966 } 1967 } 1968 tip_triggers: (#struct){ 1969 #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 1970 #branch: (list){ 1971 0: (string){ strings.MinRunes(1) } 1972 } 1973 #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ 1974 }, (list){ 1975 }) } 1976 #container: (#struct){ 1977 image: (string){ string } 1978 } 1979 #defaults: (#struct){ 1980 } 1981 #env: (#struct){ 1982 } 1983 #environment: (#struct){ 1984 name: (string){ string } 1985 } 1986 #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } 1987 #eventObject: ((null|struct)){ |((null){ null }, (#struct){ 1988 }) } 1989 #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } 1990 #globs: (list){ 1991 0: (string){ strings.MinRunes(1) } 1992 } 1993 #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 1994 #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } 1995 #path: (list){ 1996 0: (string){ strings.MinRunes(1) } 1997 } 1998 #ref: ((null|struct)){ |((null){ null }, (#struct){ 1999 }) } 2000 #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } 2001 #types: (list){ 2002 0: (_){ _ } 2003 } 2004 #: (#struct){ 2005 "working-directory": (string){ string } 2006 } 2007 jobs: (#struct){ 2008 push: (#struct){ 2009 "runs-on": (string){ "ubuntu-18.04" } 2010 steps: (#list){ 2011 0: (#struct){ 2012 name: (string){ "Rebuild tip.cuelang.org" } 2013 run: (string){ "curl -f -s -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" } 2014 } 2015 1: (#struct){ 2016 _#arg(:ci): (#struct){ 2017 event_type: (string){ "Check against ${GITHUB_SHA}" } 2018 client_payload: (#struct){ 2019 type: (string){ "unity" } 2020 payload: (#struct){ 2021 versions: (string){ "\"commit:${GITHUB_SHA}\"" } 2022 } 2023 } 2024 } 2025 name: (string){ "Trigger unity build" } 2026 run: (string){ "curl -f -s -H \"Content-Type: application/json\" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \"{\\\"event_type\\\":\\\"Check against ${GITHUB_SHA}\\\",\\\"client_payload\\\":{\\\"type\\\":\\\"unity\\\",\\\"payload\\\":{\\\"versions\\\":\\\"\\\\\\\"commit:${GITHUB_SHA}\\\\\\\"\\\"}}}\" https://api.github.com/repos/cue-unity/unity/dispatches" } 2027 } 2028 } 2029 defaults: (#struct){ 2030 run: (#struct){ 2031 shell: (string){ "bash" } 2032 } 2033 } 2034 } 2035 } 2036 name: (string){ "Push to tip triggers" } 2037 on: (#struct){ 2038 push: (#struct){ 2039 branches: (#list){ 2040 0: (string){ "master" } 2041 } 2042 } 2043 } 2044 } 2045 _#bashWorkflow(:ci): (#struct){ 2046 #architecture: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 2047 #branch: (list){ 2048 0: (string){ strings.MinRunes(1) } 2049 } 2050 #configuration: ((bool|string|list|struct|number)){ |((string){ string }, (number){ number }, (bool){ bool }, (#struct){ 2051 }, (list){ 2052 }) } 2053 #container: (#struct){ 2054 image: (string){ string } 2055 } 2056 #defaults: (#struct){ 2057 } 2058 #env: (#struct){ 2059 } 2060 #environment: (#struct){ 2061 name: (string){ string } 2062 } 2063 #event: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } 2064 #eventObject: ((null|struct)){ |((null){ null }, (#struct){ 2065 }) } 2066 #expressionSyntax: (string){ =~"^\\$\\{\\{.*\\}\\}$" } 2067 #globs: (list){ 2068 0: (string){ strings.MinRunes(1) } 2069 } 2070 #machine: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 2071 #name: (string){ =~"^[_a-zA-Z][a-zA-Z0-9_-]*$" } 2072 #path: (list){ 2073 0: (string){ strings.MinRunes(1) } 2074 } 2075 #ref: ((null|struct)){ |((null){ null }, (#struct){ 2076 }) } 2077 #shell: (string){ |((string){ string }, (string){ "bash" }, (string){ "pwsh" }, (string){ "python" }, (string){ "sh" }, (string){ "cmd" }, (string){ "powershell" }) } 2078 #types: (list){ 2079 0: (_){ _ } 2080 } 2081 #: (#struct){ 2082 "working-directory": (string){ string } 2083 } 2084 jobs: (#struct){ 2085 } 2086 on: ((string|list|struct)){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }, (list){ 2087 0: (string){ |((string){ "check_run" }, (string){ "check_suite" }, (string){ "create" }, (string){ "delete" }, (string){ "deployment" }, (string){ "deployment_status" }, (string){ "fork" }, (string){ "gollum" }, (string){ "issue_comment" }, (string){ "issues" }, (string){ "label" }, (string){ "member" }, (string){ "milestone" }, (string){ "page_build" }, (string){ "project" }, (string){ "project_card" }, (string){ "project_column" }, (string){ "public" }, (string){ "pull_request" }, (string){ "pull_request_review" }, (string){ "pull_request_review_comment" }, (string){ "pull_request_target" }, (string){ "push" }, (string){ "registry_package" }, (string){ "release" }, (string){ "status" }, (string){ "watch" }, (string){ "workflow_dispatch" }, (string){ "workflow_run" }, (string){ "repository_dispatch" }) } 2088 }, (#struct){ 2089 }) } 2090 } 2091 _#job(:ci): (#struct){ 2092 "runs-on": ((string|list)){ |((string){ "macos-10.15" }, (string){ "macos-11.0" }, (string){ "macos-latest" }, (string){ "self-hosted" }, (string){ "ubuntu-16.04" }, (string){ "ubuntu-18.04" }, (string){ "ubuntu-20.04" }, (string){ "ubuntu-latest" }, (string){ "windows-2016" }, (string){ "windows-2019" }, (string){ "windows-latest" }, (#list){ 2093 0: (string){ "self-hosted" } 2094 }, (#list){ 2095 0: (string){ "self-hosted" } 2096 1: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 2097 }, (#list){ 2098 0: (string){ "self-hosted" } 2099 1: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 2100 }, (#list){ 2101 0: (string){ "self-hosted" } 2102 1: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 2103 2: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 2104 }, (#list){ 2105 0: (string){ "self-hosted" } 2106 1: (string){ |((string){ "ARM32" }, (string){ "x64" }, (string){ "x86" }) } 2107 2: (string){ |((string){ "linux" }, (string){ "macos" }, (string){ "windows" }) } 2108 }, (string){ =~"^\\$\\{\\{.*\\}\\}$" }) } 2109 } 2110 _#step(:ci): (#struct){ 2111 } 2112 _#codeGenGo(:ci): (string){ "1.16.x" } 2113 _#latestStableGo(:ci): (string){ "1.18.x" } 2114 _#pinnedReleaseGo(:ci): (string){ "1.18.1" } 2115 _#linuxMachine(:ci): (string){ "ubuntu-18.04" } 2116 _#macosMachine(:ci): (string){ "macos-10.15" } 2117 _#windowsMachine(:ci): (string){ "windows-2019" } 2118 _#testStrategy(:ci): (#struct){ 2119 "fail-fast": (bool){ false } 2120 matrix: (#struct){ 2121 "go-version": (#list){ 2122 0: (string){ "1.16.x" } 2123 1: (string){ "1.17.x" } 2124 2: (string){ "1.18.x" } 2125 } 2126 os: (#list){ 2127 0: (string){ "ubuntu-18.04" } 2128 1: (string){ "macos-10.15" } 2129 2: (string){ "windows-2019" } 2130 } 2131 } 2132 } 2133 _#setGoBuildTags(:ci): (#struct){ 2134 _#tags(:ci): (string){ string } 2135 name: (string){ "Set go build tags" } 2136 run: (_|_){ 2137 // [incomplete] _#setGoBuildTags.run: invalid interpolation: non-concrete value string (type string): 2138 // ./workflows.cue:270:10 2139 // ./workflows.cue:268:10 2140 } 2141 } 2142 _#installGo(:ci): (#struct){ 2143 name: (string){ "Install Go" } 2144 uses: (string){ "actions/setup-go@v3" } 2145 with: (#struct){ 2146 "go-version": (string){ |(*(string){ "${{ matrix.go-version }}" }, (string){ string }) } 2147 } 2148 } 2149 _#checkoutCode(:ci): (#struct){ 2150 name: (string){ "Checkout code" } 2151 uses: (string){ "actions/checkout@v3" } 2152 } 2153 _#cacheGoModules(:ci): (#struct){ 2154 name: (string){ "Cache Go modules" } 2155 uses: (string){ "actions/cache@v3" } 2156 with: (#struct){ 2157 path: (string){ "~/go/pkg/mod" } 2158 key: (string){ "${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}" } 2159 "restore-keys": (string){ "${{ runner.os }}-${{ matrix.go-version }}-go-" } 2160 } 2161 } 2162 _#goGenerate(:ci): (#struct){ 2163 name: (string){ "Generate" } 2164 run: (string){ "go generate ./..." } 2165 if: (string){ "matrix.go-version == '1.16.x' && matrix.os == 'ubuntu-18.04'" } 2166 } 2167 _#goTest(:ci): (#struct){ 2168 name: (string){ "Test" } 2169 run: (string){ "go test ./..." } 2170 } 2171 _#goTestRace(:ci): (#struct){ 2172 name: (string){ "Test with -race" } 2173 run: (string){ "go test -race ./..." } 2174 } 2175 _#goReleaseCheck(:ci): (#struct){ 2176 name: (string){ "gorelease check" } 2177 run: (string){ "go run golang.org/x/exp/cmd/gorelease" } 2178 } 2179 _#checkGitClean(:ci): (#struct){ 2180 name: (string){ "Check that git is clean post generate and tests" } 2181 run: (string){ "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" } 2182 } 2183 _#writeNetrcFile(:ci): (#struct){ 2184 name: (string){ "Write netrc file for cueckoo Gerrithub" } 2185 run: (string){ "cat <<EOD > ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" } 2186 } 2187 _#branchRefPrefix(:ci): (string){ "refs/heads/" } 2188 _#tempCueckooGitDir(:ci): (string){ "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"" } 2189 _#curl(:ci): (string){ "curl -f -s" } 2190 } 2191 -- out/compile -- 2192 --- workflows.cue 2193 { 2194 workflowsDir: (*"./"|string) 2195 _#masterBranch: "master" 2196 _#releaseTagPattern: "v*" 2197 workflows: ([ 2198 ...{ 2199 file: string 2200 schema: 〈import;"github.com/SchemaStore/schemastore/src/schemas/json"〉.#Workflow 2201 }, 2202 ] & [ 2203 { 2204 file: "test.yml" 2205 schema: 〈2;test〉 2206 }, 2207 { 2208 file: "repository_dispatch.yml" 2209 schema: 〈2;repository_dispatch〉 2210 }, 2211 { 2212 file: "release.yml" 2213 schema: 〈2;release〉 2214 }, 2215 { 2216 file: "tip_triggers.yml" 2217 schema: 〈2;tip_triggers〉 2218 }, 2219 ]) 2220 test: (〈0;_#bashWorkflow〉 & { 2221 name: "Test" 2222 on: { 2223 push: { 2224 branches: [ 2225 "**", 2226 ] 2227 "tags-ignore": [ 2228 〈4;_#releaseTagPattern〉, 2229 ] 2230 } 2231 pull_request: {} 2232 } 2233 jobs: { 2234 start: { 2235 "runs-on": 〈3;_#linuxMachine〉 2236 steps: ([ 2237 ...(_ & { 2238 if: "${{ \(〈4;_#isCLCITestBranch〉) }}" 2239 }), 2240 ] & [ 2241 〈4;_#writeNetrcFile〉, 2242 〈3;_#startCLBuild〉, 2243 ]) 2244 } 2245 test: { 2246 needs: "start" 2247 strategy: 〈3;_#testStrategy〉 2248 "runs-on": "${{ matrix.os }}" 2249 steps: [ 2250 〈4;_#writeNetrcFile〉, 2251 〈4;_#installGo〉, 2252 〈4;_#checkoutCode〉, 2253 〈4;_#cacheGoModules〉, 2254 (〈4;_#setGoBuildTags〉 & { 2255 _#tags: "long" 2256 if: "${{ \(〈4;_#isMaster〉) }}" 2257 }), 2258 〈4;_#goGenerate〉, 2259 〈4;_#goTest〉, 2260 (〈4;_#goTestRace〉 & { 2261 if: "${{ matrix.go-version == '\(〈5;_#latestStableGo〉)' && matrix.os == '\(〈5;_#linuxMachine〉)' }}" 2262 }), 2263 〈4;_#goReleaseCheck〉, 2264 〈4;_#checkGitClean〉, 2265 〈3;_#pullThroughProxy〉, 2266 〈3;_#failCLBuild〉, 2267 ] 2268 } 2269 mark_ci_success: { 2270 "runs-on": 〈3;_#linuxMachine〉 2271 if: "${{ \(〈2;_#isCLCITestBranch〉) }}" 2272 needs: "test" 2273 steps: [ 2274 〈4;_#writeNetrcFile〉, 2275 〈3;_#passCLBuild〉, 2276 ] 2277 } 2278 delete_build_branch: { 2279 "runs-on": 〈3;_#linuxMachine〉 2280 if: "${{ \(〈2;_#isCLCITestBranch〉) && always() }}" 2281 needs: "test" 2282 steps: [ 2283 (〈4;_#step〉 & { 2284 run: "\(〈5;_#tempCueckooGitDir〉) 2285 git push https://github.com/cue-lang/cue :${GITHUB_REF#\(〈5;_#branchRefPrefix〉)}" 2286 }), 2287 ] 2288 } 2289 } 2290 _#isCLCITestBranch: "startsWith(github.ref, '\(〈1;_#branchRefPrefix〉)ci/')" 2291 _#isMaster: "github.ref == '\((〈1;_#branchRefPrefix〉 + 〈1;_#masterBranch〉))'" 2292 _#pullThroughProxy: (〈1;_#step〉 & { 2293 name: "Pull this commit through the proxy on \(〈2;_#masterBranch〉)" 2294 run: "v=$(git rev-parse HEAD)\ncd $(mktemp -d)\ngo mod init mod.com\nGOPROXY=https://proxy.golang.org go get -d github.com/joomcode/cue/cmd/cue@$v" 2295 if: "${{ \(〈1;_#isMaster〉) }}" 2296 }) 2297 _#startCLBuild: (〈1;_#step〉 & { 2298 name: "Update Gerrit CL message with starting message" 2299 run: (〈1;_#gerrit〉._#setCodeReview & { 2300 #args: { 2301 message: "Started the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}" 2302 } 2303 }).res 2304 }) 2305 _#failCLBuild: (〈1;_#step〉 & { 2306 if: "${{ \(〈1;_#isCLCITestBranch〉) && failure() }}" 2307 name: "Post any failures for this matrix entry" 2308 run: (〈1;_#gerrit〉._#setCodeReview & { 2309 #args: { 2310 message: "Build failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} for more details" 2311 labels: { 2312 "TryBot-Result": -1 2313 } 2314 } 2315 }).res 2316 }) 2317 _#passCLBuild: (〈1;_#step〉 & { 2318 name: "Update Gerrit CL message with success message" 2319 run: (〈1;_#gerrit〉._#setCodeReview & { 2320 #args: { 2321 message: "Build succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}" 2322 labels: { 2323 "TryBot-Result": 1 2324 } 2325 } 2326 }).res 2327 }) 2328 _#gerrit: { 2329 _#setCodeReview: { 2330 #args: { 2331 tag: "trybot" 2332 message: string 2333 labels?: { 2334 "TryBot-Result": int 2335 } 2336 } 2337 res: "\(〈3;_#curl〉) -n -H "Content-Type: application/json" --request POST --data \(〈import;strconv〉.Quote(〈import;"encoding/json"〉.Marshal(〈0;#args〉))) https://review.gerrithub.io/a/changes/$(basename $(dirname $GITHUB_REF))/revisions/$(basename $GITHUB_REF)/review" 2338 } 2339 } 2340 }) 2341 repository_dispatch: (〈0;_#bashWorkflow〉 & { 2342 _#runtrybot: "runtrybot" 2343 _#unity: "unity" 2344 _#dispatchJob: (〈1;_#job〉 & { 2345 _#type: string 2346 "runs-on": 〈2;_#linuxMachine〉 2347 if: "${{ github.event.client_payload.type == '\(〈0;_#type〉)' }}" 2348 }) 2349 name: "Repository Dispatch" 2350 on: [ 2351 "repository_dispatch", 2352 ] 2353 jobs: { 2354 "\(〈1;_#runtrybot〉)": (〈1;_#dispatchJob〉 & { 2355 _#type: 〈2;_#runtrybot〉 2356 steps: [ 2357 〈4;_#writeNetrcFile〉, 2358 (〈4;_#step〉 & { 2359 name: "Trigger trybot" 2360 run: "\(〈5;_#tempCueckooGitDir〉) 2361 git fetch https://review.gerrithub.io/a/cue-lang/cue ${{ github.event.client_payload.payload.ref }} 2362 git checkout -b ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }} FETCH_HEAD 2363 git push https://github.com/cue-lang/cue ci/${{ github.event.client_payload.payload.changeID }}/${{ github.event.client_payload.payload.commit }}" 2364 }), 2365 ] 2366 }) 2367 } 2368 }) 2369 release: (〈0;_#bashWorkflow〉 & { 2370 name: "Release" 2371 on: { 2372 push: { 2373 tags: [ 2374 〈4;_#releaseTagPattern〉, 2375 ] 2376 } 2377 } 2378 jobs: { 2379 goreleaser: { 2380 "runs-on": 〈3;_#linuxMachine〉 2381 steps: [ 2382 (〈4;_#checkoutCode〉 & { 2383 with: { 2384 "fetch-depth": 0 2385 } 2386 }), 2387 (〈4;_#installGo〉 & { 2388 with: { 2389 "go-version": 〈6;_#pinnedReleaseGo〉 2390 } 2391 }), 2392 (〈4;_#step〉 & { 2393 name: "Setup qemu" 2394 uses: "docker/setup-qemu-action@v1" 2395 }), 2396 (〈4;_#step〉 & { 2397 name: "Set up Docker Buildx" 2398 uses: "docker/setup-buildx-action@v1" 2399 }), 2400 (〈4;_#step〉 & { 2401 name: "Docker Login" 2402 uses: "docker/login-action@v1" 2403 with: { 2404 registry: "docker.io" 2405 username: "cueckoo" 2406 password: "${{ secrets.CUECKOO_DOCKER_PAT }}" 2407 } 2408 }), 2409 (〈4;_#step〉 & { 2410 name: "Run GoReleaser" 2411 env: { 2412 GITHUB_TOKEN: "${{ secrets.CUECKOO_GITHUB_PAT }}" 2413 } 2414 uses: "goreleaser/goreleaser-action@v2" 2415 with: { 2416 args: "release --rm-dist" 2417 version: "v1.8.2" 2418 } 2419 }), 2420 (〈4;_#step〉 & { 2421 _#arg: { 2422 event_type: "Re-test post release of ${GITHUB_REF##refs/tags/}" 2423 } 2424 name: "Re-test cuelang.org" 2425 run: "\(〈5;_#curl〉) -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(〈import;strconv〉.Quote(〈import;"encoding/json"〉.Marshal(〈0;_#arg〉))) https://api.github.com/repos/cue-lang/cuelang.org/dispatches" 2426 }), 2427 (〈4;_#step〉 & { 2428 _#arg: { 2429 event_type: "Check against CUE ${GITHUB_REF##refs/tags/}" 2430 client_payload: { 2431 type: "unity" 2432 payload: { 2433 versions: "\"${GITHUB_REF##refs/tags/}\"" 2434 } 2435 } 2436 } 2437 name: "Trigger unity build" 2438 run: "\(〈5;_#curl〉) -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(〈import;strconv〉.Quote(〈import;"encoding/json"〉.Marshal(〈0;_#arg〉))) https://api.github.com/repos/cue-unity/unity/dispatches" 2439 }), 2440 ] 2441 } 2442 } 2443 }) 2444 tip_triggers: (〈0;_#bashWorkflow〉 & { 2445 name: "Push to tip triggers" 2446 on: { 2447 push: { 2448 branches: [ 2449 〈4;_#masterBranch〉, 2450 ] 2451 } 2452 } 2453 jobs: { 2454 push: { 2455 "runs-on": 〈3;_#linuxMachine〉 2456 steps: [ 2457 { 2458 name: "Rebuild tip.cuelang.org" 2459 run: "\(〈5;_#curl〉) -X POST -d {} https://api.netlify.com/build_hooks/${{ secrets.CuelangOrgTipRebuildHook }}" 2460 }, 2461 { 2462 _#arg: { 2463 event_type: "Check against ${GITHUB_SHA}" 2464 client_payload: { 2465 type: "unity" 2466 payload: { 2467 versions: "\"commit:${GITHUB_SHA}\"" 2468 } 2469 } 2470 } 2471 name: "Trigger unity build" 2472 run: "\(〈5;_#curl〉) -H "Content-Type: application/json" -u cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} --request POST --data-binary \(〈import;strconv〉.Quote(〈import;"encoding/json"〉.Marshal(〈0;_#arg〉))) https://api.github.com/repos/cue-unity/unity/dispatches" 2473 }, 2474 ] 2475 } 2476 } 2477 }) 2478 _#bashWorkflow: (〈import;"github.com/SchemaStore/schemastore/src/schemas/json"〉.#Workflow & { 2479 jobs: { 2480 [string]: { 2481 defaults: { 2482 run: { 2483 shell: "bash" 2484 } 2485 } 2486 } 2487 } 2488 }) 2489 _#job: ((〈import;"github.com/SchemaStore/schemastore/src/schemas/json"〉.#Workflow & {}).jobs & { 2490 x: _ 2491 }).x 2492 _#step: ((〈0;_#job〉 & { 2493 steps: _ 2494 }).steps & [ 2495 _, 2496 ])[0] 2497 _#codeGenGo: "1.16.x" 2498 _#latestStableGo: "1.18.x" 2499 _#pinnedReleaseGo: "1.18.1" 2500 _#linuxMachine: "ubuntu-18.04" 2501 _#macosMachine: "macos-10.15" 2502 _#windowsMachine: "windows-2019" 2503 _#testStrategy: { 2504 "fail-fast": false 2505 matrix: { 2506 "go-version": [ 2507 〈3;_#codeGenGo〉, 2508 "1.17.x", 2509 〈3;_#latestStableGo〉, 2510 ] 2511 os: [ 2512 〈3;_#linuxMachine〉, 2513 〈3;_#macosMachine〉, 2514 〈3;_#windowsMachine〉, 2515 ] 2516 } 2517 } 2518 _#setGoBuildTags: (〈0;_#step〉 & { 2519 _#tags: string 2520 name: "Set go build tags" 2521 run: "go env -w GOFLAGS=-tags=\(〈0;_#tags〉)" 2522 }) 2523 _#installGo: (〈0;_#step〉 & { 2524 name: "Install Go" 2525 uses: "actions/setup-go@v3" 2526 with: { 2527 "go-version": (*"${{ matrix.go-version }}"|string) 2528 } 2529 }) 2530 _#checkoutCode: (〈0;_#step〉 & { 2531 name: "Checkout code" 2532 uses: "actions/checkout@v3" 2533 }) 2534 _#cacheGoModules: (〈0;_#step〉 & { 2535 name: "Cache Go modules" 2536 uses: "actions/cache@v3" 2537 with: { 2538 path: "~/go/pkg/mod" 2539 key: "${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}" 2540 "restore-keys": "${{ runner.os }}-${{ matrix.go-version }}-go-" 2541 } 2542 }) 2543 _#goGenerate: (〈0;_#step〉 & { 2544 name: "Generate" 2545 run: "go generate ./..." 2546 if: "matrix.go-version == '\(〈1;_#codeGenGo〉)' && matrix.os == '\(〈1;_#linuxMachine〉)'" 2547 }) 2548 _#goTest: (〈0;_#step〉 & { 2549 name: "Test" 2550 run: "go test ./..." 2551 }) 2552 _#goTestRace: (〈0;_#step〉 & { 2553 name: "Test with -race" 2554 run: "go test -race ./..." 2555 }) 2556 _#goReleaseCheck: (〈0;_#step〉 & { 2557 name: "gorelease check" 2558 run: "go run golang.org/x/exp/cmd/gorelease" 2559 }) 2560 _#checkGitClean: (〈0;_#step〉 & { 2561 name: "Check that git is clean post generate and tests" 2562 run: "test -z \"$(git status --porcelain)\" || (git status; git diff; false)" 2563 }) 2564 _#writeNetrcFile: (〈0;_#step〉 & { 2565 name: "Write netrc file for cueckoo Gerrithub" 2566 run: "cat <<EOD > ~/.netrc\nmachine review.gerrithub.io\nlogin cueckoo\npassword ${{ secrets.CUECKOO_GERRITHUB_PASSWORD }}\nEOD\nchmod 600 ~/.netrc" 2567 }) 2568 _#branchRefPrefix: "refs/heads/" 2569 _#tempCueckooGitDir: "mkdir tmpgit\ncd tmpgit\ngit init\ngit config user.name cueckoo\ngit config user.email cueckoo@gmail.com\ngit config http.https://github.com/.extraheader \"AUTHORIZATION: basic $(echo -n cueckoo:${{ secrets.CUECKOO_GITHUB_PAT }} | base64)\"" 2570 _#curl: "curl -f -s" 2571 }