forked from P4ndaFR/harbor-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (152 loc) · 4.66 KB
/
tests.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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Tests
on:
push:
branches:
- '**'
pull_request:
branches:
- master
jobs:
# Dockerfile tests
docker-build-test:
runs-on: ubuntu-latest
name: Build docker image
steps:
- uses: actions/checkout@v2
- run: make docker-build
docker-lint:
runs-on: ubuntu-latest
name: DockerLint
steps:
- name: Checkout
uses: actions/checkout@v2
- name: lint
uses: brpaz/hadolint-action@master
# Golang tests
go-lint:
runs-on: ubuntu-latest
name: GoLint
steps:
- uses: actions/checkout@v2
- name: Run golangci-lint
uses: actions-contrib/golangci-lint@v1
with:
golangci_lint_version: 1.22.2
go-dependencies:
runs-on: ubuntu-latest
name: Dependencies are up to date
steps:
- uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Checkout
uses: actions/checkout@v2
- run: go mod tidy
- run: go mod vendor
- run: go mod graph
- run: git status
- name: Check diff
run: test -z "$(git diff-index --diff-filter=d --name-only HEAD -- 'vendor' | grep -v 'vendor/modules.txt')"
check-generated-go-files:
runs-on: ubuntu-latest
name: Generated files are up to date
steps:
- uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Checkout
uses: actions/checkout@v2
- run: make generate
- name: Check diff
run: |
git restore -- vendor go.mod go.sum
git diff-index --exit-code --ignore-cr-at-eol HEAD
go-tests:
runs-on: ubuntu-latest
name: K8S v${{ matrix.k8sVersion }} (CM v${{ matrix.certManager }})
strategy:
fail-fast: false
matrix:
# https://github.com/jetstack/cert-manager/tags
certManager: ["0.12.0", "0.13.1", "0.14.2", "0.15.0-alpha.0"]
# https://snapcraft.io/microk8s
k8sVersion: ["1.15", "1.16", "1.17"]
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Install Kubernetes v${{ matrix.k8sVersion }}
run: |
sudo snap install microk8s --channel='${{ matrix.k8sVersion }}/stable' --classic
sudo microk8s.start
# https://microk8s.io/docs/addons
sudo microk8s.enable dns
- name: Wait for Kubernetes to be ready
timeout-minutes: 15
run: |
while [[ ! $(sudo microk8s.kubectl cluster-info) ]] ; do
echo "kubernetes not ready yet..." >&2
sleep 1
done
- name: Install CertManager v${{ matrix.certManager }}
run: |
# Try the recet way to install crd or fallback to the old one
version='${{ matrix.certManager }}'
shortVersion=""${version%.*}""
sudo microk8s.kubectl apply -f "https://github.com/jetstack/cert-manager/releases/download/v${version}/cert-manager.crds.yaml" ||
sudo microk8s.kubectl apply -f "https://raw.githubusercontent.com/jetstack/cert-manager/release-${shortVersion}/deploy/manifests/00-crds.yaml"
- uses: actions/checkout@v2
- name: go tests
run: |
export KUBECONFIG="$(realpath "$(mktemp kubeconfig.XXXXX)")"
export USE_EXISTING_CLUSTER="true"
sudo microk8s.config > "${KUBECONFIG}"
make test
# Kubernetes
crd-kubernetes-resources:
runs-on: ubuntu-latest
name: 'kubernetes_resources: ./config/crd'
steps:
- run: sudo apt-get install -y bzr # Required to install controller-gen in make manifests
- uses: actions/checkout@v2
- run: make manifests
- uses: azure/k8s-bake@v1
with:
renderEngine: 'kustomize'
kustomizationPath: './config/crd'
kubectl-version: 'latest'
operator-kubernetes-resources:
runs-on: ubuntu-latest
name: 'kubernetes_resources: ./config/default'
steps:
- run: sudo apt-get install -y bzr # Required to install controller-gen in make manifests
- uses: actions/checkout@v2
- run: make manifests
- uses: azure/k8s-bake@v1
with:
renderEngine: 'kustomize'
kustomizationPath: './config/default'
kubectl-version: 'latest'
samples-kubernetes-resources:
runs-on: ubuntu-latest
name: 'kubernetes_resources: ./config/samples'
steps:
- uses: actions/checkout@v2
- uses: azure/k8s-bake@v1
with:
renderEngine: 'kustomize'
kustomizationPath: './config/samples'
kubectl-version: 'latest'
# Documentation
md-lint:
runs-on: ubuntu-latest
name: 'documentation: lint'
steps:
- uses: actions/checkout@v2
- name: markdownlint-cli
uses: nosborn/[email protected]
with:
files: .
config_file: ".markdownlint.json"
ignore_files: "vendor"