Skip to content

Event subtype implementation #695

Event subtype implementation

Event subtype implementation #695

Workflow file for this run

name: Vela CI
on:
push:
branches: [ main, dev]
tags:
- 'v*' # triggers workflow on any tag starting with 'v'
pull_request:
branches: [ main, dev ]
jobs:
quick-test:
name: Quick Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history so git describe can resolve tags
# Setup Go
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24'
# Setup Node.js for contracts
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: contracts/package-lock.json
# Install Node.js dependencies for contracts
- name: Install contract dependencies
working-directory: contracts
run: npm ci
# Format check for contracts
- name: Check formatting in contracts
working-directory: contracts
run: npm run format:check
# Install Go dependencies
- name: Download Go dependencies
run: go mod download
# Install solc
- name: Install solc
run: |
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install -y solc
# Install abigen (from go-ethereum)
- name: Install abigen
run: go install github.com/ethereum/go-ethereum/cmd/abigen@v1.16.2
# Install TinyGo for WASM module
- name: Install TinyGo
run: |
wget https://github.com/tinygo-org/tinygo/releases/download/v0.39.0/tinygo_0.39.0_amd64.deb
sudo dpkg -i tinygo_0.39.0_amd64.deb
# ✅ Verify generated files consistency
- name: Verify generated files are up-to-date
timeout-minutes: 5
run: |
echo "Running go generate and checking for changes..."
set -x
go generate -v ./... || { echo "go generate failed"; exit 1; }
echo "Files after generation:"
git status
if [[ -n "$(git status --porcelain | grep -E '^( M|A |\\?\\?) (pkg/blockchain/contracts/|contract_abis/|subgraphs/hcce/abis/)')" ]]; then
echo "❌ Generated files are out of date. Please run 'go generate ./...' and commit the results."
git diff
exit 1
else
echo "✅ Generated files are up-to-date."
fi
# Build Go project
- name: Build Go project
run: |
go build ./...
# Makefile handles git-based versioning via ldflags (see cmd/Makefile)
make -C cmd manager executor
# Run Go tests
- name: Run Go tests quick
run: CI_FLAG=true go test -v ./...
# Build contracts
- name: Build contracts
working-directory: contracts
run: npm run build
# Test contracts
- name: Test contracts
working-directory: contracts
run: npm run test
full-test:
name: Full Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history so git describe can resolve tags
# Setup Go
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.24'
# Setup Node.js for contracts
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: contracts/package-lock.json
# Install Node.js dependencies for contracts
- name: Install contract dependencies
working-directory: contracts
run: npm ci
# Install Go dependencies
- name: Download Go dependencies
run: go mod download
# Install dependencies for solc
- name: Install solc
run: |
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install -y solc
# Install abigen (from go-ethereum)
- name: Install abigen
run: go install github.com/ethereum/go-ethereum/cmd/abigen@v1.16.2
# Install TinyGo for WASM module
- name: Install TinyGo
run: |
wget https://github.com/tinygo-org/tinygo/releases/download/v0.39.0/tinygo_0.39.0_amd64.deb
sudo dpkg -i tinygo_0.39.0_amd64.deb
# ✅ Verify generated files consistency
- name: Verify generated files are up-to-date
timeout-minutes: 5
run: |
echo "Running go generate and checking for changes..."
set -x
go generate -v ./... || { echo "go generate failed"; exit 1; }
echo "Files after generation:"
git status
if [[ -n "$(git status --porcelain | grep -E '^( M|A |\\?\\?) (pkg/blockchain/contracts/|contract_abis/|subgraphs/hcce/abis/)')" ]]; then
echo "❌ Generated files are out of date. Please run 'go generate ./...' and commit the results."
git diff
exit 1
else
echo "✅ Generated files are up-to-date."
fi
# Build Go project
- name: Build Go project
run: |
go build ./...
# Makefile handles git-based versioning via ldflags (see cmd/Makefile)
make -C cmd manager executor
# Run ALL Go tests (including long-running ones)
- name: Run Go tests (full suite)
run: CI_FLAG= go test -v ./...
timeout-minutes: 10
# Build contracts
- name: Build contracts
working-directory: contracts
run: npm run build
# Test contracts
- name: Test contracts
working-directory: contracts
run: npm run test
build-and-push-docker-images:
name: Build and Push Docker Images
runs-on: ubuntu-latest
needs: [full-test, quick-test]
if: startsWith(github.ref, 'refs/tags/') #runs this job only when pushing a tag
env:
DOCKER_HUB_ORG: ${{ vars.DOCKER_HUB_ORG }}
DOCKER_HUB_USERNAME: ${{ vars.DOCKER_HUB_USERNAME }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
GITHUB_TAG: ${{ github.ref_name }}
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_TOKEN }}
- name: Build and push executor image
uses: docker/build-push-action@v5
with:
context: .
file: ./dockerfiles/executor/Dockerfile
push: true
build-args: |
GIT_VERSION=${{ github.ref_name }}
tags: |
${{ env.DOCKER_HUB_ORG }}/cce-executor:${{ env.GITHUB_TAG }}
${{ env.DOCKER_HUB_ORG }}/cce-executor:latest
- name: Build and push manager image
uses: docker/build-push-action@v5
with:
context: .
file: ./dockerfiles/manager/Dockerfile
push: true
build-args: |
GIT_VERSION=${{ github.ref_name }}
tags: |
${{ env.DOCKER_HUB_ORG }}/cce-manager:${{ env.GITHUB_TAG }}
${{ env.DOCKER_HUB_ORG }}/cce-manager:latest
- name: Build and push kms-proxy image
uses: docker/build-push-action@v5
with:
context: .
file: ./dockerfiles/kms_proxy/Dockerfile
push: true
tags: |
${{ env.DOCKER_HUB_ORG }}/kms-proxy:${{ env.GITHUB_TAG }}
${{ env.DOCKER_HUB_ORG }}/kms-proxy:latest
- name: Build and push authorityservice image
uses: docker/build-push-action@v5
with:
context: .
file: ./dockerfiles/authorityservice/Dockerfile
push: true
tags: |
${{ env.DOCKER_HUB_ORG }}/cce-authorityservice:${{ env.GITHUB_TAG }}
${{ env.DOCKER_HUB_ORG }}/cce-authorityservice:latest
- name: Build and push chain image
uses: docker/build-push-action@v5
with:
context: .
file: ./dockerfiles/chain/Dockerfile
push: true
tags: |
${{ env.DOCKER_HUB_ORG }}/cce-chain:${{ env.GITHUB_TAG }}
${{ env.DOCKER_HUB_ORG }}/cce-chain:latest
- name: Build and push deployer image
uses: docker/build-push-action@v5
with:
context: .
file: ./dockerfiles/deployer/Dockerfile
push: true
tags: |
${{ env.DOCKER_HUB_ORG }}/cce-deployer:${{ env.GITHUB_TAG }}
${{ env.DOCKER_HUB_ORG }}/cce-deployer:latest
- name: Build and push subgraph-deployer image
uses: docker/build-push-action@v5
with:
context: .
file: ./dockerfiles/subgraph-deployer/Dockerfile
push: true
tags: |
${{ env.DOCKER_HUB_ORG }}/cce-subgraph-deployer:${{ env.GITHUB_TAG }}
${{ env.DOCKER_HUB_ORG }}/cce-subgraph-deployer:latest