-
Notifications
You must be signed in to change notification settings - Fork 3
89 lines (77 loc) · 2.37 KB
/
tests.yaml
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
78
79
80
81
82
83
84
85
86
87
88
89
name: Tests
permissions: read-all
on:
push:
branches: [ primary ]
tags: [ 'v*.*.*' ]
pull_request:
workflow_dispatch: # Allow manual runs to kick off benchmarks
inputs:
run_bench:
description: Run benchmarks
required: false
type: boolean
env:
GO_VERSION: 1.21
jobs:
code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Determine paths to cache
id: cache
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)">> $GITHUB_OUTPUT
- name: Go Build Cache
uses: actions/cache@v3
with:
path: |
${{ steps.cache.outputs.go-build }}
${{ steps.cache.outputs.go-mod }}
key: ${{ runner.os }}-quality-${{ hashFiles('**/go.sum') }}
# This action should, in general, be a no-op, given the cache above.
- name: Download all deps
run: go mod download
- name: crlfmt returns no deltas
if: ${{ always() }}
run: |
DELTA=$(go run github.com/cockroachdb/crlfmt .)
echo $DELTA
test -z "$DELTA"
- name: Lint
if: ${{ always() }}
run: go run golang.org/x/lint/golint -set_exit_status ./...
- name: Static checks
if: ${{ always() }}
run: go run honnef.co/go/tools/cmd/staticcheck -checks all ./...
run-tests:
name: Run tests
runs-on: ubuntu-latest
env:
COVER_OUT: coverage.out
steps:
- uses: actions/checkout@v3
- name: et up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Determine paths to cache
id: cache
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)">> $GITHUB_OUTPUT
- name: Go Build Cache
uses: actions/cache@v3
with:
path: |
${{ steps.cache.outputs.go-build }}
${{ steps.cache.outputs.go-mod }}
key: ${{ runner.os }}-integration-${{ hashFiles('**/go.sum') }}
- name: Go Tests
run: go test -v -race -coverpkg=./internal/... -covermode=atomic -coverprofile=${{ env.COVER_OUT }} ./...