blob: 744d25c92dea7ccb498c1568f2868a31be4ecb89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
name: "Go"
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
generate:
runs-on: ubuntu-latest
steps:
- run: |
jq -nc '{"state": "pending", "context": "go tests"}' | \
curl -sL -X POST -d @- \
-H "Content-Type: application/json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"${{ github.event.pull_request.statuses_url }}"
if: github.event_name == 'pull_request'
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: 1.14
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/cache@v1
with:
path: ~/.cache/bazel
key: ${{ runner.os }}-bazel-${{ hashFiles('WORKSPACE') }}
restore-keys: |
${{ runner.os }}-bazel-
- run: make build TARGETS="//:gopath"
- run: tools/go_branch.sh
- run: git checkout go && git clean -f
- run: go build ./...
- if: github.event_name == 'push'
run: |
# Required dedicated credentials for the Go branch, due to the way
# branch protection rules are configured.
git config --global credential.helper cache
echo -e "protocol=https\nhost=github.com\nusername=${{ secrets.GO_TOKEN }}\npassword=x-oauth-basic" | git credential approve
git remote add upstream "https://github.com/${{ github.repository }}"
git push upstream go:go
- if: ${{ success() && github.event_name == 'pull_request' }}
run: |
jq -nc '{"state": "success", "context": "go tests"}' | \
curl -sL -X POST -d @- \
-H "Content-Type: application/json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"${{ github.event.pull_request.statuses_url }}"
- if: ${{ failure() && github.event_name == 'pull_request' }}
run: |
jq -nc '{"state": "failure", "context": "go tests"}' | \
curl -sL -X POST -d @- \
-H "Content-Type: application/json" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"${{ github.event.pull_request.statuses_url }}"
|