-
Notifications
You must be signed in to change notification settings - Fork 9
114 lines (110 loc) · 2.81 KB
/
code.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
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
name: Code
on:
push:
branches:
- 'main'
pull_request:
types: [opened, synchronize, reopened, labeled]
branches:
- main
paths-ignore:
- "*.md"
- '*.yaml'
- '*.yml'
- LICENSE
- 'docs/**'
env:
GO111MODULE: on
jobs:
go-lint:
runs-on: ubuntu-latest
strategy:
matrix:
go:
- version: "1.20"
name: target
- version: "1.21"
name: latest
name: "Linting with ${{ matrix.go.name }} Go"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go.version }}
- name: run linters
run: |
make go-lint
make fmtcheck
codegen-uptodate:
runs-on: ubuntu-latest
strategy:
matrix:
go:
- version: "1.20"
name: target
- version: "1.21"
name: latest
name: "Code generator with ${{ matrix.go.name }} Go"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go.version }}
- name: generate code
run: |
make generate
if [ -n "$(git status --porcelain=v1)" ]; then git add -N .; git diff; exit 1; fi
unit:
runs-on: ubuntu-latest
if: success() || failure()
strategy:
matrix:
go:
- version: "1.20"
name: target
- version: "1.21"
name: latest
name: "Unit tests with ${{ matrix.go.name }} Go"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go.version }}
- name: run unit tests
run: make test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
files: ./coverage.out
flags: unittests
verbose: true
integration-tests:
if: ${{ github.event.label.name == 'integration_tests' }}
runs-on: ubuntu-latest
strategy:
matrix:
go:
- version: "1.20"
name: target
name: "Integration tests with ${{ matrix.go.name }} Go (ok-to-test or trusted)"
steps:
- name: Checkout source
uses: actions/checkout@v3
with:
ref: 'refs/pull/${{ github.event.pull_request.number }}/merge'
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go.version }}
- name: run integration tests
env:
ANEXIA_TOKEN: ${{ secrets.ANEXIA_TOKEN }}
run: make func-test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
files: ./coverage.out
flags: integration
verbose: true
override_pr: ${{ github.event.pull_request.number }}