ci: define repository_dispatch build
Use GitHub actions as our CI for changes in Gerrit.
Add codereview.cfg to explicitly give the Gerrit and GitHub repo
locations.
Define a separate repository_dispatch workflow which is identical to the
regular test.yml except for the addition of calls to the
github.com/cue-sh/trybot action to update the CL that triggered the
build.
We then need to add a secret in github.com/cuelang/cue repo with the
cueckoo gitcookie details.
github.com/cue-sh/tools/cmd/runtrybot can then be used to trigger
builds.
Change-Id: Ie2b937ea6221c9c2e0fe3f8e219c15fcce74d89e
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/5823
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/.github/workflows/test_dispatch.yml b/.github/workflows/test_dispatch.yml
new file mode 100644
index 0000000..8ac1f89
--- /dev/null
+++ b/.github/workflows/test_dispatch.yml
@@ -0,0 +1,90 @@
+name: Test
+
+on: [repository_dispatch]
+
+jobs:
+ start:
+ runs-on: ubuntu-latest
+ steps:
+
+ # Go is required for the cue-sh/trybot action
+ - name: Install Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: 1.14.x
+
+ - name: Update Gerrit CL message with starting message
+ uses: cue-sh/trybot@latest
+ with:
+ mode: start
+ runID: ${{ github.run_id }}
+ ref: ${{ github.event.client_payload.ref }}
+ changeID: ${{ github.event.client_payload.changeID }}
+ jobStatus: ${{ job.status }}
+ repo: ${{ github.event.repository.html_url }}
+ gerritCookie: ${{ secrets.gerritCookie }}
+
+ test:
+ needs: start
+ strategy:
+ matrix:
+ go-version: [1.13.x, 1.14.x]
+ platform: [ubuntu-latest, macos-latest, windows-latest]
+ runs-on: ${{ matrix.platform }}
+ steps:
+ - name: Install Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: ${{ matrix.go-version }}
+
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Cache Go modules
+ uses: actions/cache@v1
+ with:
+ path: ~/go/pkg/mod
+ key: ${{ runner.os }}-${{ matrix.go-version }}-go-${{ hashFiles('**/go.sum') }}
+ restore-keys: |
+ ${{ runner.os }}-${{ matrix.go-version }}-go-
+
+ - name: Test
+ run: go test ./...
+ - name: Test with -race
+ run: go test -race ./...
+
+ - name: Update Gerrit CL message with failure message
+ if: ${{ failure() }}
+ uses: cue-sh/trybot@latest
+ with:
+ mode: end
+ runID: ${{ github.run_id }}
+ ref: ${{ github.event.client_payload.ref }}
+ changeID: ${{ github.event.client_payload.changeID }}
+ jobStatus: "failure"
+ matrixDesc: "${{ runner.os }}-${{ matrix.go-version }}"
+ repo: ${{ github.event.repository.html_url }}
+ gerritCookie: ${{ secrets.gerritCookie }}
+
+ end:
+ needs: test
+ runs-on: ubuntu-latest
+ steps:
+
+ # Go is required for the cue-sh/trybot action
+ - name: Install Go
+ uses: actions/setup-go@v2
+ with:
+ go-version: 1.14.x
+
+ - name: Update Gerrit CL message with success message
+ uses: cue-sh/trybot@latest
+ with:
+ mode: end
+ runID: ${{ github.run_id }}
+ ref: ${{ github.event.client_payload.ref }}
+ changeID: ${{ github.event.client_payload.changeID }}
+ jobStatus: "success"
+ repo: ${{ github.event.repository.html_url }}
+ gerritCookie: ${{ secrets.gerritCookie }}
+
diff --git a/codereview.cfg b/codereview.cfg
new file mode 100644
index 0000000..d12cfa7
--- /dev/null
+++ b/codereview.cfg
@@ -0,0 +1,2 @@
+gerrit: https://cue-review.googlesource.com/cue
+github: https://github.com/cuelang/cue