forked from k8snetworkplumbingwg/whereabouts
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (91 loc) · 3.22 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
102
103
104
105
106
107
108
109
on: [push, pull_request]
name: Test
jobs:
test:
strategy:
matrix:
go-version: [1.19.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Get all changed files excluding docs and README
id: changed-files
uses: tj-actions/changed-files@v35
with:
files_ignore: |
**/*.md
doc/*.{json,png,svg}
- name: Run Revive Action by building from repository
uses: morphy2k/[email protected]
if: steps.changed-files.outputs.any_changed == 'true'
with:
exclude: "./vendor/..."
name: "Revive"
- name: Install kubebuilder tools
if: steps.changed-files.outputs.any_changed == 'true'
run: ./hack/install-kubebuilder-tools.sh
- name: Generate code
if: steps.changed-files.outputs.any_changed == 'true'
run: ./hack/generate-code.sh && hack/verify-codegen.sh
- name: Run go fmt
if: steps.changed-files.outputs.any_changed == 'true'
run: go fmt ./...
#run: diff -u <(echo -n) <(gofmt -d -s .)
- name: Run go vet
if: steps.changed-files.outputs.any_changed == 'true'
run: go vet --tags=test ./...
- name: Install static check
if: steps.changed-files.outputs.any_changed == 'true'
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Test
if: steps.changed-files.outputs.any_changed == 'true'
run: sudo PATH=${PATH}:./bin ./hack/test-go.sh
- name: Send coverage
if: steps.changed-files.outputs.any_changed == 'true'
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out
flag-name: Go-${{ matrix.go }}
env:
KUBEBUILDER_ASSETS: "$(pwd)/bin"
e2e-test:
name: e2e test
runs-on: ubuntu-latest
env:
NUMBER_OF_COMPUTE_NODES: 5
steps:
- name: Set up Go version
uses: actions/setup-go@v1
with:
go-version: 1.19.x
- name: Checkout code into the Go module directory
uses: actions/checkout@v2
- name: Get all changed files excluding docs and README
id: changed-files
uses: tj-actions/changed-files@v35
with:
files_ignore: |
**/*.md
doc/*.{json,png,svg}
- name: Install requirements
if: steps.changed-files.outputs.any_changed == 'true'
run: sudo apt-get install nmap jq && ./hack/build-go.sh
- name: Get tools, setup KinD cluster test environment
if: steps.changed-files.outputs.any_changed == 'true'
run: source hack/e2e-get-test-tools.sh && ./hack/e2e-setup-kind-cluster.sh --number-of-compute $NUMBER_OF_COMPUTE_NODES
- name: Clear test-cache
if: steps.changed-files.outputs.any_changed == 'true'
run: go clean -testcache
- name: Execute golang based E2E tests
if: steps.changed-files.outputs.any_changed == 'true'
env:
KUBECONFIG: /home/runner/.kube/config
NUMBER_OF_THRASH_ITER: 20
FILL_PERCENT_CAPACITY: 20
run: pushd e2e; go test -v . -timeout 1h; popd