Merge pull request #248 from alexgao001/remove-disclaimer #1000
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 .. |