-
Notifications
You must be signed in to change notification settings - Fork 3
273 lines (273 loc) · 9.65 KB
/
Copy pathpr.yaml
File metadata and controls
273 lines (273 loc) · 9.65 KB
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
---
name: ci
"on":
pull_request: {}
push:
branches:
- staging
- trying
- master
env:
CI: 1
RUST_BACKTRACE: full
CARGO_INCREMENTAL: 0
CARGO_BUILD_PIPELINING: "false"
RUSTC_BOOTSTRAP: 1
DOCKER_BUILDKIT: 1
jobs:
hack:
name: hack
runs-on: ubuntu-18.04
steps:
- name: Success
run: "echo \"Success\""
helm:
name: helm
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Run helm lint
run: "helm lint k8s/jjs\n"
- name: Render chart
run: helm template k8s/jjs -f ci-data/helm-lint-values.yaml > ./objects.yaml
- name: Run Kube-score
run: "brew install kube-score/tap/kube-score\nkube-score score --ignore-test=container-resources objects.yaml\n"
- name: Run Polaris
run: "brew tap FairwindsOps/tap\nbrew install FairwindsOps/tap/polaris\n\necho \"--- Running polaris audir ---\"\npolaris audit --audit-path ./objects.yaml --format yaml || true\n"
cargo-deny:
name: cargo-deny
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check all
py-fmt:
name: py-fmt
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: "clippy,rustfmt"
override: true
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: check python code formatting
run: "pip3 install autopep8\ncd src\ncargo jjs-check --no-default --autopep8\n"
py-test:
name: py-test
runs-on: ubuntu-18.04
services:
mongo:
image: "mongo:4.2.6-bionic"
ports:
- "27017:27017"
env:
MONGODB_CONNECTION_STRING: "mongodb://localhost:27017"
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: run python tests
run: "pip3 install pytest\ncd src/apiserver\npip3 install -r requirements.txt\npython -m pytest\n"
misspell:
name: misspell
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: reviewdog/action-misspell@v1
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
locale: US
style:
name: style
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2020-08-28
components: "clippy,rustfmt"
override: true
- name: check rust code formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: "-- --check"
- name: Run shellcheck
run: cargo jjs-check --no-default --shellcheck
clippy:
name: clippy
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: "clippy,rustfmt"
override: true
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: "--workspace -- -Dwarnings"
cpp:
name: cpp
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Install system dependencies
run: sudo apt-get install -y libssl-dev cmake
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: "clippy,rustfmt"
override: true
- name: Install clang static analyzer
run: sudo apt install clang-tools
- name: compile testlib
run: cargo jjs-check --no-default --testlib
- name: Run static analyzer
run: cargo jjs-check --no-default --clang-analyzer
unit-tests:
name: unit-tests
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Install system dependencies
run: sudo apt-get install -y libssl-dev cmake
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: "clippy,rustfmt"
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
udeps:
name: udeps
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Install system dependencies
run: sudo apt-get install -y libssl-dev cmake
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: "clippy,rustfmt"
override: true
- name: Get Rust version
id: rustc_version
run: "rust_version=$(rustc --version | md5sum | cut -f 1-1 -d ' ')\necho \"##[set-output name=version;]$(echo $rust_version)\"\n"
- name: Fetch cargo-udeps
id: cache_udeps
uses: actions/cache@v1.1.0
with:
path: ~/udeps
key: "${{ runner.os }}-udeps-bin-${{ steps.rustc_version.outputs.version }}-v0.1.11"
- name: Install cargo-udeps
if: "steps.cache_udeps.outputs.cache-hit != 'true'"
run: "cargo install cargo-udeps --locked --version 0.1.11\nmkdir -p ~/udeps\ncp $( which cargo-udeps ) ~/udeps\n"
- name: Cache build dir
uses: actions/cache@v1.1.0
with:
path: target
key: "${{ runner.os }}-udeps-${{ steps.rustc_version.outputs.version }}-${{ hashFiles('Cargo.lock') }}"
- name: cargo-udeps
run: "export PATH=~/udeps:$PATH\ncargo udeps\n"
codegen:
name: codegen
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Free space
run: sudo bash ci-data/free-space.sh
- name: Install system dependencies
run: sudo apt-get install -y libssl-dev cmake
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2020-08-28
components: "clippy,rustfmt"
override: true
- name: Log into Github Package Registry
run: "echo \"${{ secrets.GITHUB_TOKEN }}\" | docker login docker.pkg.github.com -u jjs-dev --password-stdin"
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- run: pip install -r src/apiserver/requirements.txt
- run: cargo jjs codegen
- run: git diff --exit-code
- if: failure()
name: Collect some information
run: "echo Collecting git patch\ngit add .\n\ngit config --global user.email \"you@example.com\"\ngit config --global user.name \"Your Name\"\ngit commit --message \"temp\"\ngit show --patch > /tmp/patch\n"
- if: failure()
name: Upload patch
uses: actions/upload-artifact@v2
with:
name: codegen-diff
path: /tmp/patch
smoke:
name: smoke
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install system dependencies
run: sudo apt-get install -y libssl-dev cmake
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: "clippy,rustfmt"
override: true
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Get Rust version
id: rustc_version
run: "rust_version=$(rustc --version | md5sum | cut -f 1-1 -d ' ')\necho \"##[set-output name=version;]$(echo $rust_version)\"\n"
- name: Cache build dir
uses: actions/cache@v2
with:
path: target
key: "${{ runner.os }}-smoke-${{ steps.rustc_version.outputs.version }}-${{ hashFiles('Cargo.lock') }}"
- name: Build jjs images
run: "mkdir artifacts\nDOCKER_OPT=\"--enable-docker --docker-tag=% --with-docker=docker\"\nFEAT_OPT=\"--enable-feature k8s\"\nCOMPONENT_OPT=\"--enable daemons --enable tools\"\ncargo jjs-build --out artifacts $DOCKER_OPT $FEAT_OPT $COMPONENT_OPT\n"
- name: Setup k3s
run: "curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig ~/.kube/config --docker\nsudo chown $( whoami ) ~/.kube/config\n"
- name: Install dependencies
run: "helm repo add bitnami https://charts.bitnami.com/bitnami\nhelm install mongodb bitnami/mongodb -f ci-data/mongodb-values.yaml --wait --timeout 75s\n"
- name: Install jjs
run: "helm install jjs k8s/jjs --wait --values ci-data/values.yaml --timeout 75s\nkubectl wait --for condition=complete --timeout 90s jobs/init \n"
- name: Run tests
run: "cd smoke\nJP=\"{.spec.ports[0].nodePort}\"\nexport JJS_API=\"http://localhost:$( kubectl get svc apiserver \"--output=jsonpath=$JP\" )\"\nexport JJS_BEARER=Dev::root\npip install -r requirements.txt\n\npython -m pytest .\n"
- name: Collect debugging information
if: failure()
run: "mkdir /tmp/kdump\nMOUNT1=\"--mount type=bind,source=/tmp/kdump,target=/dump\"\nMOUNT2=\"--mount type=bind,source=/home/runner/.kube,target=/kube\"\nDUMP_OPTS=\"--escape-paths --generic-strip=managed-fields\"\ndocker run -i --rm $MOUNT1 $MOUNT2 --network host mikailbag/kube-dump /dump $DUMP_OPTS\n\nhelm get manifest jjs > /tmp/rendered-objects\n"
- name: Upload cluster state dump
if: failure()
uses: actions/upload-artifact@v2
with:
name: kube-dump
path: /tmp/kdump
- name: Upload rendered manifests
if: failure()
uses: actions/upload-artifact@v2
with:
name: helm-manifests
path: /tmp/rendered-objects