7.8 KiB
CI/CD
GitHub Actions Workflows
The repository currently uses two main workflows:
testing.ymlfor automated test checks on pushes and pull requestsdeploy.ymlfor manual self-hosted build/deploy runs (shown in GitHub Actions asBuild / Deploy)
Testing Workflow
Workflow: .github/workflows/testing.yml
Trigger:
pushtomasteranddeveloppull_requestto any branch
Jobs:
unit-testsconnectivity-teststest everything is reachable on the networkintegration-tests
Security gate for self-hosted test jobs:
- self-hosted jobs run only for non-PR events or same-repository PRs
- condition:
github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
Deploy Workflow
Workflow: .github/workflows/deploy.yml (Build / Deploy in the Actions UI)
Trigger:
- manual
workflow_dispatch
Inputs:
mode:buildwhen you want to build Blockbook Debian packages only.deploywhen you want the full flow:- build package
- install and restart service
- wait for Blockbook sync
- run post-deploy e2e tests
env:devkeeps the current per-coin dev runner mappingprodbuilds selected coins onproduction_builderregardless ofBB_RUNNER_*- default is
dev - ignored when
mode=deploy
always_build_backend:falsederives backend builds per coin fromBB_RPC_URL_HTTP_<coin_alias>trueforces backend builds for all selected coins- ignored when
mode=deploy
coins: comma-separated aliases fromconfigs/coins;ALLis supported only inmode=buildbranch_or_tag: optional branch or tag to check out and deploy; leave empty to use the workflow run ref name- the selected value is validated before checkout and must exist in the target repository as a branch or tag
In mode=build, selected coins are grouped by runner so one build job can build multiple
deb-blockbook-<coin> targets in a single invocation on the same self-hosted machine.
Env vars :
See also CI/CD workflow variables.
BB_PACKAGE_ROOT=/opt/blockbook-builds- When absolute path set, build jobs copy packages to:
/opt/blockbook-builds/{branch_or_tag}/{coin}/blockbook-*.deb/opt/blockbook-builds/{branch_or_tag}/{coin}/backend-*.deb{coin}here is the workflow/config name fromconfigs/coins/<coin>.json, notcoin.alias
BB_BACKEND_DOMAIN=<backend-domain>- if
always_build_backend=true, backend is built for every selected coin - otherwise, backend is built only when
BB_RPC_URL_HTTP_<coin_alias>has a hostname matchingBB_BACKEND_DOMAIN
- if
Special cases:
mode=build+env=devskips prod-only coins whencoins=ALLmode=build+env=prod+coins=ALLbuilds all configured coins withBB_RUNNER_*mappings onproduction_buildermode=build+env=devfails if you explicitly request a coin whoseBB_RUNNER_*isproduction_buildermode=deployis dev-only and fails fast if any selected coin is mapped toproduction_builder
Naming Matrix
+-------------------------------+----------------------------------------+--------------------------------------+
| Concern | Example source | Name used |
+-------------------------------+----------------------------------------+--------------------------------------+
| Workflow/build/deploy identity| configs/coins/<coin>.json filename | polygon_archive |
| Runner mapping | BB_RUNNER_<coin> | BB_RUNNER_POLYGON_ARCHIVE |
| Backend RPC env identity | coin.alias | BB_RPC_URL_HTTP_polygon_archive_bor |
| Blockbook package name | blockbook.package_name | blockbook-polygon |
| Backend package name | backend.package_name | backend-polygon |
| Build target identity | workflow/config coin name | deb-blockbook-polygon_archive |
| Built Blockbook .deb filename | build/<blockbook.package_name>_*.deb | build/blockbook-polygon_*.deb |
| Built backend .deb filename | build/<backend.package_name>_*.deb | build/backend-polygon_*.deb |
| Staged artifact path identity | workflow/config coin name | {branch_or_tag}/polygon_archive/... |
| API/e2e test identity | coin.test_name or config filename | polygon |
| API test env identity | BB_TEST_API_URL_* from test identity | BB_TEST_API_URL_HTTP_polygon |
+-------------------------------+----------------------------------------+--------------------------------------+
For polygon_archive specifically:
- workflow coin:
polygon_archive - alias:
polygon_archive_bor - blockbook package name:
blockbook-polygon - backend package name:
backend-polygon - test name:
polygon
CLI examples
Wrapper entrypoint:
./.github/bin/bb_deploy
Without --run, build and deploy print the underlying gh workflow run ...
command. list prints coins, not commands.
Current branch example output was captured on new-test-name-config, so the printed
--ref and branch_or_tag values will differ on other branches.
The output below assumes BB_RUNNER_* repository variables are valid for the current checkout.
List coins buildable on dev runners:
./.github/bin/bb_deploy list --env dev
avalanche_archive
base_archive
bcash
bitcoin
bitcoin_regtest
bitcoin_testnet
bitcoin_testnet4
bsc_archive
dash
dogecoin
ethereum_archive
ethereum_testnet_hoodi_archive
ethereum_testnet_sepolia_archive
litecoin
zcash
List all configured runner-mapped coins in CSV form:
./.github/bin/bb_deploy list --env prod --format csv
arbitrum_archive,avalanche_archive,base_archive,bcash,bitcoin,bitcoin_regtest,bitcoin_testnet,bitcoin_testnet4,bsc_archive,dash,dogecoin,ethereum_archive,ethereum_testnet_hoodi_archive,ethereum_testnet_sepolia_archive,litecoin,optimism_archive,polygon_archive,zcash
Print the default dev build command for selected coins:
./.github/bin/bb_deploy build --coins bitcoin,dogecoin
gh workflow run deploy.yml -R trezor/blockbook --ref new-test-name-config -f mode=build -f env=dev -f coins=bitcoin,dogecoin -f branch_or_tag=new-test-name-config
Print the prod build command for selected coins:
./.github/bin/bb_deploy build --env prod --coins bitcoin,bsc_archive
gh workflow run deploy.yml -R trezor/blockbook --ref new-test-name-config -f mode=build -f env=prod -f coins=bitcoin,bsc_archive -f branch_or_tag=new-test-name-config
Print the dev build command for all selectable coins:
./.github/bin/bb_deploy build --coins ALL
gh workflow run deploy.yml -R trezor/blockbook --ref new-test-name-config -f mode=build -f env=dev -f coins=ALL -f branch_or_tag=new-test-name-config
Print the prod build command for all selectable coins:
./.github/bin/bb_deploy build --env prod --coins ALL
gh workflow run deploy.yml -R trezor/blockbook --ref new-test-name-config -f mode=build -f env=prod -f coins=ALL -f branch_or_tag=new-test-name-config
Print the deploy command for selected coins:
./.github/bin/bb_deploy deploy --coins bitcoin,dogecoin
gh workflow run deploy.yml -R trezor/blockbook --ref new-test-name-config -f mode=deploy -f env=dev -f coins=bitcoin,dogecoin -f branch_or_tag=new-test-name-config
Print the deploy command with an explicit branch or tag:
./.github/bin/bb_deploy deploy --coins bitcoin --branch-or-tag master
gh workflow run deploy.yml -R trezor/blockbook --ref new-test-name-config -f mode=deploy -f env=dev -f coins=bitcoin -f branch_or_tag=master