WIP: Solana integration #7525
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: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- "*" | |
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-20.04 | |
timeout-minutes: 15 | |
concurrency: | |
group: "build-and-test" | |
steps: | |
- uses: actions/checkout@v4 | |
- 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: "false" | |
- name: Test | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 20 | |
max_attempts: 2 | |
retry_on: error | |
command: | | |
echo "Running Build Tests" | |
make clean | |
make test-coverage | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
with: | |
file: coverage.out | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: zeta-chain/node | |
- 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: Upload zetacored | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zetacored | |
path: ~/go/bin/zetacored | |
retention-days: 30 | |
- name: Upload zetaclientd | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zetaclientd | |
path: ~/go/bin/zetaclientd | |
retention-days: 30 | |
- name: Clean Up Workspace | |
if: always() | |
shell: bash | |
run: rm -rf * | |
e2e-test: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 25 | |
steps: | |
- uses: actions/checkout@v4 | |
# configure docker to use the containerd snapshotter | |
# so that we can use the buildkit cache | |
- uses: depot/use-containerd-snapshotter-action@v1 | |
- name: Login to Docker Hub registry | |
uses: docker/login-action@v2 | |
if: (github.event_name == 'push' && github.repository == 'zeta-chain/node') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'zeta-chain/node') | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_READ_ONLY }} | |
- name: Login to github docker registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Restore go cache | |
uses: actions/cache@v4 | |
id: restore-go-cache | |
with: | |
path: | | |
go-cache | |
key: cache-${{ hashFiles('go.sum') }} | |
lookup-only: ${{ github.event_name != 'push' }} | |
- name: Inject go cache into docker | |
uses: reproducible-containers/[email protected] | |
with: | |
cache-map: | | |
{ | |
"go-cache": "/root/.cache/go-build" | |
} | |
skip-extraction: ${{ steps.restore-go-cache.outputs.cache-hit || github.event_name != 'push' }} | |
# build zetanode with cache options | |
- name: Build zetanode for cache | |
uses: docker/build-push-action@v6 | |
env: | |
CACHE_FROM_CONFIG: "type=registry,ref=ghcr.io/${{ github.repository }}:buildcache" | |
CACHE_TO_CONFIG: "type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max" | |
with: | |
context: . | |
file: ./Dockerfile-localnet | |
push: false | |
tags: zetanode:latest | |
cache-from: ${{ env.CACHE_FROM_CONFIG }} | |
cache-to: ${{ github.event_name == 'push' && env.CACHE_TO_CONFIG || '' }} | |
target: latest-runtime | |
- name: Start Test | |
run: make start-e2e-test | |
# use docker logs -f rather than docker attach to make sure we get the initial logs | |
- name: Watch Test | |
run: | | |
container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") | |
docker logs -f "${container_id}" & | |
exit $(docker wait "${container_id}") | |
- name: Full Log Dump On Failure | |
if: failure() | |
run: | | |
make stop-localnet | |
- name: Notify Slack on Failure | |
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/develop' | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CI_ALERTS }} | |
- name: Stop Private Network | |
if: always() | |
run: | | |
make stop-localnet | |
- name: Clean Up Workspace | |
if: always() | |
shell: bash | |
run: sudo rm -rf * | |