gcx/blockchain/.github/workflows/chain-ci.yml

135 lines
3.8 KiB
YAML

# ============================================================
# Genex Chain CI — Go build + test + lint
# ============================================================
name: Chain CI
on:
push:
paths:
- 'blockchain/genex-chain/**'
- 'blockchain/genex-sdk-go/**'
- 'blockchain/bridge-monitor/**'
pull_request:
paths:
- 'blockchain/genex-chain/**'
- 'blockchain/genex-sdk-go/**'
- 'blockchain/bridge-monitor/**'
jobs:
# ─── genex-chain 编译 & 测试 ────────────────────────────
chain-build:
name: Build genexd
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: blockchain/genex-chain/go.sum
- name: Build genexd
working-directory: blockchain/genex-chain
run: make build
- name: Run tests
working-directory: blockchain/genex-chain
run: go test ./... -v -race -count=1
- name: Lint
uses: golangci/golangci-lint-action@v4
with:
working-directory: blockchain/genex-chain
version: latest
# ─── Go SDK 测试 ────────────────────────────────────────
go-sdk:
name: Go SDK Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: blockchain/genex-sdk-go/go.sum
- name: Test
working-directory: blockchain/genex-sdk-go
run: go test ./... -v -race
# ─── Bridge Monitor 测试 ────────────────────────────────
bridge-monitor:
name: Bridge Monitor Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: blockchain/bridge-monitor/go.sum
- name: Test
working-directory: blockchain/bridge-monitor
run: go test ./... -v
# ─── NestJS 生态服务测试 ────────────────────────────────
ecosystem-services:
name: Ecosystem Services Build
runs-on: ubuntu-latest
strategy:
matrix:
service:
- enterprise-api
- gas-relayer
- faucet-service
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: blockchain/${{ matrix.service }}/package-lock.json
- name: Install dependencies
working-directory: blockchain/${{ matrix.service }}
run: npm ci
- name: Build
working-directory: blockchain/${{ matrix.service }}
run: npm run build
- name: Lint
working-directory: blockchain/${{ matrix.service }}
run: npm run lint --if-present
# ─── Dart SDK 测试 ──────────────────────────────────────
dart-sdk:
name: Dart SDK Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: '3.2.0'
- name: Install dependencies
working-directory: blockchain/genex-sdk-dart
run: dart pub get
- name: Analyze
working-directory: blockchain/genex-sdk-dart
run: dart analyze
- name: Test
working-directory: blockchain/genex-sdk-dart
run: dart test --reporter expanded