-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (46 loc) · 1.47 KB
/
go.yml
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
---
name: Go
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
job1:
name: Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Format Check
run: cd function && if [ $(gofmt -l -s . | grep -E -v '^vendor/' | tee /tmp/gofmt.txt
| wc -l) -ne 0 ]; then echo "fmt failed:"; cat /tmp/gofmt.txt ; exit 1;
fi
job2:
name: Functionality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Setup Private Go/Git access
run: |
set -euxo pipefail
git config --global url."https://${{ secrets.REPO_SCOPED_TOKEN }}:[email protected]/brightbock/".insteadOf "https://github.com/brightbock/"
go env -w "GOPRIVATE=github.com/brightbock/*"
- name: Build
run: cd function && go build -v ./...
- name: Test
run: cd function && go test -v -covermode="count" -coverprofile="/tmp/coverage.out"
- name: Coverage Report
run: cd function && go tool cover -func="/tmp/coverage.out"
- name: Tidy Private Go/Git access
if: always()
run: |
set -euxo pipefail
git config --name-only --get-regexp 'url\.http.+@' | xargs -n 1 -I X git config --global --unset-all "X"