-
Notifications
You must be signed in to change notification settings - Fork 17
169 lines (157 loc) · 4.64 KB
/
ci.yml
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
name: CI
on:
merge_group:
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
K3D_VERSION: v5.4.3
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
unit_test:
name: Unit test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
rust: [stable]
steps:
- uses: actions/checkout@v4
- name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Run unit tests
run: cargo test --lib --all-features
unit_test_k8_client_feature_flags:
name: Unit test feature flags
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
rust: [stable]
features:
["openssl_tls,k8", "openssl_tls", "native_tls,k8", "native_tls", "rust_tls", "openssl_tls,memory_client"]
steps:
- uses: actions/checkout@v4
- name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: Run unit tests
run: cargo test --lib -p k8-client --no-default-features --features ${{ matrix.features }}
check_fmt:
name: check cargo fmt
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable]
steps:
- uses: actions/checkout@v4
- name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- name: fmt
run: make check-fmt
check_clippy:
name: clippy check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
rust: [stable]
steps:
- uses: actions/checkout@v4
- name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- name: clippy
run: make check-clippy
k8_integration_test:
name: Kubernetes integration test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
k8: [minikube, k3d, kind]
rust: [stable]
steps:
- uses: actions/checkout@v4
- name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.k8 }}
- name: Install Minikube for Github runner
if: startsWith(matrix.k8,'minikube')
uses: manusa/actions-setup-minikube@v2.11.0
with:
minikube version: "v1.33.1"
kubernetes version: "v1.30.2"
github token: ${{ secrets.GITHUB_TOKEN }}
driver: docker
- name: Install k3d
if: startsWith(matrix.k8,'k3d')
run: |
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=${{ env.K3D_VERSION }} bash
k3d cluster create fluvio-k3d --image rancher/k3s:v1.30.2-k3s2-amd64
- name: Install Kind
if: startsWith(matrix.k8,'kind')
run: |
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64
chmod +x ./kind
./kind create cluster
- name: Test K8 Installation
run: |
kubectl get nodes
kubectl config view
- name: Build test
run: cargo build --tests --all-features
- name: K8 client integration test native
run: make k8-client-integration-test-native
timeout-minutes: 2
done:
name: Done
needs:
- unit_test
- check_fmt
- check_clippy
- k8_integration_test
- unit_test_k8_client_feature_flags
runs-on: ubuntu-latest
steps:
- name: Dump needs context
env:
CONTEXT: ${{ toJson(needs) }}
run: |
echo -e "\033[33;1;4mDump context\033[0m"
echo -e "$CONTEXT\n"
- name: Report failure on cancellation
if: ${{ contains(needs.*.result, 'cancelled') || cancelled() }}
run: exit 1
- name: Failing test and build
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
- name: Don't allow skipped
if: ${{ contains(needs.*.result, 'skipped') && github.event_name == 'merge_group' }}
run: exit 1
- name: Successful test and build
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Done
run: echo "Done!"