Skip to content

Commit

Permalink
ci: tidy up and refactor GitHub workflow specifications
Browse files Browse the repository at this point in the history
Clean up our workflow definitions by factoring out common aspects of
test and test_dispatch workflows.

Change-Id: I8efa2615d985ade008efa3c9cd0e7fa330ce3325
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6103
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
myitcv authored and mpvl committed May 19, 2020
1 parent 8f09dde commit a801188
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 151 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/test_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ jobs:
run: test -z "$(git status --porcelain)" || (git status; git diff; false)
- name: Post any failures for this matrix entry
if: ${{ failure() }}
run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"labels":
{ "Code-Review": -1 }, "message":"Build failed for ${{ runner.os }}-${{ matrix.go-version
}}; see ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id
}} for more details"}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{
github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit
}}/review'
run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"message":"Build
failed for ${{ runner.os }}-${{ matrix.go-version }}; see ${{ github.event.repository.html_url
}}/actions/runs/${{ github.run_id }} for more details","labels":{"Code-Review":-1}}''
-b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{ github.event.client_payload.changeID
}}/revisions/${{ github.event.client_payload.commit }}/review'
strategy:
matrix:
go-version:
Expand Down Expand Up @@ -81,8 +80,8 @@ jobs:
- name: Write the gitcookies file
run: echo "$GERRIT_COOKIE" > ~/.gitcookies
- name: Update Gerrit CL message with success message
run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"labels":
{ "Code-Review": 1 }, "message":"Build succeeded for ${{ github.event.repository.html_url
}}/actions/runs/${{ github.run_id }}"}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{
run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"message":"Build
succeeded for ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id
}}","labels":{"Code-Review":1}}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{
github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit
}}/review'
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package json

import "strings"

Workflow :: {
#Workflow: {
@jsonschema(schema="http://json-schema.org/draft-07/schema")
number | null | bool | string | [...] | {
// The name of your workflow. GitHub displays the names of your
Expand Down
2 changes: 1 addition & 1 deletion internal/ci/ci_tool.cue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ command: vendorgithubschema: {
}
convert: exec.Run & {
stdin: get.response.body
cmd: "go run cuelang.org/go/cmd/cue import -f -p json -l Workflow:: jsonschema: - --outfile pkg/github.com/SchemaStore/schemastore/schemas/json/github-workflow.cue"
cmd: "go run cuelang.org/go/cmd/cue import -f -p json -l #Workflow: jsonschema: - --outfile pkg/github.com/SchemaStore/schemastore/schemas/json/github-workflow.cue"
}
}

0 comments on commit a801188

Please sign in to comment.