-
Notifications
You must be signed in to change notification settings - Fork 3
77 lines (65 loc) · 1.74 KB
/
pr-validate-driver.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Validate Driver
permissions:
contents: read
pull-requests: write
checks: write
on:
pull_request:
paths:
- ".github/workflows/pr-validate-driver.yml"
- "**.go"
- "go.mod"
- "go.sum"
jobs:
validate:
runs-on: ubuntu-latest
services:
core:
image: fauna/faunadb:latest
ports:
- 8443:8443
strategy:
matrix:
go: [ '1.22', '1.21', '1.20', '1.19' ]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
cache: true
- name: Install tools
run: |
go install golang.org/x/tools/cmd/goimports@latest
- name: Fmt
run: |
LINE_COUNT=$(goimports -l . | wc -l)
if [ "$LINE_COUNT" -gt 0 ]; then
goimports -d .
exit 1
fi
- name: Vet
run: go vet ./...
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
- name: Test
run: go test -v ./...
- name: Run Benchmark
run: go test -bench=. ./... -benchmem | tee output.txt
- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-${{ matrix.go }}-benchmark
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Go Benchmark
tool: 'go'
output-file-path: output.txt
external-data-json-path: ./cache/benchmark-data.json
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: '120%'
comment-always: true
fail-on-alert: true