-
Notifications
You must be signed in to change notification settings - Fork 15
151 lines (141 loc) · 4.87 KB
/
nexus-operator-integration-checks.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
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Nexus Operator Integration Checks
on:
pull_request:
paths-ignore:
- "docs/**"
- "README.md"
- "CONTRIBUTING.md"
- "examples/**"
- "LICENSE"
- "Makefile"
- ".github/ISSUE_TEMPLATE/**"
branches:
- main
env:
OPERATOR_SDK_VERSION: v1.4.2
GO_VERSION: 1.15
jobs:
golint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/[email protected]
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: latest
args: --enable=revive --timeout=2m --skip-files=pkg/test/client.go,pkg/framework/kind/kinds.go,controllers/nexus/resource/validation/defaults.go
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Check Vet
run: |
make generate
make manifests
changed_files=$(git status -s | grep -v 'go.mod\|go.sum' || :)
generated_changed_files=$(git status -s | grep zz_generated || :)
[[ -z "$generated_changed_files" ]] || (printf "There is change in auto-generated files" && exit 1)
[[ -z "$changed_files" ]] || (printf "Change is detected in some files: \n$changed_files\n" && exit 1)
- name: Check Headers
run: |
./hack/addheaders.sh
changed_files=$(git status -s | grep -v 'go.mod\|go.sum' || :)
[[ -z "$changed_files" ]] || (printf "Some files are missing the headers: \n$changed_files\n Please add headers before sending the PR" && exit 1)
unit_test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod/cache
key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-cache-
- name: Cache Operator SDK
uses: actions/cache@v2
with:
path: ${{ env.GOPATH }}/bin/operator-sdk
key: ${{ runner.os }}-sdk-cache-${{ env.OPERATOR_SDK_VERSION }}
restore-keys: |
${{ runner.os }}-sdk-cache
- name: Install Operator SDK
run: ./hack/ci/install-operator-sdk.sh
- name: Mod Tidy
run: |
go mod tidy
- name: Cache testenv
uses: actions/cache@v2
with:
path: ${{ env.PATH }}/nexus-operator/testbin
key: ${{ runner.os }}-testbin-${{ env.OPERATOR_SDK_VERSION }}
restore-keys: |
${{ runner.os }}-testbin-${{ env.OPERATOR_SDK_VERSION }}
- name: Test Packages
run: make test
- name: Validate codcov yaml file
run: curl -vvv --data-binary @codecov.yml https://codecov.io/validate
- name: Send Coverage Report
uses: codecov/codecov-action@v1
with:
file: ./cover.out
flags: operator
name: operator-test
fail_ci_if_error: true
integration_tests:
name: Integration Tests
# we should wait for an ok from the other two
needs: [golint, unit_test]
runs-on: ubuntu-latest
env:
CLUSTER_NAME: operator-test
KIND_VERSION: v0.8.1
CREATE_NAMESPACE: false
NAMESPACE_E2E: default
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod/cache
key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-cache-
- name: Cache Binaries
uses: actions/cache@v2
with:
path: ~/go/bin/
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}
- name: Install Operator SDK
run: |
./hack/ci/install-operator-sdk.sh
- name: Install KIND
run: |
./hack/ci/install-kind.sh
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: Start KIND
run: ./hack/ci/start-kind.sh
- name: Generate Manifests
run: make bundle
- name: Build Operator Image
run: make operator-build BUILDER=docker
- name: Run Operator OLM Integration Test
run: make ci-olm-test