Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Refresh functional test repo #21

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions .github/workflows/run-regtest-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
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
Comment on lines +4 to +15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

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: Determine core commit SHA
id: core-commit
run: |
core_commit=${{ github.event.inputs.core_commit || 'feat/more-multi-miner-fixes-jude' }}
if git ls-remote --exit-code --heads https://github.com/stacks-network/stacks-core.git $core_commit; then
core_commit_sha=$(git ls-remote https://github.com/stacks-network/stacks-core.git $core_commit | awk '{print $1}')
elif git ls-remote --exit-code --refs https://github.com/stacks-network/stacks-core.git $core_commit; then
core_commit_sha=$core_commit
else
echo "Invalid core_commit: $core_commit"
exit 1
fi
echo "::set-output name=sha::$core_commit_sha"

- 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${{ steps.core-commit.outputs.sha }}/' docker-compose.yml
sed -i 's/\(&MINE_INTERVAL_EPOCH25 \).*/\12s/' docker-compose.yml
sed -i 's/\(&MINE_INTERVAL_EPOCH3 \).*/\16s/' docker-compose.yml
sed -i 's/\(&&NAKAMOTO_BLOCK_INTERVAL \).*/\14s/' 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
[[ustx_balance]]
address = "ST3PF13W7Z0RRM42A8VZRVFQ75SV1K26RXEP8YGKJ"
amount = 10000000000000000
# secretKey = b463f0df6c05d2f156393eee73f8016c5372caa0e9e29a901bb7171d90dc4f1401
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'
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ dist/**/*
yarn.lock
.vercel
.git-info


# clarinet
.cache
21 changes: 21 additions & 0 deletions Clarinet.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[project]
name = "devnet"
description = ""
authors = []
telemetry = false
cache_dir = "./.cache"

# [contracts.counter]
# path = "contracts/counter.clar"

[repl.analysis]
passes = ["check_checker"]
check_checker = { trusted_sender = false, trusted_caller = false, callee_filter = false }

# Check-checker settings:
# trusted_sender: if true, inputs are trusted after tx_sender has been checked.
# trusted_caller: if true, inputs are trusted after contract-caller has been checked.
# callee_filter: if true, untrusted data may be passed into a private function without a
# warning, if it gets checked inside. This check will also propagate up to the
# caller.
# More informations: https://www.hiro.so/blog/new-safety-checks-in-clarinet
8 changes: 8 additions & 0 deletions deployments/default.devnet-plan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
id: 0
name: Devnet deployment
network: devnet
stacks-node: "http://localhost:20443"
bitcoin-node: "http://devnet:devnet@localhost:18443"
plan:
batches: []
Loading
Loading