Skip to content

fix(activation-service): stop leaking internal errors, drop unused KYC_PUBLIC_KEY #5

fix(activation-service): stop leaking internal errors, drop unused KYC_PUBLIC_KEY

fix(activation-service): stop leaking internal errors, drop unused KYC_PUBLIC_KEY #5

name: Test activation service
on:
workflow_dispatch:
# Only on the default branch: a branch that is pushed and then opened as a PR
# would otherwise run this twice, and the integration job is not safe to run
# concurrently (see the concurrency group below).
push:
branches:
- development
paths:
- 'activation-service/**'
- '.github/workflows/100_test_activation_service.yaml'
pull_request:
paths:
- 'activation-service/**'
- '.github/workflows/100_test_activation_service.yaml'
# The integration job funds and sweeps a fixed pool of accounts derived from one
# shared mnemonic, so two runs overlapping would fight over the same balances:
# one run's sweep would empty an account the other had just funded. A single
# global group serialises every run of this workflow, and queues rather than
# cancels so a run already talking to the chain is left to finish and clean up.
concurrency:
group: activation-service-integration
cancel-in-progress: false
jobs:
lint-and-unit:
runs-on: ubuntu-22.04
# Set per job rather than workflow-wide: check-funder below reads a secret and
# never checks the repo out, so a workflow-level working-directory would point
# it at a path that does not exist.
defaults:
run:
working-directory: activation-service
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
# @polkadot/api 15.x requires node >= 18; keep this in step with the Dockerfile.
node-version: 22
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Lint and run unit tests
run: yarn test
# Secrets are not readable from a job-level `if`, so the availability of the funder
# mnemonic is resolved in a step and passed on as an output. Fork pull requests get
# no secrets, so the integration job is skipped there rather than failing.
check-funder:
runs-on: ubuntu-22.04
outputs:
available: ${{ steps.check.outputs.available }}
steps:
- name: Check whether the funder mnemonic is configured
id: check
env:
FUNDER_MNEMONIC: ${{ secrets.ACTIVATION_SERVICE_CI_MNEMONIC }}
run: |
if [ -n "$FUNDER_MNEMONIC" ]; then
echo "available=true" >> "$GITHUB_OUTPUT"
else
echo "available=false" >> "$GITHUB_OUTPUT"
echo "::notice::ACTIVATION_SERVICE_CI_MNEMONIC is not set; skipping the devnet integration test"
fi
integration:
needs: [lint-and-unit, check-funder]
if: needs.check-funder.outputs.available == 'true'
runs-on: ubuntu-22.04
defaults:
run:
working-directory: activation-service
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: yarn install --frozen-lockfile
# The test derives its activation targets from the funder mnemonic (//as-ci//1..5)
# and sweeps them back both before and after the run, so a run that dies mid-way
# is reclaimed by the next one instead of stranding funds.
- name: Run integration tests against devnet
env:
URL: wss://tfchain.dev.grid.tf/ws
MNEMONIC: ${{ secrets.ACTIVATION_SERVICE_CI_MNEMONIC }}
KYC_PUBLIC_KEY: unused-but-required-by-bin-www
# Whole TFT, matching the chart default. Each run moves this out to a pool
# account and sweeps it straight back, so the funder only pays ~0.002 TFT
# in fees per run.
ACTIVATION_AMOUNT: '0.1'
run: yarn test:integration