-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (109 loc) · 4.9 KB
/
run-regtest-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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
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 || 'fix/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