-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (66 loc) · 2.66 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
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:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- uses: docker/setup-buildx-action@v3
- uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Create buildx builder
run: docker buildx create --use
- 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 or update 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
- name: Run regtest tests
run: npx jest --runInBand --testNamePattern='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