mirror of
https://github.com/trezor/blockbook.git
synced 2026-03-03 06:14:27 +01:00
121 lines
4.5 KiB
YAML
121 lines
4.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ master, develop ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
workflow_dispatch:
|
|
inputs:
|
|
coin_filter:
|
|
description: 'Coin filter regex (e.g. "bitcoin", "ethereum", "bitcoin|ethereum|bsc"). Leave empty for all coins.'
|
|
required: false
|
|
default: ''
|
|
run_unit_tests:
|
|
description: 'Run unit tests'
|
|
type: boolean
|
|
default: true
|
|
run_connectivity_tests:
|
|
description: 'Run connectivity tests'
|
|
type: boolean
|
|
default: true
|
|
run_integration_tests:
|
|
description: 'Run integration tests (rpc + sync)'
|
|
type: boolean
|
|
default: false
|
|
|
|
jobs:
|
|
unit-tests:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-latest
|
|
if: ${{ github.event_name != 'workflow_dispatch' || inputs.run_unit_tests }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build Docker image
|
|
run: make build-images
|
|
|
|
- name: Run unit tests
|
|
run: make test
|
|
|
|
connectivity-tests:
|
|
name: Backend Connectivity Tests
|
|
runs-on: ubuntu-latest
|
|
needs: unit-tests
|
|
if: |
|
|
always() &&
|
|
(needs.unit-tests.result == 'success' || needs.unit-tests.result == 'skipped') &&
|
|
(github.event_name != 'workflow_dispatch' || inputs.run_connectivity_tests) &&
|
|
vars.BB_RPC_URL_HTTP_avalanche != ''
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build Docker image
|
|
run: make build-images
|
|
|
|
- name: Run connectivity tests
|
|
env:
|
|
# EVM chains with publicly reachable endpoints only.
|
|
# Ethereum and BSC excluded until valid public RPC URLs are available.
|
|
# UTXO chains are tested on the dev server where internal backends are reachable.
|
|
BB_RPC_URL_HTTP_avalanche: ${{ vars.BB_RPC_URL_HTTP_avalanche }}
|
|
BB_RPC_URL_WS_avalanche: ${{ vars.BB_RPC_URL_WS_avalanche }}
|
|
BB_RPC_URL_HTTP_polygon_bor: ${{ vars.BB_RPC_URL_HTTP_polygon_bor }}
|
|
BB_RPC_URL_WS_polygon_bor: ${{ vars.BB_RPC_URL_WS_polygon_bor }}
|
|
BB_RPC_URL_HTTP_arbitrum: ${{ vars.BB_RPC_URL_HTTP_arbitrum }}
|
|
BB_RPC_URL_WS_arbitrum: ${{ vars.BB_RPC_URL_WS_arbitrum }}
|
|
BB_RPC_URL_HTTP_optimism: ${{ vars.BB_RPC_URL_HTTP_optimism }}
|
|
BB_RPC_URL_WS_optimism: ${{ vars.BB_RPC_URL_WS_optimism }}
|
|
BB_RPC_URL_HTTP_base: ${{ vars.BB_RPC_URL_HTTP_base }}
|
|
BB_RPC_URL_WS_base: ${{ vars.BB_RPC_URL_WS_base }}
|
|
run: |
|
|
# Default to EVM-only coins (publicly reachable from GitHub runners).
|
|
# Ethereum and BSC excluded until valid public RPC URLs are available.
|
|
# UTXO chains use internal backends and are tested on the dev server.
|
|
EVM_COINS="avalanche|arbitrum|base|optimism|polygon"
|
|
FILTER="${{ inputs.coin_filter }}"
|
|
FILTER="${FILTER:-$EVM_COINS}"
|
|
make test-connectivity ARGS="-run 'TestIntegration/($FILTER)=.*/connectivity'"
|
|
|
|
integration-tests:
|
|
name: Integration Tests (RPC + Sync)
|
|
runs-on: ubuntu-latest
|
|
needs: connectivity-tests
|
|
if: |
|
|
always() &&
|
|
(needs.connectivity-tests.result == 'success' || needs.connectivity-tests.result == 'skipped') &&
|
|
github.event_name == 'workflow_dispatch' && inputs.run_integration_tests
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build Docker image
|
|
run: make build-images
|
|
|
|
- name: Run integration tests
|
|
env:
|
|
# EVM chains with publicly reachable endpoints only.
|
|
# Ethereum and BSC excluded until valid public RPC URLs are available.
|
|
BB_RPC_URL_HTTP_avalanche: ${{ vars.BB_RPC_URL_HTTP_avalanche }}
|
|
BB_RPC_URL_WS_avalanche: ${{ vars.BB_RPC_URL_WS_avalanche }}
|
|
BB_RPC_URL_HTTP_polygon_bor: ${{ vars.BB_RPC_URL_HTTP_polygon_bor }}
|
|
BB_RPC_URL_WS_polygon_bor: ${{ vars.BB_RPC_URL_WS_polygon_bor }}
|
|
BB_RPC_URL_HTTP_arbitrum: ${{ vars.BB_RPC_URL_HTTP_arbitrum }}
|
|
BB_RPC_URL_WS_arbitrum: ${{ vars.BB_RPC_URL_WS_arbitrum }}
|
|
BB_RPC_URL_HTTP_optimism: ${{ vars.BB_RPC_URL_HTTP_optimism }}
|
|
BB_RPC_URL_WS_optimism: ${{ vars.BB_RPC_URL_WS_optimism }}
|
|
BB_RPC_URL_HTTP_base: ${{ vars.BB_RPC_URL_HTTP_base }}
|
|
BB_RPC_URL_WS_base: ${{ vars.BB_RPC_URL_WS_base }}
|
|
run: |
|
|
# Default to EVM-only coins (publicly reachable from GitHub runners).
|
|
# Ethereum and BSC excluded until valid public RPC URLs are available.
|
|
EVM_COINS="avalanche|arbitrum|base|optimism|polygon"
|
|
FILTER="${{ inputs.coin_filter }}"
|
|
FILTER="${FILTER:-$EVM_COINS}"
|
|
make test-integration ARGS="-run 'TestIntegration/($FILTER)=.*/' -v"
|