-
Notifications
You must be signed in to change notification settings - Fork 3
238 lines (197 loc) · 6.79 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
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
name: ci
on:
push:
branches:
- master
pull_request:
paths-ignore:
- "website/**"
jobs:
build:
name: build & test
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: setup environment
uses: ./.github/actions/setup
- name: check
run: cargo check
- name: "build (bin: conductor)"
run: cargo build --bin conductor --release
- name: "build (bin: cloudflare_worker_wasm)"
working-directory: bin/cloudflare_worker
run: cargo install -q worker-build && worker-build
- name: test
run: cargo test --workspace --exclude smoke_tests -- --nocapture
env:
RUST_BACKTRACE: full
- name: install node
uses: actions/setup-node@v4
with:
node-version: "20"
- name: install napi deps
working-directory: libs/napi
run: yarn install
- name: build napi lib
working-directory: libs/napi
run: yarn build
smoke-test:
name: smoke test
needs:
- build
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: setup environment
uses: ./.github/actions/setup
- name: run containers
working-directory: libs/smoke_tests/
run: docker compose -f docker-compose.yaml up -d --remove-orphans --wait --force-recreate
- uses: JarvusInnovations/background-action@v1
name: run test server in background
with:
run: cargo run
working-directory: tests/test-server
wait-on: http-get://127.0.0.1:4000
tail: true
wait-for: 10m
log-output-if: failure
log-output: true
- uses: JarvusInnovations/background-action@v1
name: run gateway in background (binary)
with:
run: cargo run --bin conductor -- ./libs/smoke_tests/test_gw.yaml
wait-on: http-get://127.0.0.1:9000/graphql
tail: true
wait-for: 15m
log-output-if: failure
log-output: true
- name: run tests (binary)
working-directory: libs/smoke_tests/
run: cargo test --features binary -- --nocapture
env:
CONDUCTOR_URL: http://127.0.0.1:9000
RUST_BACKTRACE: full
- name: restart containers
working-directory: libs/smoke_tests/
run: |
docker compose down
docker compose -f docker-compose.yaml up -d --remove-orphans --wait --force-recreate
- uses: the-guild-org/shared-config/setup@main
name: setup env (wasm)
with:
nodeVersion: 20
packageManager: pnpm
workingDirectory: bin/cloudflare_worker
packageManagerVersion: 8
- uses: JarvusInnovations/background-action@v1
name: run gateway in background (wasm)
with:
working-directory: bin/cloudflare_worker
run: pnpm start:smoke
wait-on: http-get://127.0.0.1:8787/graphql
tail: true
wait-for: 15m
log-output-if: failure
log-output: true
- name: run tests (wasm)
working-directory: libs/smoke_tests/
run: cargo test --features wasm -- --nocapture
env:
CONDUCTOR_URL: http://127.0.0.1:8787
RUST_BACKTRACE: full
graphql-over-http:
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: setup environment
uses: ./.github/actions/setup
- name: figure out versions
id: versions
working-directory: ./tests/graphql-over-http
run:
PNPM_VERSION=$(cat package.json | jq -r '.packageManager' | awk -F@ '{print $2}')
NODE_VERSION=$(cat package.json | jq -r '.engines.node' | awk -F= '{print $2}')
echo "pnpm=$PNPM_VERSION" >> $GITHUB_OUTPUT
echo "nodejs=$NODE_VERSION" >> $GITHUB_OUTPUT
- uses: the-guild-org/shared-config/setup@main
name: setup env
with:
nodeVersion: ${{ steps.versions.outputs.nodejs }}
packageManager: pnpm
packageManagerVersion: ${{ steps.versions.outputs.pnpm }}
workingDirectory: ./tests/graphql-over-http
- uses: JarvusInnovations/background-action@v1
with:
run: cargo run --bin conductor -- tests/graphql-over-http/config.yaml
wait-on: http-get://127.0.0.1:9000/graphql
tail: true
wait-for: 9m
log-output-if: failure
log-output: true
- uses: JarvusInnovations/background-action@v1
with:
run: cargo run --release
working-directory: tests/test-server
wait-on: http-get://127.0.0.1:4000
tail: true
wait-for: 9m
log-output-if: failure
log-output: true
- run: pnpm start
name: audit
working-directory: tests/graphql-over-http
env:
SERVER_URL: http://127.0.0.1:9000/graphql
config-json-schema:
runs-on: ubuntu-22.04
name: config-json-schema / integrity
steps:
- name: checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: setup environment
uses: ./.github/actions/setup
- name: generate config json schema
run: cargo run --bin generate-config-schema
- name: check diff
run: git diff --exit-code ./libs/config/conductor.schema.json
lint:
runs-on: ubuntu-22.04
name: rustfmt + clippy
steps:
- name: checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: setup environment
uses: ./.github/actions/setup
with:
components: rustfmt, clippy
- name: cargo fmt
run: cargo fmt --all -- --check
- uses: actions-rs/clippy-check@v1
name: cargo clippy
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
panic-free-audit:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: setup environment
uses: ./.github/actions/setup
- name: install panic free analyzer
run: cargo install panic-analyzer
- name: run panic free analyzer
run: cargo panic-analyzer > ./panic-audit.md
env:
IGNORED_CRATES: smoke_tests,e2e_tests,benches,server
IGNORED_FILES: ./plugins/jwt_auth/src/test.rs
- name: comment on pull request
uses: thollander/actions-comment-pull-request@v2
if: ${{ github.event_name == 'pull_request' }}
with:
filePath: ./panic-audit.md
comment_tag: rust-code-audit