blob: 0aa8f64eb6df43db1b01a43b9a396d08e7f49d2d [file] [log] [blame]
# Generated by internal/ci/ci_tool.cue; do not edit
name: Test Dispatch
env:
GERRIT_COOKIE: ${{ secrets.gerritCookie }}
on:
- repository_dispatch
defaults:
run:
shell: bash
jobs:
start:
runs-on: ubuntu-latest
steps:
- name: Write the gitcookies file
run: echo "$GERRIT_COOKIE" > ~/.gitcookies
- name: Update Gerrit CL message with starting message
run: 'curl -f -s -H "Content-Type: application/json" --request POST --data ''{"message":"Started
the build... see progress at ${{ github.event.repository.html_url }}/actions/runs/${{
github.run_id }}"}'' -b ~/.gitcookies https://cue-review.googlesource.com/a/changes/${{
github.event.client_payload.changeID }}/revisions/${{ github.event.client_payload.commit
}}/review'
test:
runs-on: ${{ matrix.os }}
steps:
- name: Write the gitcookies file
run: echo "$GERRIT_COOKIE" > ~/.gitcookies
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout ref
run: |-
git fetch https://cue-review.googlesource.com/cue ${{ github.event.client_payload.ref }}
git checkout FETCH_HEAD
- 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-
- if: matrix.go-version == '1.14.9' && matrix.os != 'windows-latest'
name: Generate
run: go generate ./...
- name: Test
run: go test ./...
- name: Test with -race
run: go test -race ./...
- name: gorelease check
run: go run golang.org/x/exp/cmd/gorelease
- name: Check that git is clean post generate and tests
run: test -z "$(git status --porcelain)" || (git status; git diff; false)
- if: ${{ failure() }}
name: Post any failures for this matrix entry
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'
needs: start
strategy:
fail-fast: false
matrix:
go-version:
- 1.13.x
- 1.14.9
- 1.15.x
os:
- ubuntu-latest
- macos-latest
- windows-latest
end:
runs-on: ubuntu-latest
steps:
- 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 ''{"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'
needs: test