-
Notifications
You must be signed in to change notification settings - Fork 1.2k
319 lines (263 loc) · 10.4 KB
/
pika.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
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
name: Pika
on:
push:
branches: [ "unstable", "3.5" , "4.0"]
pull_request:
branches: [ "unstable", "3.5" , "4.0"]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
ARTIFACT_PIKA_NAME: artifact-pika
jobs:
build_on_ubuntu:
# The CMake configure and build commands are platform-agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.13
with:
key: ubuntu-latest
- name: Install Deps
run: |
sudo apt-get install -y autoconf libprotobuf-dev protobuf-compiler
sudo apt-get install -y clang-tidy-12
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
# Build your program with the given configuration
run: cmake --build build --config ${{ env.BUILD_TYPE }}
- name: Cleanup
run: |
rm -rf ./deps
rm -rf ./buildtrees
- uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_PIKA_NAME }}
path: ${{ github.workspace }}/build/pika
- name: Test
working-directory: ${{ github.workspace }}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{ env.BUILD_TYPE }}
- name: Unit Test
working-directory: ${{ github.workspace }}
run: ./pikatests.sh all
# master on port 9221, slave on port 9231, all with 2 db
- name: Start codis, pika master and pika slave
working-directory: ${{ github.workspace }}/build
run: |
chmod +x ../tests/integration/start_master_and_slave.sh
../tests/integration/start_master_and_slave.sh
chmod +x ../tests/integration/start_codis.sh
../tests/integration/start_codis.sh
- name: Run Go E2E Tests
working-directory: ${{ github.workspace }}/build
run: |
cd ../tools/pika_keys_analysis/
go test -v ./...
cd ../../tests/integration/
chmod +x integrate_test.sh
sh integrate_test.sh
build_on_rocky:
runs-on: ubuntu-latest
container:
image: rockylinux:9
steps:
- name: set up mirror
run: |
rm -rf /etc/yum.repos.d/CentOS-Base.repo
cat > /etc/yum.repos.d/CentOS-Base.repo << EOL
[base]
name=CentOS-\$releasever - Base
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/os/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[updates]
name=CentOS-\$releasever - Updates
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/updates/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[extras]
name=CentOS-\$releasever - Extras
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/extras/\$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[centosplus]
name=CentOS-\$releasever - Plus
baseurl=https://mirrors.aliyun.com/centos-vault/7.9.2009/centosplus/\$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
EOL
cat > /etc/yum.repos.d/CentOS-SCLo-scl.repo << EOL
[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/sclo/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-sclo-source]
name=CentOS-7 - SCLo sclo Source
baseurl=https://mirrors.aliyun.com/centos/7/sclo/Source/sclo/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
EOL
cat > /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo << EOL
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
[centos-sclo-rh-source]
name=CentOS-7 - SCLo rh Source
baseurl=https://mirrors.aliyun.com/centos/7/sclo/Source/rh/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
EOL
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-7
rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-SIG-SCLo
yum clean all
yum makecache
- name: Install deps
run: |
dnf update -y
dnf install -y bash cmake wget git autoconf gcc perl-Digest-SHA tcl which tar g++ tar epel-release gcc-c++ libstdc++-devel gcc-toolset-13
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure CMake
run: |
source /opt/rh/gcc-toolset-13/enable
cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address .
- uses: actions/cache@v3
with:
path: ${{ github.workspace }}/deps
key: ${{ runner.os }}-rocky-deps-${{ hashFiles('**/CMakeLists.txt') }}
- uses: actions/cache@v3
with:
path: ${{ github.workspace }}/buildtrees
key: ${{ runner.os }}-rocky-buildtrees-${{ hashFiles('**/CMakeLists.txt') }}
- name: Build
run: |
source /opt/rh/gcc-toolset-13/enable
cmake --build build --config ${{ env.BUILD_TYPE }}
- name: Cleanup
run: |
rm -rf ./deps
rm -rf ./buildtrees
- name: Test
working-directory: ${{ github.workspace }}/build
run: ctest -C ${{ env.BUILD_TYPE }}
- name: Unit Test
working-directory: ${{ github.workspace }}
run: ./pikatests.sh all
- name: Start codis, pika master and pika slave
working-directory: ${{ github.workspace }}/build
run: |
chmod +x ../tests/integration/start_master_and_slave.sh
../tests/integration/start_master_and_slave.sh
chmod +x ../tests/integration/start_codis.sh
../tests/integration/start_codis.sh
- name: Run Go E2E Tests
working-directory: ${{ github.workspace }}/build
run: |
cd ../tools/pika_keys_analysis/
go test -v ./...
cd ../../tests/integration/
chmod +x integrate_test.sh
sh integrate_test.sh
build_on_macos:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.13
with:
key: macos-12
- name: Install Deps
run: |
brew update
brew install --overwrite python@3.12 autoconf protobuf llvm wget git
brew install gcc@10 automake cmake make binutils
- name: Configure CMake
run: |
export CC=/usr/local/opt/gcc@10/bin/gcc-10
cmake -B build -DCMAKE_C_COMPILER=/usr/local/opt/gcc@10/bin/gcc-10 -DUSE_PIKA_TOOLS=ON -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address -D CMAKE_C_COMPILER_LAUNCHER=ccache -D CMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build
run: |
cmake --build build --config ${{ env.BUILD_TYPE }}
- name: Cleanup
run: |
rm -rf ./deps
rm -rf ./buildtrees
- name: Test
working-directory: ${{ github.workspace }}/build
run: ctest --rerun-failed --output-on-failure -C ${{ env.BUILD_TYPE }}
- name: Unit Test
working-directory: ${{ github.workspace }}
run: |
./pikatests.sh all
- name: Start codis, pika master and pika slave
working-directory: ${{ github.workspace }}/build
run: |
chmod +x ../tests/integration/start_master_and_slave.sh
../tests/integration/start_master_and_slave.sh
chmod +x ../tests/integration/start_codis.sh
../tests/integration/start_codis.sh
- name: Run Go E2E Tests
working-directory: ${{ github.workspace }}/build
run: |
cd ../tools/pika_keys_analysis/
go test -v ./...
cd ../../tests/integration/
chmod +x integrate_test.sh
sh integrate_test.sh
build_pika_image:
name: Build Pika Docker image
runs-on: ubuntu-latest
needs: build_on_ubuntu
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: pikadb/pika
- uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_PIKA_NAME }}
path: artifact/
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./ci/Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}