forked from trustification/trustification
-
Notifications
You must be signed in to change notification settings - Fork 1
198 lines (175 loc) · 5.68 KB
/
ci.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
name: CI
on:
push:
# Run on the main branch
branches:
- main
- stable
# Also on PRs, just be careful not to publish anything
pull_request:
branches:
- main
- stable
# Allow to be called from other workflows (like "release")
workflow_call:
# But don't trigger on tags, as they are covered by the "release.yaml" workflow
# The overall idea is to be quick, but re-use output from previous steps.
# The quickest checks is formatting, so we do that first. Next is integration, and ci. For ci we split up backend
# and frontend, because they are somewhat independent.
#
# For the backend part, we run check, clippy, and test as they build upon each other. For the frontend, we run
# check and clippy, but test as a dedicated job, as we don't have a WASM test runner. Yet, check and clippy for wasm32
# are different.
jobs:
formatting:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Check formatting
run: |
cargo fmt --check
cargo fmt --check --manifest-path bommer/bommer-ui/Cargo.toml
cargo fmt --check --manifest-path spog/ui/Cargo.toml
uncommitted:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Check if templates have uncommitted changes
run: |
pip3 install yq
make -C deploy/openshift
git diff --quiet deploy/openshift
if [ $? -gt 0 ]; then
echo "::error::Uncommitted changes to deploy/openshift (most likely template must be updated by running `make`)"
exit 1
fi
helm-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: azure/setup-helm@v3
with:
version: v3.13.2
- name: add helm repositories
working-directory: deploy/k8s
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: install helm dependencies
working-directory: deploy/k8s
run: |
helm dependency build chart/
- name: helm-lint (staging)
working-directory: deploy/k8s
run: |
helm lint ./chart -f ./chart/trustification.dev/staging.yaml
- name: helm-lint (prod)
working-directory: deploy/k8s
run: |
helm lint ./chart -f ./chart/trustification.dev/prod.yaml
ci-backend:
runs-on: ubuntu-22.04
needs:
- formatting
steps:
- uses: actions/checkout@v4
- run: rustup component add clippy
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
bommer/bommer-ui/target/
spog/ui/target/
key: ${{ runner.os }}-cargo-backend-${{ hashFiles('**/Cargo.lock') }}
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get install -y libsasl2-dev
- name: Check
run: cargo check
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Test
run: cargo test
ci-frontend-check:
runs-on: ubuntu-22.04
needs:
- formatting
steps:
- uses: actions/checkout@v4
- run: rustup component add clippy
- run: rustup target add wasm32-unknown-unknown
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
bommer/bommer-ui/target/
spog/ui/target/
key: ${{ runner.os }}-cargo-frontend-check-${{ hashFiles('**/Cargo.lock') }}
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check
run: |
cargo check --target wasm32-unknown-unknown --manifest-path bommer/bommer-ui/Cargo.toml
cargo check --target wasm32-unknown-unknown --manifest-path spog/ui/Cargo.toml
- name: Clippy
run: |
cargo clippy --target wasm32-unknown-unknown --all-targets --all-features --manifest-path bommer/bommer-ui/Cargo.toml -- -D warnings
cargo clippy --target wasm32-unknown-unknown --all-targets --all-features --manifest-path spog/ui/Cargo.toml -- -D warnings
ci-frontend-test:
runs-on: ubuntu-22.04
needs:
- formatting
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
bommer/bommer-ui/target/
spog/ui/target/
key: ${{ runner.os }}-cargo-frontend-test-${{ hashFiles('**/Cargo.lock') }}
- name: Test
run: |
cargo test --manifest-path bommer/bommer-ui/Cargo.toml
cargo test --manifest-path spog/ui/Cargo.toml
integration:
needs:
- formatting
uses: ./.github/workflows/integration.yaml
# A virtual job, referenced by the branch protection rule
ci:
runs-on: ubuntu-22.04
needs:
- ci-backend
- ci-frontend-check
- ci-frontend-test
- integration
- helm-lint
- uncommitted
steps:
- run: echo 🎉