Skip to content

Restrict addresses on Calibnet USDFC faucet #529

Restrict addresses on Calibnet USDFC faucet

Restrict addresses on Calibnet USDFC faucet #529

Workflow file for this run

name: e2e
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: "${{ github.ref != 'refs/heads/main' }}"
on:
workflow_dispatch:
merge_group:
pull_request:
branches:
- main
push:
branches:
- main
env:
CACHE_TIMEOUT_MINUTES: 5
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: sccache
CC: sccache clang
CXX: sccache clang++
jobs:
e2e:
runs-on: ubuntu-latest
# Each 'include' entry will run as a separate job with its own parameters.
strategy:
fail-fast: false
matrix:
include:
- name: "Browser Tests"
script: "e2e/script.js"
port: 8787
k6_browser_enabled: true
state_dir: "browser"
- name: "API Tests"
script: "e2e/test_claim_token_api.js"
port: 8787
k6_browser_enabled: false
state_dir: "api"
- name: "Claim Token API CORS Tests"
script: "e2e/test_cors.js"
port: 8787
k6_browser_enabled: false
state_dir: "cors"
name: "E2E ${{ matrix.name }}"
steps:
- name: Setup sccache
uses: mozilla-actions/[email protected]
timeout-minutes: "${{ fromJSON(env.CACHE_TIMEOUT_MINUTES) }}"
continue-on-error: true
- name: Checkout code
uses: actions/checkout@v5
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
~/.npm
key: ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock', '**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-deps-
- name: Install wasm-pack
run:
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Install wasm-opt
uses: sigoden/install-binary@v1
with:
repo: WebAssembly/binaryen
name: wasm-opt
- name: Install worker-build
run: cargo install --locked --force worker-build
- name: Set up k6
uses: grafana/setup-k6-action@v1
with:
browser: ${{ matrix.k6_browser_enabled }}
- name: Set up secrets
shell: bash
run: |
echo "SECRET_WALLET=${{ secrets.TEST_CALIBNET_PRIVATE_KEY_HEX }}" > .dev.vars
echo "SECRET_MAINNET_WALLET=${{ secrets.TEST_MAINNET_PRIVATE_KEY_HEX }}" >> .dev.vars
echo "SECRET_CALIBNET_USDFC_WALLET=${{ secrets.TEST_CALIBNET_USDFC_PRIVATE_KEY_HEX }}" >> .dev.vars
- name: Build and run website
run: |
# These might or might not be the same as used for deployment. They are used strictly for testing purposes.
# Note: those can't be put directly as environment variables in GH Actions (without a default value) due to
# the way GH Actions handles secrets and variables; forks would not be able to access them and in turn
# would not be able to run the E2E tests.
export FAUCET_TOPUP_REQ_URL="https://github.com/ChainSafe/forest-explorer/discussions/134"
export FAUCET_TX_URL_CALIBNET="https://beryx.io/fil/calibration/"
export FAUCET_TX_URL_MAINNET="https://beryx.io/fil/mainnet/"
# Set to ~0.000000001 tFIL for e2e tests
export CALIBNET_DRIP_AMOUNT=1
corepack enable
yarn --immutable
yarn build
# Use separate state directories to isolate Durable Object storage between parallel runs
yarn wrangler dev --port ${{ matrix.port }} --persist-to .wrangler-state-${{ matrix.state_dir }}-${{ github.run_id }} &
echo "waiting for server on port ${{ matrix.port }}"
timeout 120 sh -c 'until nc -z $0 $1; do sleep 1; done' 127.0.0.1 ${{ matrix.port }}
echo "TCP port check passed, now waiting for HTTP server to be ready..."
timeout 120 sh -c 'until curl -s --max-time 30 http://127.0.0.1:${{ matrix.port }} > /dev/null; do echo "Waiting for HTTP server (first request may take 60-90s)..."; sleep 5; done'
echo "Server is ready!"
- name: Run k6 E2E Test
uses: grafana/run-k6-action@v1
with:
path: ${{ matrix.script }}
env:
API_URL: "http://127.0.0.1:${{ matrix.port }}"