-
Notifications
You must be signed in to change notification settings - Fork 491
380 lines (356 loc) · 12.1 KB
/
ci_mac.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
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# CI for Mac
# Not part of staging yet.
name: CI_Mac
permissions:
contents: read
concurrency:
group: ci-mac${{ github.ref }}
cancel-in-progress: true
on:
# pull_request:
# branches: [master]
# push:
# branches: [master]
workflow_dispatch:
inputs:
verbose:
description: "Set --verbose to get verbose build output"
required: false
default: ""
env:
VERBOSE: ${{ github.events.input.verbose }}
jobs:
config:
name: Set up Config
runs-on: ubuntu-latest
env:
ENABLE_CHECK: true
TEST_RUNS: "[r1]" # default runs
outputs:
check: ${{ steps.check.outputs.check }}
runs: ${{ steps.runs.outputs.runs }}
steps:
- id: check
run: echo "check=${{ env.ENABLE_CHECK }}" >> "$GITHUB_OUTPUT"
# Run all checks and unit test. This always run on debug mode
build_primary_binaries:
name: Primary build ${{ matrix.binary }} for ${{ matrix.rust-target }} on (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust-target:
- x86_64-apple-darwin
rust: [stable]
binary: [fluvio, fluvio-run, fluvio-test]
os: [macos-12]
include:
- os: ubuntu-latest
rust: stable
rust-target: x86_64-unknown-linux-musl
binary: fluvio
- os: ubuntu-latest
rust: stable
rust-target: x86_64-unknown-linux-musl
binary: fluvio-run
- os: ubuntu-latest
rust: stable
rust-target: x86_64-unknown-linux-musl
binary: fluvio-test
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
TARGET: ${{ matrix.rust-target }}
RUST_BIN_DIR: target/${{ matrix.rust-target }}/debug
RELEASE_NAME: debug
steps:
- uses: actions/checkout@v4
# If this job is being run by merge_group,
# then build and run in release mode
- name: Set RELEASE mode
if: github.event_name == 'merge_group'
shell: bash
run: |
echo "RELEASE=true" | tee -a $GITHUB_ENV
echo "RELEASE_NAME=release" | tee -a $GITHUB_ENV
echo "RUST_BIN_DIR=target/${{ matrix.rust-target }}/release" | tee -a $GITHUB_ENV
- name: Print env
run: |
echo "RUST_BIN_DIR = ${{ env.RUST_BIN_DIR }} "
- name: Install Rust ${{ matrix.rust }} toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- name: Install zig
run: ./actions/zig-install.sh ${{ matrix.os }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}-${{ matrix.binary }}
- name: Build fluvio
if: ${{ matrix.binary == 'fluvio' }}
run: |
brew install helm
make build-cli
timeout-minutes: 60
- name: Build fluvio-run
if: ${{ matrix.binary == 'fluvio-run' }}
run: make build-cluster
timeout-minutes: 60
- name: Build fluvio-test
if: ${{ matrix.binary == 'fluvio-test' }}
run: make build-test
timeout-minutes: 60
# Upload artifacts
- name: Upload artifact - ${{ matrix.binary }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary }}-${{ matrix.rust-target }}
path: ${{ env.RUST_BIN_DIR }}/${{ matrix.binary }}
local_cluster_test:
name: Local cluster test run (${{ matrix.run }})-${{ matrix.test }}
runs-on: ${{ matrix.os }}
needs:
- build_primary_binaries
- config
env:
UNINSTALL: noclean
FLUVIO_BIN: ~/bin/fluvio
TEST_BIN: ~/bin/fluvio-test
strategy:
fail-fast: false
matrix:
os: [macos-12]
rust-target: [x86_64-apple-darwin]
run: [r1]
spu: [1]
# run: ${{ fromJson(needs.config.outputs.runs )}}
steps:
- uses: actions/checkout@v4
- name: Download artifact - fluvio
uses: actions/download-artifact@v4
with:
name: fluvio-${{ matrix.rust-target }}
path: ~/bin
- name: Download artifact - fluvio-run
uses: actions/download-artifact@v4
with:
name: fluvio-run-${{ matrix.rust-target }}
path: ~/.fluvio/extensions
- run: chmod +x ~/.fluvio/extensions/fluvio-run
- name: Download artifact - fluvio-test
uses: actions/download-artifact@v4
with:
name: fluvio-test-${{ matrix.rust-target }}
path: ~/bin
- name: Set up Fluvio binaries
run: |
chmod +x ~/bin/fluvio ~/bin/fluvio-test ~/.fluvio/extensions/fluvio-run
echo "~/bin" >> $GITHUB_PATH
echo "DEFAULT_SPU=${{ matrix.spu }}" | tee -a $GITHUB_ENV
echo "REPL=${{ matrix.spu }}" | tee -a $GITHUB_ENV
- name: Print version
run: fluvio version
- name: Set up Docker for Mac
uses: docker-practice/actions-setup-docker@master
timeout-minutes: 5
- name: Install and start Kind
run: |
brew install kind
kind create cluster --config k8-util/cluster/kind.yaml
- name: Start fluvio cluster
timeout-minutes: 5
run: fluvio cluster start --local --develop --spu ${{ matrix.spu }} --rust-log fluvio=debug
- name: Run smoke-test
timeout-minutes: 5
run: |
date
make smoke-test-local
- name: Run diagnostics
if: ${{ !success() }}
timeout-minutes: 5
run: fluvio cluster diagnostics
- name: Upload diagnostics
uses: actions/upload-artifact@v4
timeout-minutes: 5
if: ${{ !success() }}
with:
name: local-${{ matrix.run }}-${{ matrix.test }}-diag
path: diagnostics*.gz
verify_cli_errors:
name: Verify error message output under CLI error condition
needs:
- build_primary_binaries
- config
runs-on: ${{ matrix.os }}
env:
UNINSTALL: noclean
FLUVIO_BIN: ~/bin/fluvio
TEST_BIN: ~/bin/fluvio-test
strategy:
fail-fast: false
matrix:
os: [macos-12]
rust-target: [x86_64-apple-darwin]
run: [r1]
spu: [1]
steps:
- uses: actions/checkout@v4
- name: Download artifact - fluvio
uses: actions/download-artifact@v4
with:
name: fluvio-${{ matrix.rust-target }}
path: ~/bin
- name: Download artifact - fluvio-run
uses: actions/download-artifact@v4
with:
name: fluvio-run-${{ matrix.rust-target }}
path: ~/.fluvio/extensions
- run: chmod +x ~/.fluvio/extensions/fluvio-run
- name: Download artifact - fluvio-test
uses: actions/download-artifact@v4
with:
name: fluvio-test-${{ matrix.rust-target }}
path: ~/bin
- name: Set up Fluvio binaries
run: |
chmod +x ~/bin/fluvio ~/bin/fluvio-test ~/.fluvio/extensions/fluvio-run
echo "~/bin" >> $GITHUB_PATH
echo "DEFAULT_SPU=${{ matrix.spu }}" | tee -a $GITHUB_ENV
echo "REPL=${{ matrix.spu }}" | tee -a $GITHUB_ENV
- name: Print version
run: fluvio version
- name: Set up Docker for Mac
uses: docker-practice/actions-setup-docker@master
timeout-minutes: 5
- name: Install and start Kind
run: |
brew install kind
kind create cluster --config k8-util/cluster/kind.yaml
- name: Start local fluvio cluster with bad --log-dir
timeout-minutes: 5
run: |
set +e
log_dir="/obviously/not/a/writable/path"
stderr="$(mktemp)"
echo "Starting cluster with '--log-dir=${log_dir}'"
fluvio cluster start --local --develop --skip-checks --log-dir "${log_dir}" 2> >(tee $stderr >&2)
[ $? -eq 0 ] && { echo "Expected nonzero exit code, got $?"; exit 2; }
grep -qF "${log_dir}" $stderr || { echo "Expected to find '${log_dir}' in stderr"; exit 3; }
# same as in ci.yaml except no aa64
build_image:
name: Build Fluvio Docker image
needs: build_primary_binaries
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust-target:
- x86_64-unknown-linux-musl
rust: [stable]
steps:
# Needed for k8-util/docker/build.sh
- uses: actions/checkout@v4
# Download artifacts
- name: Download fluvio-run
uses: actions/download-artifact@v4
with:
name: fluvio-run-${{ matrix.rust-target }}
path: .
- name: Print fluvio-run path
run: pwd && ls -la . && chmod +x ./fluvio-run && ./fluvio-run -h || true
# Build and upload docker image
- name: Build Docker image
run: k8-util/docker/build.sh ${{ matrix.rust-target }} ${{ github.sha }} "$(pwd)/fluvio-run"
- name: Export Docker Image to tarball
run: docker image save infinyon/fluvio:${{ github.sha }} --output /tmp/infinyon-fluvio-${{ matrix.rust-target }}.tar
- name: Upload tarball as artifact
uses: actions/upload-artifact@v4
with:
name: infinyon-fluvio-${{ matrix.rust-target }}.tar
path: /tmp/infinyon-fluvio-${{ matrix.rust-target }}.tar
k8_cluster_test:
name: Kubernetes cluster test run (${{ matrix.run }}) k8 (${{ matrix.k8 }})
needs: build_image
runs-on: ${{ matrix.os }}
env:
FLUVIO_BIN: ~/bin/fluvio
TEST_BIN: ~/bin/fluvio-test
UNINSTALL: noclean
DEFAULT_SPU: 1
REPL: 1
strategy:
fail-fast: false
matrix:
os: [macos-12]
rust-target: [x86_64-apple-darwin]
k8-target: [x86_64-unknown-linux-musl]
run: [r1]
k8: [kind]
spu: [1]
steps:
- uses: actions/checkout@v4
# Download artifacts
- name: Download artifact - fluvio
uses: actions/download-artifact@v4
with:
name: fluvio-${{ matrix.rust-target }}
path: ~/bin
- name: Download artifact - fluvio-test
uses: actions/download-artifact@v4
with:
name: fluvio-test-${{ matrix.rust-target }}
path: ~/bin
- name: Download Docker Image as Artifact
uses: actions/download-artifact@v4
with:
name: infinyon-fluvio-${{ matrix.k8-target }}.tar
path: /tmp
- name: Set up Fluvio binaries
run: |
chmod +x ~/bin/fluvio ~/bin/fluvio-test
echo "~/bin" >> $GITHUB_PATH
echo "DEFAULT_SPU=${{ matrix.spu }}" | tee -a $GITHUB_ENV
echo "REPL=${{ matrix.spu }}" | tee -a $GITHUB_ENV
- name: Set up Docker for Mac
uses: docker-practice/actions-setup-docker@master
timeout-minutes: 5
# Retag image to remove arch from tag
- name: Load Fluvio Docker Image for K3d
if: ${{ false }}
run: |
ls -la /tmp
docker image load --input /tmp/infinyon-fluvio-${{ matrix.k8-target }}.tar
docker image tag infinyon/fluvio:${{ github.sha }}-${{ matrix.k8-target }} infinyon/fluvio:${{ github.sha }}
docker image ls -a
- name: Install Kind
if: ${{ matrix.k8 == 'kind' }}
run: |
brew install kind
kind version
kind create cluster --config k8-util/cluster/kind.yaml
kind get clusters
- name: Load image to kind
if: ${{ matrix.k8 == 'kind' }}
run: |
kind load image-archive /tmp/infinyon-fluvio-${{ matrix.k8-target }}.tar
- name: Start Cluster
if: ${{ matrix.k8 == 'kind' }}
timeout-minutes: 3
run: |
fluvio cluster start --k8 --develop --spu-storage-size 1 --proxy-addr 127.0.0.1
# run a simpler configuration to run in a constraint mac
- name: Run smoke-test-k8
timeout-minutes: 3
run: |
date
make smoke-test-k8
- name: Run diagnostics
# if: ${{ !success() }}
timeout-minutes: 5
run: fluvio cluster diagnostics
- name: Upload diagnostics
timeout-minutes: 5
if: ${{ !success() }}
uses: actions/upload-artifact@v4
with:
name: k8_${{ matrix.run }}-${{ matrix.test }}-log
path: diagnostics*.gz