Export dc-auto-top leg liveness and DCA input gauges #4059
This file contains hidden or 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: Tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| - develop | |
| env: | |
| SOLANA_CLI_VERSION: 2.1.6 | |
| jobs: | |
| test-rust-lint: | |
| name: Test Rust Lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: ./.github/actions/setup/ | |
| # Every other job takes its compiler from setup-anchor's `rustup default 1.85.0`; this one | |
| # does not run setup-anchor, so without a version here it takes whatever the runner image | |
| # ships and the gate drifts away from the code. It cannot simply reuse 1.85.0: the clippy | |
| # flags below name lints that only exist in a later release, and an unknown lint is itself | |
| # an error under `-D warnings`. Bump this deliberately, and expect new lints when you do. | |
| - run: rustup install 1.98.0 --component clippy,rustfmt --profile minimal && rustup default 1.98.0 | |
| - uses: actions/cache@v4 | |
| name: Cache Cargo registry + index | |
| id: cache-cargo-build | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
| - run: cargo build --locked | |
| - run: cargo fmt -- --check | |
| # or_fun_call is on because `ok_or(error!(..))` builds the error on the success path too, | |
| # and an AnchorError owns two Strings. The heap a program gets is a bump allocator that | |
| # never frees, so errors that are never returned still consume it. | |
| - run: cargo clippy --all-targets -- -D warnings -D clippy::or_fun_call -A clippy::result_large_err -A clippy::too_many_arguments -A clippy::uninlined-format-args -A clippy::manual_is_multiple_of -A ambiguous_glob_reexports -A unexpected-cfgs | |
| check-idls-changeset: | |
| name: Check @helium/idls Changeset | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect changed programs | |
| id: changed | |
| run: | | |
| BASE=${{ github.event.pull_request.base.sha }} | |
| DIRS=$(git diff --name-only "$BASE"...HEAD | grep -E '^programs/[^/]+/(src/|Cargo\.toml)' | cut -d/ -f2 | sort -u | tr '\n' ' ') | |
| echo "dirs=$DIRS" >> "$GITHUB_OUTPUT" | |
| if [ -z "$DIRS" ]; then | |
| echo "No program source changes; skipping." | |
| else | |
| echo "Changed programs: $DIRS" | |
| fi | |
| - uses: ./.github/actions/setup-anchor/ | |
| if: steps.changed.outputs.dirs != '' | |
| - uses: actions/cache@v4 | |
| if: steps.changed.outputs.dirs != '' | |
| name: Cache Cargo registry + index | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Require an @helium/idls changeset when the generated IDL changes | |
| if: steps.changed.outputs.dirs != '' | |
| # @helium/idls has no src/ of its own -- it compiles the generated | |
| # target/types, which is gitignored. Changesets tooling only diffs | |
| # packages/, so IDL changes never trigger an idls bump on their own | |
| # and the published package silently goes stale. Internal-only logic | |
| # changes don't alter the IDL, so build the IDL at base and head | |
| # (anchor idl build parses the source; no BPF build) and require a | |
| # changeset only when the generated IDL actually differs. | |
| run: | | |
| set -e | |
| BASE=${{ github.event.pull_request.base.sha }} | |
| DIRS="${{ steps.changed.outputs.dirs }}" | |
| mkdir -p /tmp/idl-head /tmp/idl-base | |
| for dir in $DIRS; do | |
| name=$(echo "$dir" | tr '-' '_') | |
| ~/.cargo/bin/anchor idl build -p "$name" > "/tmp/idl-head/$name.json" | |
| done | |
| git checkout --detach "$BASE" | |
| DIFFERING="" | |
| for dir in $DIRS; do | |
| name=$(echo "$dir" | tr '-' '_') | |
| if [ ! -d "programs/$dir" ]; then | |
| DIFFERING="$DIFFERING $name(new-program)" | |
| continue | |
| fi | |
| if ! ~/.cargo/bin/anchor idl build -p "$name" > "/tmp/idl-base/$name.json"; then | |
| DIFFERING="$DIFFERING $name(base-idl-build-failed)" | |
| continue | |
| fi | |
| # metadata.version tracks the crate version, not the interface -- | |
| # a version bump alone shouldn't demand an idls republish. | |
| if ! diff <(jq -S 'del(.metadata.version)' "/tmp/idl-base/$name.json") \ | |
| <(jq -S 'del(.metadata.version)' "/tmp/idl-head/$name.json") > "/tmp/$name.idl.diff"; then | |
| DIFFERING="$DIFFERING $name" | |
| echo "=== IDL diff for $name ===" | |
| cat "/tmp/$name.idl.diff" | |
| fi | |
| done | |
| git checkout - | |
| if [ -z "$DIFFERING" ]; then | |
| echo "Program sources changed but generated IDLs are identical; no @helium/idls bump needed." | |
| exit 0 | |
| fi | |
| echo "IDL changed for:$DIFFERING" | |
| ADDED=$(git diff --name-only --diff-filter=A "$BASE"...HEAD -- '.changeset/*.md') | |
| if [ -n "$ADDED" ] && grep -l '@helium/idls' $ADDED > /dev/null 2>&1; then | |
| echo "Found @helium/idls changeset." | |
| exit 0 | |
| fi | |
| # Release PRs (develop -> master) carry the consumed changeset: the | |
| # .changeset/*.md was deleted by Version Packages, but the version | |
| # bump it produced is in the diff, which proves the flow ran. | |
| if git diff "$BASE"...HEAD -- packages/idls/package.json | grep -q '^+.*"version"'; then | |
| echo "@helium/idls version already bumped in this PR (changeset consumed)." | |
| exit 0 | |
| fi | |
| echo "This PR changes the generated IDL for:$DIFFERING -- but adds no" | |
| echo "changeset for @helium/idls, which publishes those generated types." | |
| echo "Run: npx changeset -- and include \"@helium/idls\" (patch is usually right)." | |
| exit 1 | |
| test-unit: | |
| name: Rust Unit Tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: ./.github/actions/setup/ | |
| - uses: actions/cache@v4 | |
| name: Cache Cargo registry + index | |
| id: cache-cargo-build | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
| - run: cargo build --locked | |
| - run: cargo test --lib | |
| test-atomic-data-publisher: | |
| name: Atomic Data Publisher Tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_DB: atomic_test | |
| POSTGRES_USER: test | |
| POSTGRES_PASSWORD: test | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ./.github/actions/setup/ | |
| - name: Install protobuf compiler | |
| run: sudo apt-get install -y protobuf-compiler | |
| - uses: actions/cache@v4 | |
| name: Cache Cargo registry + index | |
| id: cache-cargo-build | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| key: cargo-${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
| - run: cargo test --locked | |
| working-directory: utils/atomic-data-publisher | |
| env: | |
| DATABASE_URL: postgres://test:test@localhost:5432/atomic_test | |
| build: | |
| name: Build Anchor | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: ./.github/actions/build-anchor/ | |
| with: | |
| testing: true | |
| - uses: ./.github/actions/localnet-accounts/ | |
| test-devflow: | |
| needs: build | |
| name: Test Development Workflow | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ./.github/actions/build-anchor/ | |
| with: | |
| testing: true | |
| - uses: ./.github/actions/setup-ts/ | |
| - uses: ./.github/actions/localnet-accounts/ | |
| - uses: ./.github/actions/start-localnet/ | |
| - name: Run bootstrap script | |
| run: ./scripts/bootstrap.sh | |
| test-helium-vote-service: | |
| needs: build | |
| name: Test Helium Vote Service | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ./.github/actions/build-anchor/ | |
| with: | |
| testing: true | |
| - uses: ./.github/actions/setup-ts/ | |
| - run: pnpm --filter @helium/helium-vote-service test | |
| test-docker-builds: | |
| needs: build | |
| name: Test Docker Builds | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| test: | |
| - utils/ecc-sig-verifier | |
| - utils/atomic-data-publisher | |
| - packages/monitor-service | |
| - packages/faucet-service | |
| - packages/metadata-service | |
| - packages/distributor-oracle | |
| - packages/account-postgres-sink-service | |
| - packages/fanout-metadata-service | |
| - packages/tokens-to-rent-service | |
| - packages/rewards-oracle-faucet-service | |
| - packages/vsr-metadata-service | |
| - packages/crons | |
| - packages/geocoder-service | |
| - packages/recent-helium-transactions-service | |
| - packages/blockchain-api | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ./.github/actions/build-anchor/ | |
| if: startsWith(matrix.test, 'packages/') | |
| with: | |
| testing: true | |
| - uses: ./.github/actions/setup-ts/ | |
| if: startsWith(matrix.test, 'packages/') | |
| - name: Build idls package | |
| if: startsWith(matrix.test, 'packages/') | |
| run: pnpm turbo run build --filter=@helium/idls | |
| - name: Free disk space | |
| # Hosted runners ship ~14GB free but waste tens of GB on toolchains the | |
| # Docker build never uses; the heavier images (e.g. blockchain-api) hit | |
| # "No space left on device". Reclaim it before building. | |
| run: | | |
| sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/.ghcup \ | |
| /usr/local/lib/android /opt/hostedtoolcache/CodeQL | |
| sudo docker image prune --all --force | |
| df -h | |
| - name: Build Docker image | |
| run: | | |
| # JS services with turbo prune build from repo root | |
| # Other services (utils/*, geocoder) build from their own directory | |
| if grep -q "turbo prune" "$DOCKER_PATH/Dockerfile" 2>/dev/null; then | |
| docker build -f $DOCKER_PATH/Dockerfile . | |
| else | |
| cd $DOCKER_PATH && docker build . | |
| fi | |
| env: | |
| DOCKER_PATH: ${{ matrix.test }} | |
| test-rust-builds: | |
| needs: build | |
| name: Test Rust Builds | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| test: | |
| - utils/ecc-sig-verifier | |
| - utils/hpl-utils | |
| - utils/migration-tx-executor | |
| - utils/vehnt | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ./.github/actions/build-anchor/ | |
| with: | |
| testing: true | |
| - run: cd $RUST_PATH && cargo build | |
| env: | |
| RUST_PATH: ${{ matrix.test }} | |
| test-contracts: | |
| needs: build | |
| name: Test Anchor Contracts | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| test: | |
| - tests/circuit-breaker.ts | |
| - tests/data-credits.ts | |
| - tests/distributor-oracle.ts | |
| - tests/helium-entity-manager.ts | |
| - tests/mobile-entity-manager.ts | |
| - tests/helium-sub-daos.ts | |
| - tests/hexboosting.ts | |
| - tests/hpl-crons.ts | |
| - tests/lazy-distributor.ts | |
| - tests/lazy-transactions.ts | |
| - tests/treasury-management.ts | |
| - tests/price-oracle.ts | |
| - tests/voter-stake-registry.ts | |
| - tests/fanout.ts | |
| - tests/sus.ts | |
| - tests/mini-fanout.ts | |
| - tests/mini-fanout-bankrun.ts | |
| - tests/welcome-pack.ts | |
| - tests/dc-auto-topoff.ts | |
| - tests/dc-auto-topoff-bankrun.ts | |
| - tests/tuktuk-dca.ts | |
| - tests/priority-fees.ts | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: ./.github/actions/build-anchor/ | |
| with: | |
| testing: true | |
| - uses: ./.github/actions/setup-ts/ | |
| - uses: ./.github/actions/localnet-accounts/ | |
| - uses: ./.github/actions/start-localnet/ | |
| - run: ANCHOR_WALLET=${HOME}/.config/solana/id.json pnpm exec ts-mocha -p ./tsconfig.test.json -t 1000000 --exit $TEST | |
| env: | |
| TESTING: true | |
| TEST: ${{ matrix.test }} | |
| ANCHOR_PROVIDER_URL: http://localhost:8899 | |
| - name: Check CU table covers test traffic | |
| # priority-fees.ts (mocked), sus.ts (remote RPC) and the bankrun suites (in-process, | |
| # no validator) never commit localnet traffic, so the CU sampler legitimately sees 0 — | |
| # don't gate them. A suite added here that does not reach localnet belongs in this list. | |
| if: >- | |
| matrix.test != 'tests/priority-fees.ts' | |
| && matrix.test != 'tests/sus.ts' | |
| && !endsWith(matrix.test, '-bankrun.ts') | |
| run: pnpm run check-cu-table | |
| working-directory: packages/spl-utils | |
| env: | |
| RPC_URL: http://localhost:8899 |