-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (42 loc) · 1.5 KB
/
lint-test.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
---
name: Linting and Test
# Run for all pushes to main and pull requests when Go or YAML files change
on:
push:
branches:
- main
pull_request:
jobs:
golangci:
name: lint-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install cockroach binary
run: curl https://binaries.cockroachdb.com/cockroach-v23.1.23.linux-amd64.tgz | tar -xz && sudo cp -i cockroach-v23.1.23.linux-amd64/cockroach /usr/local/bin/
- name: Start test database
run: cockroach start-single-node --insecure --background
- name: Create test DB
run: make test-database
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.61.0
args: --timeout=5m
skip-cache: true
- name: Run go tests and generate coverage report
run: FLEETDB_CRDB_URI="host=localhost port=26257 user=root sslmode=disable dbname=fleetdb_test" go test -race -coverprofile=coverage.txt -covermode=atomic -tags testtools -p 1 ./...
- name: Stop test database
run: cockroach node drain --insecure --host=localhost:26257
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: unittests
name: codecov-umbrella