Skip to content

feat: Refresh functional test repo #14

feat: Refresh functional test repo

feat: Refresh functional test repo #14

name: run-regtest-tests
on:
workflow_dispatch:
inputs:
core_commit:
description: 'regtest-env config `STACKS_BLOCKCHAIN_COMMIT` (defaults to `develop`)'
required: false
default: 'develop'
type: string
regtest_env_commit:
description: 'regtest-env commit (defaults to `feat/signer`)'
required: false
default: 'feat/signer'
type: string
pull_request:
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }} + ${{ github.event.inputs.core_commit }} + ${{ github.event.inputs.regtest_env_commit }}'
cancel-in-progress: true
jobs:
run-regtest-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Cache regtest-env
uses: actions/cache@v3
id: cache-regtest-env
with:
path: /tmp/regtest-env
key: ${{ runner.os }}-regtest-env
- name: Clone regtest-env
run: |
if [ ! -d "/tmp/regtest-env" ]; then
git clone https://github.com/hirosystems/stacks-regtest-env.git /tmp/regtest-env
fi
cd /tmp/regtest-env
git fetch origin
git checkout ${{ github.event.inputs.regtest_env_commit || 'feat/signer' }}
git pull origin ${{ github.event.inputs.regtest_env_commit || 'feat/signer' }}
- name: Prepare regtest-env
run: |
cd /tmp/regtest-env
sed -i 's/\(&STACKS_BLOCKCHAIN_COMMIT \).*/\1${{ github.event.inputs.core_commit || 'develop' }}/' docker-compose.yml
sed -i 's/\(&MINE_INTERVAL_EPOCH25 \).*/\12s/' docker-compose.yml
sed -i 's/\(&MINE_INTERVAL_EPOCH3 \).*/\17s/' docker-compose.yml
sed -i 's/\(&&NAKAMOTO_BLOCK_INTERVAL \).*/\13s/' docker-compose.yml
docker compose build
cat << EOF >> stacks-krypton-miner.toml
# DEVNET WALLETS
[[ustx_balance]]
address = "ST1SJ3DTE5DN7X54YDH5D64R3BCB6A2AG2ZQ8YPD5"
amount = 10000000000000000
# secretKey = 7287ba251d44a4d3fd9276c88ce34c5c52a038955511cccaf77e61068649c17801
[[ustx_balance]]
address = "ST2CY5V39NHDPWSXMW9QDT3HC3GD6Q6XX4CFRK9AG"
amount = 10000000000000000
# secretKey = 530d9f61984c888536871c6573073bdfc0058896dc1adfe9a6a10dfacadc209101
[[ustx_balance]]
address = "ST2JHG361ZXG51QTKY2NQCVBPPRRE2KZB1HR05NNC"
amount = 10000000000000000
# secretKey = d655b2523bcd65e34889725c73064feb17ceb796831c0e111ba1a552b0f31b3901
[[ustx_balance]]
address = "ST2NEB84ASENDXKYGJPQW86YXQCEFEX2ZQPG87ND"
amount = 10000000000000000
# secretKey = f9d7206a47f14d2870c163ebab4bf3e70d18f5d14ce1031f3902fbbc894fe4c701
[[ustx_balance]]
address = "ST2REHHS5J3CERCRBEPMGH7921Q6PYKAADT7JP2VB"
amount = 10000000000000000
# secretKey = 3eccc5dac8056590432db6a35d52b9896876a3d5cbdea53b72400bc9c2099fe801
[[ustx_balance]]
address = "ST3AM1A56AK2C1XAFJ4115ZSV26EB49BVQ10MGCS0"
amount = 10000000000000000
# secretKey = 7036b29cb5e235e5fd9b09ae3e8eec4404e44906814d5d01cbca968a60ed4bfb01
EOF
# - name: Build regtest-env
# uses: docker/build-push-action@v4
# with:
# context: /tmp/regtest-env
# push: false
# tags: hirosystems/stacks-regtest-env:latest
# cache-from: type=gha
# cache-to: type=gha,mode=max
- name: Run regtest tests
run: npx jest --runInBand -t 'regtest-env pox-4 stack-stx \(in reward-phase\)'
env:
NETWORK_UP_CMD: cd /tmp/regtest-env && docker compose down --volumes --remove-orphans --timeout=1 --rmi=all && docker compose up --build -d
NETWORK_DOWN_CMD: cd /tmp/regtest-env && docker compose down --volumes --remove-orphans --timeout=1