-
Notifications
You must be signed in to change notification settings - Fork 1.2k
259 lines (251 loc) · 9.22 KB
/
rc.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
name: rc
on:
workflow_dispatch:
inputs:
version:
description: "version such as '3.1.0'"
required: true
concurrency:
group: rc
cancel-in-progress: true
defaults:
run:
shell: bash
env:
OSS_DIR: minio/rc-build/nebula-graph
jobs:
package:
name: build package
runs-on: [self-hosted, nebula]
strategy:
fail-fast: false
matrix:
os:
- ubuntu1604
- ubuntu1804
- ubuntu2004
- centos7
- centos8
container:
image: vesoft/nebula-dev:${{ matrix.os }}
env:
BUILD_DIR: ./pkg-build
CPACK_DIR: ./pkg-build/cpack_output
SYMS_DIR: ./pkg-build/symbols
steps:
- uses: webiny/[email protected]
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 'stable'
cache-dependency-path: nebula-console/go.sum
- id: tag
run: echo tagnum=${{ github.event.inputs.version }} >> $GITHUB_OUTPUT
- name: package
run: ./package/package.sh -v ${{ steps.tag.outputs.tagnum }}
- name: output some vars
run: |
tar zcf ${{ env.CPACK_DIR }}/nebula-graph-${{ steps.tag.outputs.tagnum }}.tar.gz --exclude=${{ env.BUILD_DIR }} ./*
find ${{ env.CPACK_DIR }} -type f \( -iname \*.deb -o -iname \*.rpm -o -iname \*.tar.gz \) -exec bash -c "sha256sum {} > {}.sha256sum.txt" \;
- uses: vesoft-inc/.github/actions/setup-minio@master
with:
minio_url: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_KEY }}
secret_key: ${{ secrets.MINIO_SECRET }}
- name: Copy dir to MinIO
run: |
mc cp -r ${{ env.CPACK_DIR }}/ ${{ env.OSS_DIR }}/${{ steps.tag.outputs.tagnum }}/
mc cp -r ${{ env.SYMS_DIR }}/ ${{ env.OSS_DIR }}/${{ steps.tag.outputs.tagnum }}/symbols/
docker_build:
needs: package
name: docker-build
runs-on: [self-hosted, nebula]
steps:
- uses: webiny/[email protected]
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- id: tagname
run: |
echo tag="v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo tagnum="${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo majorver="v$(echo ${{ github.event.inputs.version }} | cut -f1 -d'.')" >> $GITHUB_OUTPUT
- id: docker
run: |
graphdTag=""
storagedTag=""
metadTag=""
toolsTag=""
majorver=$(git tag -l --sort=v:refname | tail -n1 | cut -f1 -d".")
if [[ $majorver == ${{ steps.tagname.outputs.majorver }} ]]; then
graphdTag="${{ secrets.HARBOR_REGISTRY }}/rc/nebula-graphd:latest"
storagedTag="${{ secrets.HARBOR_REGISTRY }}/rc/nebula-storaged:latest"
metadTag="${{ secrets.HARBOR_REGISTRY }}/rc/nebula-metad:latest"
toolsTag="${{ secrets.HARBOR_REGISTRY }}/rc/nebula-tools:latest"
fi
echo "graphdTag=$graphdTag" >> $GITHUB_OUTPUT
echo "storagedTag=$storagedTag" >> $GITHUB_OUTPUT
echo "metadTag=$metadTag" >> $GITHUB_OUTPUT
echo "toolsTag=$toolsTag" >> $GITHUB_OUTPUT
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ${{ secrets.HARBOR_REGISTRY }}
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASSWORD }}
- name: docker-graph
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-graphd:${{ steps.tagname.outputs.tag }}
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-graphd:${{ steps.tagname.outputs.majorver }}
${{ steps.docker.outputs.graphdTag }}
target: graphd
cache-to: type=local,dest=/tmp/buildx-cache,mode=max
push: true
build-args: |
BRANCH=${{ steps.tagname.outputs.tag }}
VERSION=${{ steps.tagname.outputs.tagnum }}
- name: docker-storage
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-storaged:${{ steps.tagname.outputs.tag }}
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-storaged:${{ steps.tagname.outputs.majorver }}
${{ steps.docker.outputs.storagedTag }}
target: storaged
push: true
cache-from: type=local,src=/tmp/buildx-cache
build-args: |
BRANCH=${{ steps.tagname.outputs.tag }}
VERSION=${{ steps.tagname.outputs.tagnum }}
- name: docker-meta
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-metad:${{ steps.tagname.outputs.tag }}
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-metad:${{ steps.tagname.outputs.majorver }}
${{ steps.docker.outputs.metadTag }}
target: metad
push: true
cache-from: type=local,src=/tmp/buildx-cache
build-args: |
BRANCH=${{ steps.tagname.outputs.tag }}
VERSION=${{ steps.tagname.outputs.tagnum }}
- name: docker-tool
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: |
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-tools:${{ steps.tagname.outputs.tag }}
${{ secrets.HARBOR_REGISTRY }}/rc/nebula-tools:${{ steps.tagname.outputs.majorver }}
${{ steps.docker.outputs.toolsTag }}
target: tools
push: true
cache-from: type=local,src=/tmp/buildx-cache
build-args: |
BRANCH=${{ steps.tagname.outputs.tag }}
VERSION=${{ steps.tagname.outputs.tagnum }}
- name: delete the cache
run: |
rm -rf /tmp/buildx-cache
test:
name: test
needs: package
runs-on: [self-hosted, nebula]
strategy:
fail-fast: false
matrix:
os:
- ubuntu1804
- ubuntu2004
- centos7
- centos8
extra_config:
- "ENABLE_SSL=true CA_SIGNED=true QUERY_CONCURRENTLY=false"
- "ENABLE_SSL=false CA_SIGNED=false QUERY_CONCURRENTLY=true"
container:
image: vesoft/nebula-dev:${{ matrix.os }}
steps:
- uses: webiny/[email protected]
with:
run: sh -c "find . -mindepth 1 -delete"
- uses: actions/checkout@v3
- id: tag
run: echo tagnum=${{ github.event.inputs.version }} >> $GITHUB_OUTPUT
- id: oss_package
run: |
case ${{ matrix.os }} in
ubuntu1804)
echo "p=nebula-graph-${{ steps.tag.outputs.tagnum }}.ubuntu1804.amd64.tar.gz" >> $GITHUB_OUTPUT
;;
ubuntu2004)
echo "p=nebula-graph-${{ steps.tag.outputs.tagnum }}.ubuntu2004.amd64.tar.gz" >> $GITHUB_OUTPUT
;;
centos7)
echo "p=nebula-graph-${{ steps.tag.outputs.tagnum }}.el7.x86_64.tar.gz" >> $GITHUB_OUTPUT
;;
centos8)
echo "p=nebula-graph-${{ steps.tag.outputs.tagnum }}.el8.x86_64.tar.gz" >> $GITHUB_OUTPUT
;;
esac
- name: Prepare environment
id: prepare
run: |
[ -d build/ ] && rm -rf build/* || mkdir -p build
make init -C tests
- name: CMake
id: cmake
run: |
echo "j=8" >> $GITHUB_OUTPUT
- uses: vesoft-inc/.github/actions/setup-minio@master
with:
minio_url: ${{ secrets.MINIO_ENDPOINT }}
access_key: ${{ secrets.MINIO_KEY }}
secret_key: ${{ secrets.MINIO_SECRET }}
- name: Copy dir from MinIO
run: |
mc cp ${{ env.OSS_DIR }}/${{ steps.tag.outputs.tagnum }}/${{ steps.oss_package.outputs.p }} build/
tar zxvf build/${{ steps.oss_package.outputs.p }} -C build
d=`echo ${{ steps.oss_package.outputs.p }} | sed 's/.tar.gz//'`
mv build/${d}/* build/.
- name: Setup cluster
run: |
make CONTAINERIZED=true ${{ matrix.extra_config }} up
working-directory: tests/
timeout-minutes: 2
- name: Pytest
run: |
make RM_DIR=false DEBUG=false J=${{ steps.cmake.outputs.j }} test
working-directory: tests/
timeout-minutes: 15
- name: TCK
run: |
make RM_DIR=false DEBUG=false J=${{ steps.cmake.outputs.j }} tck
working-directory: tests/
timeout-minutes: 60
- name: Down cluster
run: |
make RM_DIR=false down
working-directory: tests/
timeout-minutes: 2
- name: Upload logs
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: ${{ matrix.os }}-${{ matrix.compiler }}-nebula-test-logs
path: ./build/server_*/logs*/