fix: updated the smoke test pipeline #4624
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: PR Testing | |
on: | |
pull_request: | |
branches: | |
- develop | |
types: | |
- synchronize | |
- opened | |
- reopened | |
- ready_for_review | |
concurrency: | |
group: pr-testing-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
S3_BUCKET_PATH: "zetachain-deployment-files/builds/zeta-node" | |
S3_PUBLIC_BUCKET_PATH: "zetachain-external-files" | |
AWS_REGION: "us-east-1" | |
GITHUB_REF_NAME: "$(echo ${{ github.ref_name }} | tr '//' '-')" | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
concurrency: | |
group: "build-and-test" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set CPU Architecture | |
shell: bash | |
run: | | |
if [ "$(uname -m)" == "aarch64" ]; then | |
echo "CPU_ARCH=arm64" >> $GITHUB_ENV | |
elif [ "$(uname -m)" == "x86_64" ]; then | |
echo "CPU_ARCH=amd64" >> $GITHUB_ENV | |
else | |
echo "Unsupported architecture" >&2 | |
exit 1 | |
fi | |
- name: Install Pipeline Dependencies | |
uses: ./.github/actions/install-dependencies | |
timeout-minutes: 8 | |
with: | |
cpu_architecture: ${{ env.CPU_ARCH }} | |
skip_python: "true" | |
skip_aws_cli: "true" | |
skip_docker_compose: "true" | |
- name: Test | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 20 | |
max_attempts: 2 | |
retry_on: error | |
command: | | |
echo "Running Build Tests" | |
make clean | |
make test | |
- name: Build zetacored and zetaclientd | |
env: | |
CGO_ENABLED: 1 | |
GOOS: linux | |
GOARCH: ${{ env.CPU_ARCH }} | |
run: | | |
make install | |
cp "$HOME"/go/bin/* ./ | |
chmod a+x ./zetacored | |
./zetacored version | |
- name: Clean Up Workspace | |
if: always() | |
shell: bash | |
run: rm -rf * | |
smoke-test: | |
runs-on: buildjet-4vcpu-ubuntu-2004 | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set CPU Architecture | |
shell: bash | |
run: | | |
if [ "$(uname -m)" == "aarch64" ]; then | |
echo "CPU_ARCH=arm64" >> $GITHUB_ENV | |
elif [ "$(uname -m)" == "x86_64" ]; then | |
echo "CPU_ARCH=amd64" >> $GITHUB_ENV | |
else | |
echo "Unsupported architecture" >&2 | |
exit 1 | |
fi | |
- name: Install Pipeline Dependencies | |
uses: ./.github/actions/install-dependencies | |
timeout-minutes: 8 | |
with: | |
cpu_architecture: ${{ env.CPU_ARCH }} | |
skip_python: "false" | |
skip_aws_cli: "true" | |
skip_docker_compose: "false" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
if: github.event.repository.full_name == 'zetachain-chain/node' | |
env: | |
DOCKER_BUILDKIT: 1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_READ_ONLY }} | |
- name: Start Private Network. | |
env: | |
DOCKER_BUILDKIT: 1 | |
run: | | |
make zetanode | |
cd contrib/localnet/ | |
docker compose up -d zetacore0 zetacore1 zetaclient0 zetaclient1 eth bitcoin | |
echo "Sleep for 1 minute longer to let network start" | |
# Cosmos SDK RPC endpoint | |
rpc_endpoint="http://127.0.0.1:26657/status" | |
# Initial block height | |
initial_height=$(curl -s $rpc_endpoint | jq -r '.result.sync_info.latest_block_height') | |
# Loop until the network processes blocks | |
while true; do | |
# Get the current block height | |
current_height=$(curl -s $rpc_endpoint | jq -r '.result.sync_info.latest_block_height') | |
# Check if the block height has increased | |
if [[ "$current_height" -gt "$initial_height" ]]; then | |
echo "The network is processing blocks. Current block height: $current_height" | |
break | |
else | |
echo "Waiting for the network to process blocks..." | |
fi | |
# Sleep for 1 second | |
sleep 1 | |
# Update initial height for next iteration | |
initial_height=$current_height | |
done | |
- name: Run Smoke Test | |
env: | |
DOCKER_BUILDKIT: 1 | |
run: | | |
cd contrib/localnet | |
docker-compose up --exit-code-from orchestrator orchestrator | |
docker ps | |
if [ $? -ne 0 ]; then | |
echo "Smoke Test Failed" | |
exit 1 | |
fi | |
sleep 10 | |
- name: Stop Private Network | |
if: always() | |
run: | | |
cd contrib/localnet/ | |
docker compose down | |
- name: Clean Up Workspace | |
if: always() | |
shell: bash | |
run: rm -rf * | |