perf(station): make concurrent balance queries more efficient #2721
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Code tests' | |
on: | |
pull_request: | |
types: | |
- opened | |
- edited | |
- reopened | |
- synchronize | |
- labeled | |
merge_group: | |
types: [checks_requested] | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
# When getting Rust dependencies, retry on network error: | |
CARGO_NET_RETRY: 10 | |
# Use the local .curlrc | |
CURL_HOME: . | |
# sscache environment variables | |
SCCACHE_GHA_ENABLED: 'true' | |
RUSTC_WRAPPER: 'sccache' | |
jobs: | |
test-rust: | |
name: 'test-rust:required' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: 'Test cargo crates' | |
run: cargo test --locked --workspace --exclude integration-tests | |
test-node: | |
name: 'test-node:required' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- name: 'Setup Node' | |
uses: ./.github/actions/setup-node | |
- name: 'Install Dependencies' | |
run: | | |
pnpm install --frozen-lockfile | |
- name: 'Check code' | |
run: | | |
pnpm test -- --run | |
# Github Actions only supports jobs to be run in parallel, not steps, so we have to build the packages in | |
# separate jobs from the integration tests execution to speed up the build. | |
build-wasms: | |
name: Build canister | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- crate: control-panel | |
canister: control_panel | |
- crate: upgrader | |
canister: upgrader | |
- crate: station | |
canister: station | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: 'Build Package' | |
run: ./scripts/generate-wasm.sh ${{ matrix.crate }} | |
- name: 'Prepare artifacts' | |
run: | | |
mkdir -p artifacts | |
mv tests/integration/wasms/* artifacts | |
- name: 'Upload Artifacts' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: integration-tests | |
path: artifacts/${{ matrix.canister }}.wasm.gz | |
retention-days: 10 | |
if-no-files-found: error | |
download-canisters: | |
name: Download Canister | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- canister: 'icp_ledger' | |
name: 'ledger-canister' | |
- canister: 'icp_index' | |
name: 'ic-icp-index-canister' | |
- canister: 'cmc' | |
name: 'cycles-minting-canister' | |
- canister: 'icrc1_ledger' | |
name: 'ic-icrc1-ledger' | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- name: 'Download Canister' | |
run: ./scripts/download-nns-canister-wasm.sh ${{ matrix.canister }} ${{ matrix.name }} | |
- name: 'Prepare artifacts' | |
run: | | |
mkdir -p artifacts | |
mv tests/integration/wasms/* artifacts | |
- name: 'Upload Artifacts' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: integration-tests | |
path: artifacts/${{ matrix.canister }}.wasm.gz | |
retention-days: 10 | |
if-no-files-found: error | |
integration-tests: | |
name: 'integration-tests:required' | |
needs: [build-wasms, download-canisters] | |
runs-on: ubuntu-latest | |
env: | |
BUILD_WASMS: 'false' | |
DOWNLOAD_NNS_CANISTERS: 'false' | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: 'Download Artifacts' | |
uses: actions/download-artifact@v3 | |
with: | |
name: integration-tests | |
path: tests/integration/wasms | |
- name: Build test canister | |
run: | | |
./scripts/generate-wasm.sh test_canister | |
- name: Run integration tests | |
run: | | |
./scripts/run-integration-tests.sh 2> logs.txt | |
grep "rng succesfully initialized" logs.txt | |
! grep "canister reports healthy already before its initialization has finished" logs.txt | |
deployment-test: | |
name: 'deployment-test:required' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- name: 'Setup Node' | |
uses: ./.github/actions/setup-node | |
- name: 'Run sccache-cache' | |
uses: mozilla-actions/[email protected] | |
- name: 'Install dfx' | |
uses: dfinity/setup-dfx@main | |
- name: 'Start local replica' | |
run: dfx start --clean --host 127.0.0.1:4943 --background | |
- name: 'Perform local deployment' | |
run: ./orbit --init | |
- name: 'Test local deployment' | |
run: | | |
curl http://werw6-ayaaa-aaaaa-774aa-cai.localhost:4943/ | grep "<title>Orbit Wallet</title>" | |
prod-deployment-test: | |
name: 'prod-deployment-test:required' | |
runs-on: ubuntu-latest | |
services: | |
docker: | |
image: docker:dind | |
options: --privileged # Enable Docker in Docker | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock:ro | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- name: 'Setup Docker' | |
run: | | |
docker info # Check if Docker is running | |
- name: 'Setup Node' | |
uses: ./.github/actions/setup-node | |
- name: 'Run sccache-cache' | |
uses: mozilla-actions/[email protected] | |
- name: 'Install dfx' | |
uses: dfinity/setup-dfx@main | |
- name: 'Start local replica' | |
run: dfx start --clean --host 127.0.0.1:4943 --background | |
- name: 'Test prod deployment script' | |
run: | | |
echo y | ./scripts/deploy.sh --local # install | |
curl "http://$(dfx canister id app_wallet).localhost:4943/" | grep "<title>Orbit Wallet</title>" | |
export REUSE_ARTIFACTS=true | |
echo y | ./scripts/deploy.sh --local # upgrade | |
curl "http://$(dfx canister id app_wallet).localhost:4943/" | grep "<title>Orbit Wallet</title>" | |
echo y | ./scripts/deploy.sh --local reset # uninstall and install | |
curl "http://$(dfx canister id app_wallet).localhost:4943/" | grep "<title>Orbit Wallet</title>" |