Skip to content

Add GitHub Actions CI workflow for unit tests#1414

Open
etimofeeva wants to merge 49 commits intomasterfrom
github-actions-ci-cd
Open

Add GitHub Actions CI workflow for unit tests#1414
etimofeeva wants to merge 49 commits intomasterfrom
github-actions-ci-cd

Conversation

@etimofeeva
Copy link
Contributor

No description provided.

rpc fetching in sequential loop tends to be a bottleneck, so processEventsForBlock and getInternalDataForBlock now run concurrently

Closes: #1381
@etimofeeva etimofeeva force-pushed the github-actions-ci-cd branch from 25e4727 to 75b57c3 Compare February 2, 2026 11:00
@pragmaxim
Copy link
Contributor

pragmaxim commented Feb 3, 2026

@etimofeeva I set the VARs into GH, so please read it like this for the connectivity and integration tests :

  - name: Run unit tests in Docker (no temp file)
    env:
      VARS_JSON: ${{ toJSON(vars) }}
    shell: bash
    run: |
      docker run --rm \
        --env-file <(echo "$VARS_JSON" | jq -r '
          to_entries[]
          | select(.key|test("^BB_RPC_(URL_HTTP|URL_WS)_"))
          | "\(.key)=\(.value)"
        ') \
        -v "$PWD:/src" \
        blockbook-build bash -c "..."

@pragmaxim
Copy link
Contributor

pragmaxim commented Feb 5, 2026

@etimofeeva you need to rebase it on the branch fix-closing-rocksdb-on-shutdown-signal which has connectivity tests done the same way as unit test or integration tests

See https://github.com/trezor/blockbook/blob/fix-closing-rocksdb-on-shutdown-signal/docs/testing.md

there is :

    make test – run unit tests only (note that make deb* and make all* commands always run also test target)
    make test-connectivity – run connectivity checks only
    make test-integration – run integration tests only
    make test-all – run all tests above

and

test-integration: prepare-sources
	cd $(BLOCKBOOK_SRC) && go test -tags 'integration' `go list github.com/trezor/blockbook/tests/...` $(ARGS)

test-connectivity: prepare-sources
	cd $(BLOCKBOOK_SRC) && go test -tags 'integration' `go list github.com/trezor/blockbook/tests/...` -run 'TestIntegration/.*/connectivity' $(ARGS)

Replace bash/curl connectivity tests with the Go-based connectivity
test suite from the integration test framework. The CI now uses
'make test-connectivity' which runs TestIntegration/.*/connectivity
via go test, matching the same pattern as unit and integration tests.

Backend URLs are read from GitHub Actions variables (BB_RPC_URL_HTTP_*,
BB_RPC_URL_WS_*) and forwarded into Docker by the Makefile's BB_RPC_ENV.
@etimofeeva etimofeeva force-pushed the github-actions-ci-cd branch from 36c87b7 to b7d2415 Compare February 9, 2026 10:36
- Add workflow_dispatch trigger with inputs: coin_filter, run_unit_tests,
  run_connectivity_tests, run_integration_tests
- coin_filter accepts regex (e.g. 'bitcoin', 'ethereum', 'bitcoin|ethereum|bsc')
- Integration tests (rpc + sync) are manual-only (default off) since they
  are heavy and require live backends
- Connectivity tests run automatically on push/PR, or manually with filter
- Unit tests can be skipped in manual runs to speed up targeted testing
UTXO chains (bitcoin, bcash, dogecoin, litecoin, zcash) use internal
backends unreachable from GitHub-hosted runners. Removed them from
the CI env blocks so connectivity and integration tests only run
against publicly reachable EVM endpoints (quicknode).

UTXO chains are still fully tested on the dev server where internal
backends are accessible.
The Go test framework runs ALL coins listed in tests.json with
'connectivity' enabled, falling back to default config URLs when
env vars are absent. This exposed internal infrastructure (127.0.0.1
defaults and sldev.cz URLs) in CI logs.

Now both connectivity-tests and integration-tests always apply an
EVM-only coin filter (avalanche|bsc|arbitrum|base|ethereum|optimism|polygon)
unless a manual workflow_dispatch provides a custom coin_filter.

UTXO chains remain fully testable on the dev server.
The BB_RPC_URL_HTTP_ethereum GitHub variable still pointed to an
internal sldev.cz backend. Removed ethereum from CI env blocks and
EVM_COINS filter until a public endpoint is configured.

Remaining CI-tested chains: avalanche, bsc, arbitrum, base, optimism, polygon.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants