-
Notifications
You must be signed in to change notification settings - Fork 19
101 lines (94 loc) · 2.35 KB
/
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
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
name: Tests / Code Coverage
on:
pull_request:
merge_group:
push:
branches:
- main
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}-tests
cancel-in-progress: true
jobs:
test-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22.4
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.go
go.mod
go.sum
- name: Unit Tests
if: env.GIT_DIFF
run: |
go work init
make test-unit
- name: Test Coverage
run: |
go work init ||:
make test-cover
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: cover.out
test-integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22.4
cache: true
cache-dependency-path: go.sum
- uses: technote-space/[email protected]
id: git_diff
with:
PATTERNS: |
**/*.go
go.mod
go.sum
- name: tests
if: env.GIT_DIFF
run: |
go work init
make test-integration
test-e2e:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- uses: actions/setup-go@v5
if: env.GIT_DIFF
with:
go-version: 1.22.4
cache: true
# In this step, this action saves a list of existing images, the cache is
# created without them in the post run. It also restores the cache if it
# exists.
- name: cache docker layer
uses: satackey/[email protected]
if: env.GIT_DIFF
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
- name: E2E Tests
if: env.GIT_DIFF
run: |
go work init
make test-e2e