-
Notifications
You must be signed in to change notification settings - Fork 965
260 lines (232 loc) · 10.6 KB
/
unittests.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: "unittests"
on:
push:
branches:
- 'main'
- 'release-*'
paths-ignore:
- 'docs/**'
- '**.md'
pull_request:
#The branches below must be a subset of the branches above
branches:
- 'main'
- 'release-*'
paths-ignore:
- 'docs/**'
- '**.md'
- '.github/**'
workflow_dispatch:
inputs:
debug:
type: boolean
description: "Run the build with tmate debugging enabled"
required: false
default: false
jobs:
unittests:
strategy:
fail-fast: false
matrix:
test: [ 'test.meta.core','test.meta.non-core','test.pkg','test.cmd', 'test.fdb' ]
timeout-minutes: 60
runs-on: ubuntu-20.04
env:
MINIO_TEST_BUCKET: 127.0.0.1:9000/testbucket
MINIO_ACCESS_KEY: testUser
MINIO_SECRET_KEY: testUserPassword
GLUSTER_VOLUME: jfstest/gv0
DISPLAY_PROGRESSBAR: false
HDFS_ADDR: localhost:8020
SFTP_HOST: localhost:2222:/upload/
SFTP_USER: root
SFTP_PASS: password
WEBDAV_TEST_BUCKET: 127.0.0.1:9007
TIKV_ADDR: 127.0.0.1
REDIS_ADDR: redis://127.0.0.1:6379/13
ETCD_ADDR: 127.0.0.1:3379
MYSQL_ADDR: (127.0.0.1:3306)/dev
MYSQL_USER: root
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Build
uses: ./.github/actions/build
- name: Install Packages
run: |
sudo .github/scripts/apt_install.sh g++-multilib redis-server libacl1-dev attr glusterfs-server libglusterfs-dev
sudo mkdir -p /home/travis/.m2/
- if: matrix.test == 'test.meta.non-core'
name: Install redis-cluster
uses: vishnudxb/[email protected]
with:
master1-port: 7000
master2-port: 7001
master3-port: 7002
slave1-port: 7003
slave2-port: 7004
slave3-port: 7005
- name: Prepare Database
run: |
case "${{matrix.test}}" in
"test.meta.core")
# tikv
wget -O /home/travis/.m2/install.sh https://tiup-mirrors.pingcap.com/install.sh
bash /home/travis/.m2/install.sh
source /home/runner/.bash_profile
tiup -v
nohup tiup playground --mode tikv-slim >> output.log 2>&1 &
sleep 30
# mysql
sudo service mysql start
sudo mysql -uroot -proot -e "use mysql;alter user 'root'@'localhost' identified with mysql_native_password by '';"
sudo mysql -e "create database dev;"
for i in {2379,3306}; do
echo "lsof port:"$i
sudo lsof -i :$i && continue || sleep 5
sudo lsof -i :$i || ( echo "service not ready, port:$i" && exit 1 )
done
;;
"test.meta.non-core")
# postgres
sudo service postgresql start
sudo chmod 777 /etc/postgresql/*/main/pg_hba.conf
sudo sed -i "s?local.*all.*postgres.*peer?local all postgres trust?" /etc/postgresql/*/main/pg_hba.conf
sudo sed -i "s?host.*all.*all.*32.*scram-sha-256?host all all 127.0.0.1/32 trust?" /etc/postgresql/*/main/pg_hba.conf
sudo sed -i "s?host.*all.*all.*128.*scram-sha-256?host all all ::1/128 trust?" /etc/postgresql/*/main/pg_hba.conf
cat /etc/postgresql/*/main/pg_hba.conf
sudo service postgresql restart
psql -c "create user runner superuser;" -U postgres
sudo service postgresql restart
psql -c 'create database test;' -U postgres
# etcd
docker run -d \
-p 3379:2379 \
-p 3380:2380 \
--name etcd_3_5_7 \
quay.io/coreos/etcd:v3.5.7 \
/usr/local/bin/etcd --data-dir=/etcd-data --name node1 \
--listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://0.0.0.0:2379 \
--listen-peer-urls http://0.0.0.0:2380 \
--initial-advertise-peer-urls http://0.0.0.0:2380 \
--initial-cluster node1=http://0.0.0.0:2380
# keydb
echo "deb https://download.keydb.dev/open-source-dist $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/keydb.list
sudo wget -O /etc/apt/trusted.gpg.d/keydb.gpg https://download.keydb.dev/open-source-dist/keyring.gpg
sudo .github/scripts/apt_install.sh keydb
keydb-server --storage-provider flash /tmp/ --port 6378 --bind 127.0.0.1 --daemonize yes
keydb-server --port 6377 --bind 127.0.0.1 --daemonize yes
for i in {3379,6377,6378}; do
echo "lsof port:"$i
sudo lsof -i :$i && continue || sleep 5
sudo lsof -i :$i || ( echo "service not ready, port:$i" && exit 1 )
done
;;
"test.cmd")
# minio
docker run -d -p 9000:9000 -p 9001:9001 -e "MINIO_ROOT_USER=testUser" -e "MINIO_ROOT_PASSWORD=testUserPassword" quay.io/minio/minio:RELEASE.2022-01-25T19-56-04Z server /data --console-address ":9001"
# mc
go install github.com/minio/[email protected] && mc config host add local http://127.0.0.1:9000 testUser testUserPassword && mc mb local/testbucket
# litmus is used to test webdav
wget -O /home/travis/.m2/litmus-0.13.tar.gz http://www.webdav.org/neon/litmus/litmus-0.13.tar.gz
tar -zxvf /home/travis/.m2/litmus-0.13.tar.gz -C /home/travis/.m2/
cd /home/travis/.m2/litmus-0.13/ && ./configure && make && cd -
;;
"test.fdb")
# foundationdb
wget -O /home/travis/.m2/foundationdb-clients_6.3.23-1_amd64.deb https://github.com/apple/foundationdb/releases/download/6.3.23/foundationdb-clients_6.3.23-1_amd64.deb
wget -O /home/travis/.m2/foundationdb-server_6.3.23-1_amd64.deb https://github.com/apple/foundationdb/releases/download/6.3.23/foundationdb-server_6.3.23-1_amd64.deb
sudo dpkg -i /home/travis/.m2/foundationdb-clients_6.3.23-1_amd64.deb /home/travis/.m2/foundationdb-server_6.3.23-1_amd64.deb
for i in {4500,}; do
echo "lsof port:"$i
sudo lsof -i :$i && continue || sleep 5
sudo lsof -i :$i || ( echo "service not ready, port:$i" && exit 1 )
done
;;
"test.pkg")
# mysql
sudo service mysql start
sudo mysql -uroot -proot -e "use mysql;alter user 'root'@'localhost' identified with mysql_native_password by '';"
sudo mysql -e "create database dev;"
# tikv
wget -O /home/travis/.m2/install.sh https://tiup-mirrors.pingcap.com/install.sh
bash /home/travis/.m2/install.sh
source /home/runner/.bash_profile
tiup -v
nohup tiup playground --mode tikv-slim >> output.log 2>&1 &
# minio
docker run -d -p 9000:9000 -p 9001:9001 -e "MINIO_ROOT_USER=testUser" -e "MINIO_ROOT_PASSWORD=testUserPassword" quay.io/minio/minio:RELEASE.2022-01-25T19-56-04Z server /data --console-address ":9001"
# mc
go install github.com/minio/[email protected] && mc config host add local http://127.0.0.1:9000 testUser testUserPassword && mc mb local/testbucket
# gluster
sudo systemctl start glusterd.service
mkdir -p /tmp/gluster/gv0
sudo hostname jfstest
sudo gluster volume create gv0 jfstest:/tmp/gluster/gv0 force
sudo gluster volume start gv0
# webdav
wget -O /home/travis/.m2/rclone-v1.57.0-linux-amd64.zip --no-check-certificate https://downloads.rclone.org/v1.57.0/rclone-v1.57.0-linux-amd64.zip
unzip /home/travis/.m2/rclone-v1.57.0-linux-amd64.zip -d /home/travis/.m2/
nohup /home/travis/.m2/rclone-v1.57.0-linux-amd64/rclone serve webdav local --addr 127.0.0.1:9007 >> rclone.log 2>&1 &
# sftp
docker run -d --name sftp -p 2222:22 juicedata/ci-sftp
# etcd
docker run -d \
-p 3379:2379 \
-p 3380:2380 \
--name etcd_3_5_7 \
quay.io/coreos/etcd:v3.5.7 \
/usr/local/bin/etcd --data-dir=/etcd-data --name node1 \
--listen-client-urls http://0.0.0.0:2379 \
--advertise-client-urls http://0.0.0.0:2379 \
--listen-peer-urls http://0.0.0.0:2380 \
--initial-advertise-peer-urls http://0.0.0.0:2380 \
--initial-cluster node1=http://0.0.0.0:2380
# hdfs
chmod +x .github/scripts/setup-hdfs.sh
./.github/scripts/setup-hdfs.sh
for i in {2222,8020,9000,9007,2379}; do
echo "lsof port:"$i
sudo lsof -i :$i && continue || sleep 5
sudo lsof -i :$i || ( echo "service not ready, port:$i" && exit 1 )
done
;;
*)
echo "matrix.test: ${{matrix.test}} is not valid" && exit 1
;;
esac
- name: Unit Test
timeout-minutes: 30
run: |
test=${{matrix.test}}
make $test
# - name: Code Coverage
# uses: codecov/codecov-action@v3
# with:
# files: ./cov.out
- name: Setup upterm session
if: ${{ failure() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug == 'true' }}
timeout-minutes: 120
uses: lhotari/action-upterm@v1
success-all-test:
runs-on: ubuntu-latest
needs: [unittests]
if: always()
steps:
- uses: technote-space/workflow-conclusion-action@v3
- uses: actions/checkout@v3
- name: Check Failure
if: env.WORKFLOW_CONCLUSION == 'failure'
run: exit 1
- name: Send Slack Notification
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
uses: juicedata/slack-notify-action@main
with:
channel-id: "${{ secrets.SLACK_CHANNEL_ID_FOR_PR_CHECK_NOTIFY }}"
slack_bot_token: "${{ secrets.SLACK_BOT_TOKEN }}"
- name: Success
if: ${{ success() }}
run: echo "All Done"