Skip to content

Commit

Permalink
Merge branch 'develop' into fix-coderabbit-config
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis authored Jul 3, 2024
2 parents 28abe5c + 87872b3 commit e0bbe35
Show file tree
Hide file tree
Showing 6 changed files with 224 additions and 210 deletions.
93 changes: 0 additions & 93 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,96 +100,3 @@ jobs:
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 *


90 changes: 90 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: e2e

on:
push:
branches:
- develop
pull_request:
branches:
- "*"
merge_group:
workflow_dispatch:
schedule:
# run at 6AM UTC Daily
# 6AM UTC -> 11PM PT
- cron: "0 6 * * *"

concurrency:
group: e2e-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
matrix-conditionals:
runs-on: ubuntu-22.04
env:
GH_TOKEN: ${{ github.token }}
outputs:
UPGRADE_TESTS: ${{ steps.matrix-conditionals.outputs.UPGRADE_TESTS }}
UPGRADE_LIGHT_TESTS: ${{ steps.matrix-conditionals.outputs.UPGRADE_LIGHT_TESTS }}
ADMIN_TESTS: ${{ steps.matrix-conditionals.outputs.ADMIN_TESTS }}
steps:
# use cli rather than event context to avoid race conditions (label added after push)
- id: matrix-conditionals
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
labels=$(gh pr view -R ${{github.repository}} ${{github.event.pull_request.number}} --json labels -q '.labels[].name')
if [[ "$labels" == *"UPGRADE_TESTS"* ]]; then
echo "UPGRADE_TESTS=true" >> $GITHUB_OUTPUT
fi
if [[ "$labels" == *"UPGRADE_LIGHT_TESTS"* ]]; then
echo "UPGRADE_LIGHT_TESTS=true" >> $GITHUB_OUTPUT
fi
if [[ "$labels" == *"ADMIN_TESTS"* ]]; then
echo "ADMIN_TESTS=true" >> $GITHUB_OUTPUT
fi
elif [[ ${{ github.event_name }} == 'schedule' ]]; then
echo "UPGRADE_TESTS=true" >> $GITHUB_OUTPUT
echo "UPGRADE_LIGHT_TESTS=true" >> $GITHUB_OUTPUT
echo "ADMIN_TESTS=true" >> $GITHUB_OUTPUT
fi
e2e:
needs: matrix-conditionals
strategy:
fail-fast: false
matrix:
include:
- make-target: "start-e2e-test"
runs-on: ubuntu-20.04
run: true
- make-target: "start-upgrade-test"
runs-on: ubuntu-20.04
run: ${{ needs.matrix-conditionals.outputs.UPGRADE_TESTS == 'true' }}
- make-target: "start-upgrade-test-light"
runs-on: ubuntu-20.04
run: ${{ needs.matrix-conditionals.outputs.UPGRADE_LIGHT_TESTS == 'true' }}
- make-target: "start-e2e-admin-test"
runs-on: ubuntu-20.04
run: ${{ needs.matrix-conditionals.outputs.ADMIN_TESTS == 'true' }}
name: ${{ matrix.make-target }}
uses: ./.github/workflows/reusable-e2e.yml
with:
make-target: ${{ matrix.make-target }}
runs-on: ${{ matrix.runs-on}}
run: ${{ matrix.run }}
secrets: inherit
# this allows you to set a required status check
e2e-ok:
runs-on: ubuntu-22.04
needs: e2e
if: always()
steps:
- run: |
result="${{ needs.e2e.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi
106 changes: 0 additions & 106 deletions .github/workflows/execute_advanced_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ name: "TESTING:ADVANCED:E2E"
on:
workflow_dispatch:
inputs:
e2e-admin-tests:
type: boolean
required: false
default: false
e2e-upgrade-test:
type: boolean
required: false
default: false
e2e-stateful-upgrade-test:
type: boolean
required: false
Expand All @@ -19,10 +11,6 @@ on:
type: boolean
required: false
default: false
e2e-upgrade-test-light:
type: boolean
required: false
default: false
e2e-stateful-data-test:
type: boolean
required: false
Expand All @@ -37,69 +25,6 @@ on:
- cron: "0 6 * * *"

jobs:
e2e-admin-tests:
if: ${{ github.event.inputs.e2e-admin-tests == 'true' || github.event_name == 'schedule' }}
runs-on: buildjet-4vcpu-ubuntu-2204
timeout-minutes: 120
steps:
- name: "Checkout Code"
uses: actions/checkout@v4

- name: Start Test
run: make start-e2e-admin-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 == 'schedule'
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 }}

e2e-upgrade-test:
if: ${{ github.event.inputs.e2e-upgrade-test == 'true' || github.event_name == 'schedule' }}
runs-on: buildjet-16vcpu-ubuntu-2204
timeout-minutes: 120
steps:
- name: "Checkout Code"
uses: actions/checkout@v4

- name: Start Test
run: make start-upgrade-test

- 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 == 'schedule'
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 }}

e2e-stateful-upgrade-test:
if: ${{ github.event.inputs.e2e-stateful-upgrade-test == 'true' || github.event_name == 'schedule' }}
runs-on: buildjet-16vcpu-ubuntu-2204
Expand Down Expand Up @@ -131,37 +56,6 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_CI_ALERTS }}

e2e-upgrade-test-light:
if: ${{ github.event.inputs.e2e-upgrade-test-light == 'true' }}
runs-on: buildjet-4vcpu-ubuntu-2204
timeout-minutes: 120
steps:
- name: "Checkout Code"
uses: actions/checkout@v4

- name: Start Test
run: make start-upgrade-test-light

- 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 == 'schedule'
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 }}

e2e-performance-test:
if: ${{ github.event.inputs.e2e-performance-test == 'true' }}
runs-on: buildjet-4vcpu-ubuntu-2204
Expand Down
Loading

0 comments on commit e0bbe35

Please sign in to comment.