-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (123 loc) · 3.36 KB
/
pr-test.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
---
name: CI
on:
pull_request:
branches:
- main
- 'v*'
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
code: ${{ steps.filter.outputs.code }}
docs: ${{ steps.filter.outputs.docs }}
protos: ${{ steps.filter.outputs.protos }}
steps:
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
code:
- '!(docs/**)'
docs:
- .github/workflows/pr-test.yaml
- 'docs/**'
protos:
- .github/workflows/pr-test.yaml
- '**/*.proto'
cache:
uses: ./.github/workflows/cache.yaml
download-test-times:
name: Download test times
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Download previous test times
continue-on-error: true
uses: dawidd6/action-download-artifact@v2
with:
workflow: pr-test.yaml
name: test-times
search_artifacts: true
- name: Upload previous test times
uses: actions/upload-artifact@v3
with:
name: previous-test-times
path: test-times.json
test:
needs:
- changes
- download-test-times
if: ${{ needs.changes.outputs.code == 'true' }}
name: Test
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
split: [0, 1, 2, 3, 4, 5]
outputs:
job-total: ${{ strategy.job-total }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
lfs: true
- name: Install Go and restore cached dependencies
uses: ./.github/actions/setup-go
- name: Download previous test times
uses: actions/download-artifact@v3
with:
name: previous-test-times
- name: Test
run: go test ./...
- name: Upload JUnit reports
uses: actions/upload-artifact@v3
with:
name: junit-reports-${{ strategy.job-index }}
path: junit.*.xml
- name: Upload to CodeCov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: "unit.cover,integration.cover"
upload-test-times:
needs: test
name: Upload test times
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go and restore cached dependencies
uses: ./.github/actions/setup-go
- name: Download JUnit reports
uses: actions/download-artifact@v3
- name: Combine JUnit reports
run: |-
mv junit-reports-*/junit.*.xml .
make test-times TESTSPLIT_TOTAL=${{ needs.test.outputs.job-total }}
- name: Upload new test times
uses: actions/upload-artifact@v3
with:
name: test-times
path: test-times.json
golangci:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
check-latest: true
- name: golangci-lint
uses: golangci/[email protected]
with:
version: latest
args: '--config=.golangci.yaml -v'