Repository navigation
218 lines (193 loc) · 6.91 KB
/
Copy pathcli-cluster-e2e.yml
File metadata and controls
218 lines (193 loc) · 6.91 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
name: CLI Cluster E2E
on:
push:
branches: [ main ]
paths:
- 'cli/**'
- 'backend/crates/kalamdb-commons/**'
- 'backend/crates/kalamdb-dialect/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.cargo/config.toml'
- 'scripts/check-cli-dependency-boundary.py'
- 'scripts/cluster.sh'
- 'scripts/download-release-server.sh'
- 'scripts/resolve-latest-release-asset.py'
- 'versions.json'
- '.config/nextest.toml'
- '.github/workflows/cli-cluster-e2e.yml'
workflow_dispatch:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_VERSION: "1.99.1"
CARGO_ENCODED_RUSTFLAGS: ""
CARGO_INCREMENTAL: "0"
CARGO_PROFILE_DEV_DEBUG: "0"
CARGO_PROFILE_TEST_DEBUG: "0"
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: "off"
CARGO_PROFILE_TEST_SPLIT_DEBUGINFO: "off"
NEXTEST_PROFILE: ci
RUSTC_WRAPPER: ""
CARGO_BUILD_RUSTC_WRAPPER: ""
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
resolve_versions:
name: Resolve Cluster E2E Server Version
runs-on: ubuntu-latest
outputs:
root_version: ${{ steps.versions.outputs.root_version }}
latest_server_release_tag: ${{ steps.latest_server.outputs.release_tag }}
selected_server_version: ${{ steps.latest_server.outputs.selected_version }}
selected_server_selection_reason: ${{ steps.latest_server.outputs.selection_reason }}
latest_server_asset_name: ${{ steps.latest_server.outputs.asset_name }}
latest_server_asset_api_url: ${{ steps.latest_server.outputs.asset_api_url }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Verify versions.json
shell: bash
run: |
set -euo pipefail
python3 scripts/versions.py verify
- name: Resolve versions from versions.json
id: versions
shell: bash
run: |
set -euo pipefail
python3 scripts/versions.py github-outputs --github-output "$GITHUB_OUTPUT" --repository "$GITHUB_REPOSITORY"
- name: Resolve latest released server asset
id: latest_server
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
python3 scripts/resolve-latest-release-asset.py \
--repository "$GITHUB_REPOSITORY" \
--github-output "$GITHUB_OUTPUT" \
--token "$GITHUB_TOKEN" \
--preferred-version "${{ steps.versions.outputs.root_version }}" \
--asset-pattern '^kalamdb-server-.*-linux-x86_64\.tar\.gz$'
download_release_server_binary:
name: Download Released Cluster Server Binary
runs-on: ubuntu-latest
needs: resolve_versions
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download latest release server asset
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
mkdir -p target/release
bash scripts/download-release-server.sh \
"${{ needs.resolve_versions.outputs.latest_server_asset_name }}" \
"${{ needs.resolve_versions.outputs.latest_server_asset_api_url }}" \
"$PWD/target/release/kalamdb-server"
echo "Using cluster e2e server release ${{ needs.resolve_versions.outputs.latest_server_release_tag }} (${{ needs.resolve_versions.outputs.selected_server_version }}, ${{ needs.resolve_versions.outputs.selected_server_selection_reason }}) for requested version ${{ needs.resolve_versions.outputs.root_version }}"
- name: Upload released cluster server binary
uses: actions/upload-artifact@v6
with:
name: cluster-e2e-server-linux-x86_64
path: target/release/kalamdb-server
if-no-files-found: error
test:
name: CLI Cluster E2E
runs-on: ubuntu-latest
needs:
- resolve_versions
- download_release_server_binary
steps:
- name: Checkout
uses: actions/checkout@v6
# /tmp is an ~8G tmpfs on GitHub-hosted runners. Test databases belong
# on the root volume.
- name: Keep temporary files on the root disk
run: |
set -euo pipefail
mkdir -p "${GITHUB_WORKSPACE}/.ci-tmp"
echo "TMPDIR=${GITHUB_WORKSPACE}/.ci-tmp" >> "$GITHUB_ENV"
- name: Download released server binary
uses: actions/download-artifact@v6
with:
name: cluster-e2e-server-linux-x86_64
path: target/release
- name: Install system dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
clang \
libclang-dev \
pkg-config \
libssl-dev
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Cache Rust
uses: Swatinem/rust-cache@v2
with:
shared-key: cli-cluster-e2e
cache-on-failure: true
- name: Install cargo-nextest
shell: bash
run: |
set -euo pipefail
curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
cargo nextest --version
- name: Prepare released server binary
shell: bash
run: |
set -euo pipefail
chmod +x target/release/kalamdb-server
./target/release/kalamdb-server --version
echo "Cluster e2e server source: latest-release"
- name: Check CLI dependency boundary
run: python3 scripts/check-cli-dependency-boundary.py
- name: Build CLI and e2e artifacts together
run: cargo build --locked --profile test --bins --tests --timings -p kalam-cli -p kalam-cli-e2e
- name: Run cluster workspace-e2e workflow
shell: bash
env:
KALAMDB_ROOT_PASSWORD: kalamdb123
KALAMDB_ADMIN_PASSWORD: kalamdb123
run: |
set -euo pipefail
./scripts/cluster.sh workspace-e2e
- name: Print cluster logs
if: failure()
shell: bash
run: |
set -euo pipefail
for node in 1 2 3; do
echo "=== cluster node ${node} log ==="
cat ".cluster-local/node${node}/logs/stdout.log" || true
echo
done
- name: Upload compilation timings
if: always()
uses: actions/upload-artifact@v6
with:
name: cluster-cargo-timings
path: target/cargo-timings/
if-no-files-found: ignore
- name: Upload cluster logs
if: always()
uses: actions/upload-artifact@v6
with:
name: cli-cluster-e2e-logs
path: |
.cluster-local/node1/logs/stdout.log
.cluster-local/node2/logs/stdout.log
.cluster-local/node3/logs/stdout.log
cli/.env
if-no-files-found: warn