-
Notifications
You must be signed in to change notification settings - Fork 5
111 lines (111 loc) · 3.05 KB
/
build-test-lint.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
name: "Build, Test, Lint"
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
go-version: [1.22.x]
goarch: [amd64]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go matrix
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Build
env:
GOARCH: ${{ matrix.goarch }}
GOOS: ${{ matrix.goos }}
run: make build
lint:
runs-on: ubuntu-latest
needs: build
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Lint
run: make lint
test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Run tests
run: make unit-test
build-image:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build image
run: make docker-build
go-check:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
# if this fails, run go mod tidy
- name: Check if module files are consistent with code
run: go mod tidy && git diff --exit-code
# if this fails, run make generate; make manifests and commit changes
- name: Check if generated are up to date
run: make generate && make manifests && git diff --exit-code
coverage:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Generate coverage report
run: make unit-test
- name: Upload to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: cover.out
e2e-test:
runs-on: ubuntu-latest
needs: [test, build-image]
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: prepare test k8s cluster
run: make test-env-e2e
- name: build and deploy operator
run: make deploy-operator-e2e
- name: run e2e tests
run: make test-e2e
- name: upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-test-artifacts
path: ./artifacts
- name: cleanup
if: always()
run: make clean-test-env-e2e