-
Notifications
You must be signed in to change notification settings - Fork 2
104 lines (85 loc) · 2.81 KB
/
Copy pathci-lint-test.yml
File metadata and controls
104 lines (85 loc) · 2.81 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: CI - Lint and Test
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "0 0 * * *"
permissions:
contents: read
jobs:
lint_and_test:
name: Lint and Test
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
if: github.event.pull_request.draft == false || github.event_name == 'push'
steps:
- name: Harden Runner
uses: step-security/harden-runner@002fdce3c6a235733a90a27c80493a3241e56863 # v2.12.1
with:
disable-sudo: true
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Get Go Version
shell: bash
run: |
#!/bin/bash
GOVERSION=$({ [ -f .go-version ] && cat .go-version; })
echo "GOVERSION=$GOVERSION" >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ env.GOVERSION }}
- name: Go Cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.GOVERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GOVERSION }}-
${{ runner.os }}-go-
- name: Download Dependencies
run: go mod download
- name: Verify Dependencies
run: go mod verify
- name: Build
run: make build
- name: Run Tests
run: make test
- name: Run Tests with Race Detection
run: make test-race
- name: Run Tests with Coverage
run: make test-coverage
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@4650159d642e33fdc30954ca22638caf0df6cac8 # v5.4.3
with:
file: ./coverage.out
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
- name: Go Lint
env:
GOGC: 10
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
version: v2.1.6
only-new-issues: true
args: --timeout=10m
- name: Run Staticcheck
uses: dominikh/staticcheck-action@fe1dd0c3658873b46f8c9bb3291096a617310ca6 # v1.3.1
with:
version: "latest"
install-go: false
cache-key: ${{ runner.os }}-${{ env.GOVERSION }}
- name: Run Integration Tests
run: make test-integration
- name: Test Data Validation
run: make test-data-check