-
Notifications
You must be signed in to change notification settings - Fork 209
222 lines (215 loc) · 6.47 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
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
# Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0.
name: CI
on:
merge_group:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- 'docs/**'
- 'etc/**'
- '**.md'
- '.dockerignore'
- 'docker/**'
pull_request:
paths-ignore:
- 'docs/**'
- 'etc/**'
- '**.md'
- '.dockerignore'
- 'docker/**'
# Common environment variables
env:
RUSTFLAGS: "-C debuginfo=1"
CARGO_TERM_COLOR: always
RUST_BACKTRACE: "1"
CERESMETA_IMAGE_NAME: ceresdb/ceresmeta-server:latest
CERESDB_IMAGE_NAME: ceresdb/ceresdb-server:latest
LOCK_FILE: Cargo.lock
RUST_VERSION: nightly-2023-02-02
jobs:
style-check:
name: style-check
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: |
rustup set auto-self-update disable
rustup toolchain install ${RUST_VERSION} --profile minimal
- name: Release Disk Quota
run: |
sudo rm -rf /usr/local/lib/android # release about 10 GB
sudo rm -rf /usr/share/dotnet # release about 20GB
- name: Cache Rust Dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo
./target
key: debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-
debug-${{ runner.os }}-
debug-
- name: Ensure Disk Quota
run: |
make ensure-disk-quota
- name: Setup Build Environment
run: |
sudo apt update
sudo apt install --yes protobuf-compiler
- name: Install clippy rustfmt
run: |
rustup component add clippy
rustup component add rustfmt
cargo install cargo-sort
- name: Run Style Check
run: |
make check-license
make clippy
make fmt
make check-cargo-toml
- name: Report Disk Usage
if: always()
run: |
du -sh ./target
df -h
unit-test:
name: unit-test
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
with:
submodules: true
- run: |
rustup set auto-self-update disable
rustup toolchain install ${RUST_VERSION} --profile minimal
- name: Release Disk Quota
run: |
sudo rm -rf /usr/local/lib/android # release about 10 GB
sudo rm -rf /usr/share/dotnet # release about 20GB
- name: Cache Rust Dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo
./target
key: debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-
debug-${{ runner.os }}-
debug-
- name: Setup Build Environment
run: |
sudo apt update
sudo apt install --yes protobuf-compiler
- name: Backup Lock File
run: |
cp ${LOCK_FILE} ${LOCK_FILE}.bak
- name: Run Unit Tests
run: |
make test-ut
echo "Checking if ${LOCK_FILE} has changed..."
- name: Check Lock File
run: |
diff ${LOCK_FILE} ${LOCK_FILE}.bak
integration-test:
name: integration-test
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache Rust Dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo
./target
key: debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-
debug-${{ runner.os }}-
debug-
- run: |
rustup set auto-self-update disable
rustup toolchain install ${RUST_VERSION} --profile minimal
- name: Release Disk Quota
run: |
sudo rm -rf /usr/local/lib/android # release about 10 GB
sudo rm -rf /usr/share/dotnet # release about 20GB
- name: Setup Build Environment
run: |
sudo apt update
sudo apt install --yes protobuf-compiler
- name: Run black-box tests
run: |
make integration-test
env:
RUST_BACKTRACE: "1"
- name: Upload Logs
if: always()
uses: actions/upload-artifact@v3
with:
name: CI-${{ github.head_ref }}.${{ github.sha }}
path: |
/tmp/ceresdb-stdout.log
/tmp/ceresmeta.log
/tmp/ceresdb-stdout-0.log
/tmp/ceresdb-stdout-1.log
sdk-test:
name: sdk-test
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Cache Rust Dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo
./target
key: debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-
debug-${{ runner.os }}-
debug-
- run: |
rustup set auto-self-update disable
rustup toolchain install ${RUST_VERSION} --profile minimal
- name: Release Disk Quota
run: |
sudo rm -rf /usr/local/lib/android # release about 10 GB
sudo rm -rf /usr/share/dotnet # release about 20GB
- name: Setup Build Environment
run: |
sudo apt update
sudo apt install --yes protobuf-compiler
- name: Build and Run CeresDB
run: |
make build-debug
nohup ./target/debug/ceresdb-server -c docs/minimal.toml > /tmp/ceresdb-stdout.log &
sleep 10
- name: Run Go SDK tests
working-directory: integration_tests
run: |
make run-go
- name: Run Java SDK tests
working-directory: integration_tests
run: |
make run-java
- name: Upload Logs
if: always()
uses: actions/upload-artifact@v3
with:
name: sdk-test-${{ github.head_ref }}.${{ github.sha }}
path: |
/tmp/ceresdb-stdout.log