-
Notifications
You must be signed in to change notification settings - Fork 20
129 lines (124 loc) · 5.1 KB
/
e2e.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
name: End to End Test
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
env:
GreenfieldTag: v1.7.2
GreenfieldStorageProviderTag: v1.7.1
GOPRIVATE: github.com/bnb-chain
GH_ACCESS_TOKEN: ${{ secrets.GH_TOKEN }}
MYSQL_USER: root
MYSQL_PASSWORD: root
MYSQL_ROOT_PASSWORD: root
MYSQL_IP: 127.0.0.1
MYSQL_PORT: 3306
jobs:
end-to-end-test:
strategy:
matrix:
go-version: [1.20.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup GitHub Token
run: git config --global url.https://$GH_ACCESS_TOKEN@github.com/.insteadOf https://github.com/
# Build Greenfield
- name: Build Greenfield
run: |
git clone https://github.com/bnb-chain/greenfield.git ../greenfield
cd ../greenfield
git checkout ${{ env.GreenfieldTag }}
go install github.com/bufbuild/buf/cmd/buf@v1.28.0
make tools
make proto-gen
make build
cd ..
# Build Greenfield-SP
- name: Build Greenfield-SP
run: |
git clone https://github.com/bnb-chain/greenfield-storage-provider.git ../greenfield-storage-provider
cd ../greenfield-storage-provider
git checkout ${{ env.GreenfieldStorageProviderTag }}
make install-tools
make build
cd ../greenfield-go-sdk
# Run MySQL
- name: Run MySQL
run: |
sudo /etc/init.d/mysql start
mysql -h ${{ env.MYSQL_IP }} -P ${{ env.MYSQL_PORT }} -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }} -e 'CREATE DATABASE sp_0; CREATE DATABASE sp_1;CREATE DATABASE sp_2; CREATE DATABASE sp_3;CREATE DATABASE sp_4; CREATE DATABASE sp_5; CREATE DATABASE sp_6;'
# Run Greenfield
- name: Run Greenfield
run: |
cd ../greenfield
bash ./deployment/localup/localup.sh all 1 8
bash ./deployment/localup/localup.sh export_sps 1 8 > sp.json
cat sp.json
cd ../greenfield-go-sdk
# Run Greenfield-SP
- name: Run Greenfield-SPs
run: |
cd ../greenfield-storage-provider
bash ./deployment/localup/localup.sh --generate $GITHUB_WORKSPACE/../greenfield/sp.json ${{ env.MYSQL_USER }} ${{ env.MYSQL_PASSWORD }} ${{ env.MYSQL_IP }}:${{ env.MYSQL_PORT }}
bash ./deployment/localup/localup.sh --reset
bash ./deployment/localup/localup.sh --start
sleep 60
./deployment/localup/local_env/sp0/gnfd-sp0 update.quota --quota 5000000000 -c deployment/localup/local_env/sp0/config.toml
./deployment/localup/local_env/sp1/gnfd-sp1 update.quota --quota 5000000000 -c deployment/localup/local_env/sp1/config.toml
./deployment/localup/local_env/sp2/gnfd-sp2 update.quota --quota 5000000000 -c deployment/localup/local_env/sp2/config.toml
./deployment/localup/local_env/sp3/gnfd-sp3 update.quota --quota 5000000000 -c deployment/localup/local_env/sp3/config.toml
./deployment/localup/local_env/sp4/gnfd-sp4 update.quota --quota 5000000000 -c deployment/localup/local_env/sp4/config.toml
./deployment/localup/local_env/sp5/gnfd-sp5 update.quota --quota 5000000000 -c deployment/localup/local_env/sp5/config.toml
./deployment/localup/local_env/sp6/gnfd-sp6 update.quota --quota 5000000000 -c deployment/localup/local_env/sp6/config.toml
./deployment/localup/local_env/sp7/gnfd-sp7 update.quota --quota 5000000000 -c deployment/localup/local_env/sp7/config.toml
ps -ef | grep gnfd-sp | wc -l
tail -n 1000 deployment/localup/local_env/sp0/gnfd-sp.log
cd ../greenfield-go-sdk
# Run E2E Test
- name: start e2e
run: |
set +e
make e2e_test
exit_status_command=$?
if [ $exit_status_command -eq 0 ]; then
echo "make e2e_test successful."
else
cd ../greenfield-storage-provider
cat ./deployment/localup/local_env/sp0/log.txt
cat ./deployment/localup/local_env/sp1/log.txt
cat ./deployment/localup/local_env/sp2/log.txt
cat ./deployment/localup/local_env/sp3/log.txt
cat ./deployment/localup/local_env/sp4/log.txt
cat ./deployment/localup/local_env/sp5/log.txt
cat ./deployment/localup/local_env/sp6/log.txt
cat ./deployment/localup/local_env/sp7/log.txt
exit $exit_status_command
fi
cd ..