forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 2
220 lines (214 loc) · 7.29 KB
/
ci-build.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
name: CI
on:
push:
branches:
- "master"
- "release-*"
- "!release-2.8"
pull_request:
branches:
- "master"
jobs:
tests:
name: Unit Tests
runs-on: ubuntu-20.04
# 5m30
timeout-minutes: 7
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.16"
- uses: actions/cache@v2
with:
path: /home/runner/.cache/go-build
key: GOCACHE-v2-${{ hashFiles('**/go.mod') }}
- uses: actions/cache@v2
with:
path: /home/runner/go/pkg/mod
key: GOMODCACHE-v2-${{ hashFiles('**/go.mod') }}
- run: go mod download -x
- run: make server/static/files.go STATIC_FILES=false
- run: go build -v ./...
- run: make test STATIC_FILES=false GOTEST='go test -covermode=atomic -coverprofile=coverage.out'
- run: bash <(curl -s https://codecov.io/bash)
e2e-tests:
name: E2E Tests
runs-on: ubuntu-20.04
timeout-minutes: 20
env:
KUBECONFIG: /home/runner/.kubeconfig
strategy:
fail-fast: false
matrix:
include:
- test: test-api
containerRuntimeExecutor: emissary
profile: mysql
- test: test-cli
containerRuntimeExecutor: emissary
profile: mysql
- test: test-cron
containerRuntimeExecutor: emissary
profile: minimal
- test: test-executor
containerRuntimeExecutor: docker
profile: minimal
- test: test-executor
containerRuntimeExecutor: emissary
profile: minimal
- test: test-executor
containerRuntimeExecutor: k8sapi
profile: minimal
- test: test-executor
containerRuntimeExecutor: kubelet
profile: minimal
- test: test-executor
containerRuntimeExecutor: pns
profile: minimal
- test: test-functional
containerRuntimeExecutor: emissary
profile: minimal
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.16"
- uses: actions/cache@v2
with:
path: /home/runner/.cache/go-build
key: GOCACHE-v2-${{ hashFiles('**/go.mod') }}
- uses: actions/cache@v2
with:
path: /home/runner/go/pkg/mod
key: GOMODCACHE-v2-${{ hashFiles('**/go.mod') }}
- uses: actions/cache@v2
with:
path: /home/runner/go/bin
key: go-bin-v1-${{ hashFiles('**/go.mod') }}
- uses: actions/cache@v2
with:
path: dist/kustomize
key: kustomize
- run: mkdir -p /tmp/log/argo-e2e
- name: Install and start K3S
timeout-minutes: 3
run: |
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.21.2+k3s1 INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC=--docker K3S_KUBECONFIG_MODE=644 sh -
until kubectl --kubeconfig=/etc/rancher/k3s/k3s.yaml cluster-info ; do sleep 10s ; done
cp /etc/rancher/k3s/k3s.yaml /home/runner/.kubeconfig
echo "- name: fake_token_user" >> $KUBECONFIG
echo " user:" >> $KUBECONFIG
echo " token: xxxxxx" >> $KUBECONFIG
until kubectl cluster-info ; do sleep 10s ; done
- name: Set-up /etc/hosts
run: |
echo '127.0.0.1 dex' | sudo tee -a /etc/hosts
echo '127.0.0.1 minio' | sudo tee -a /etc/hosts
echo '127.0.0.1 postgres' | sudo tee -a /etc/hosts
echo '127.0.0.1 mysql' | sudo tee -a /etc/hosts
- run: make install controller cli $(go env GOPATH)/bin/goreman PROFILE=${{matrix.profile}} E2E_EXECUTOR=${{matrix.containerRuntimeExecutor}} AUTH_MODE=client STATIC_FILES=false LOG_LEVEL=info
- run: make start PROFILE=${{matrix.profile}} E2E_EXECUTOR=${{matrix.containerRuntimeExecutor}} AUTH_MODE=client STATIC_FILES=false LOG_LEVEL=info UI=false > /tmp/log/argo-e2e/argo.log 2>&1 &
timeout-minutes: 4
- name: make argoexec-image
run: make argoexec-image STATIC_FILES=false
- run: make wait
timeout-minutes: 4
- run: make ${{matrix.test}} E2E_TIMEOUT=1m STATIC_FILES=false
- name: cat argo.log
if: ${{ failure() }}
run: cat /tmp/log/argo-e2e/argo.log
codegen:
name: Codegen
runs-on: ubuntu-20.04
needs: [ tests ]
timeout-minutes: 9
env:
GOPATH: /home/runner/go
PROTOC_ZIP: protoc-3.11.1-linux-x86_64.zip
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.16"
- uses: actions/cache@v2
with:
path: /home/runner/.cache/go-build
key: GOCACHE-v2-${{ hashFiles('**/go.mod') }}
- uses: actions/cache@v2
with:
path: /home/runner/go/pkg/mod
key: GOMODCACHE-v2-${{ hashFiles('**/go.mod') }}
- uses: actions/cache@v2
with:
path: /home/runner/go/bin
key: go-bin-v1-${{ hashFiles('**/go.mod') }}
- uses: actions/cache@v2
with:
path: protoc-3.11.1-linux-x86_64.zip
key: protoc-3.11.1-linux-x86_64.zip
- name: Install protoc
run: |
set -eux -o pipefail
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.11.1/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
sudo chmod +x /usr/local/bin/protoc
sudo find /usr/local/include -type f | xargs sudo chmod a+r
sudo find /usr/local/include -type d | xargs sudo chmod a+rx
ls /usr/local/include/google/protobuf/
- name: Create links
run: |
mkdir -p /home/runner/go/src/github.com/argoproj
ln -s "$PWD" /home/runner/go/src/github.com/argoproj/argo-workflows
- run: make codegen -B STATIC_FILES=false
- run: make validate-examples STATIC_FILES=false
- run: git diff --exit-code
lint:
name: Lint
runs-on: ubuntu-20.04
needs: [ tests, codegen ]
timeout-minutes: 5
env:
GOPATH: /home/runner/go
steps:
- uses: actions/checkout@v2
- run: cp server/static/files.go.stub server/static/files.go
- uses: golangci/golangci-lint-action@v2
with:
version: v1.36.0
security:
name: Security Scan
runs-on: ubuntu-20.04
needs: [ tests, codegen, lint ]
timeout-minutes: 6
env:
GOPATH: /home/runner/go
steps:
- name: Checkout Source
uses: actions/checkout@v2
- run: cp server/static/files.go.stub server/static/files.go
- name: Run Gosec Security Scanner
uses: securego/[email protected]
with:
args: '-include=G307,G304 ./...'
ui:
name: UI
runs-on: ubuntu-20.04
timeout-minutes: 6
env:
NODE_OPTIONS: --max-old-space-size=4096
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "14"
- uses: actions/cache@v2
with:
path: ui/node_modules
key: ${{ runner.os }}-node-dep-v1-${{ hashFiles('**/yarn.lock') }}
- run: yarn --cwd ui install
- run: yarn --cwd ui build
- run: yarn --cwd ui test
- run: yarn --cwd ui lint
- run: git diff --exit-code