-
Notifications
You must be signed in to change notification settings - Fork 647
199 lines (181 loc) · 6.13 KB
/
stacks-core-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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
## Github workflow to run full genesis and unit tests
name: Tests::Stacks Core
on:
workflow_call:
## env vars are transferred to composite action steps
env:
BITCOIND_TEST: 1
RUST_BACKTRACE: full
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
TEST_TIMEOUT: 30
concurrency:
group: stacks-core-tests-${{ github.head_ref || github.ref || github.run_id }}
## Only cancel in progress if this is for a PR
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
# Full genesis test with code coverage
full-genesis:
name: Full Genesis Test
runs-on: ubuntu-latest
strategy:
## Continue with the test matrix even if we've had a failure
fail-fast: false
## Run a maximum of 2 concurrent tests from the test matrix
max-parallel: 2
matrix:
test-name:
- neon_integrations::bitcoind_integration_test
steps:
## Setup test environment
- name: Setup Test Environment
id: setup_tests
uses: stacks-network/actions/stacks-core/testenv@main
with:
genesis: true
btc-version: "25.0"
## Run test matrix using restored cache of archive file
## - Test will timeout after env.TEST_TIMEOUT minutes
- name: Run Tests
id: run_tests
timeout-minutes: ${{ fromJSON(env.TEST_TIMEOUT) }}
uses: stacks-network/actions/stacks-core/run-tests@main
with:
test-name: ${{ matrix.test-name }}
threads: 1
archive-file: ~/genesis_archive.tar.zst
## Upload code coverage file
- name: Code Coverage
id: codecov
uses: stacks-network/actions/codecov@main
with:
test-name: large_genesis
filename: ./lcov.info
- name: Status Output
run: |
echo "run_tests: ${{ steps.run_tests.outputs.status }}"
echo "codecov: ${{ steps.codecov.outputs.status }}"
- name: Check Failures
if: steps.run_tests.outputs.status == 'failure' || steps.codecov.outputs.status == 'failure'
run: exit 1
# Unit tests with code coverage
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
## Continue the workflow in case a step fails (ex a single test fails)
continue-on-error: true
strategy:
## Continue the workflow in case a step fails (ex a single test fails)
fail-fast: false
matrix:
## Partition the tests into 8 jobs
## - This is used in a later step when running `cargo nextest run ... --partition count:num/8`
partition: [1, 2, 3, 4, 5, 6, 7, 8]
steps:
## Setup test environment
- name: Setup Test Environment
id: setup_tests
uses: stacks-network/actions/stacks-core/testenv@main
with:
btc-version: "25.0"
## Run test matrix using restored cache of archive file
## - Test will timeout after env.TEST_TIMEOUT minutes
- name: Run Tests
id: run_tests
timeout-minutes: ${{ fromJSON(env.TEST_TIMEOUT) }}
uses: stacks-network/actions/stacks-core/run-tests/partition@main
with:
partition: ${{ matrix.partition }}
total-partitions: 8
## Create and upload code coverage file
- name: Code Coverage
id: codecov
uses: stacks-network/actions/codecov@main
with:
test-name: ${{ matrix.test-name }}
## Generate and upload openapi html artifact
open-api-validation:
name: OpenAPI Validation
runs-on: ubuntu-latest
steps:
- name: OpenAPI
id: openapi
uses: stacks-network/actions/openapi@main
with:
input: ./docs/rpc/openapi.yaml
output: ./open-api-docs.html
## Disabled
## - this test can take several hours to run
nettest:
if: ${{ false }}
name: Net-Test
runs-on: ubuntu-latest
steps:
## checkout the code
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Run network relay tests
id: nettest
env:
DOCKER_BUILDKIT: 1
run: docker build -f ./.github/actions/bitcoin-int-tests/Dockerfile.net-tests .
# Core contract tests
core-contracts-clarinet-test:
name: Core Contracts Test
defaults:
run:
working-directory: "./contrib/core-contract-tests/"
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Execute core contract unit tests with clarinet-sdk
id: clarinet_unit_test
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: "npm"
cache-dependency-path: "./contrib/core-contract-tests/package-lock.json"
- run: npm ci
- run: npm test
## Upload code coverage file
- name: Code Coverage
id: codecov
uses: stacks-network/actions/codecov@main
with:
# We'd like to uncomment the below line once the codecov upload is working
# fail_ci_if_error: true
test-name: ${{ matrix.test-name }}
upload-only: true
filename: ./contrib/core-contract-tests/lcov.info
# Core contract tests on Clarinet v1
# Check for false positives/negatives
core-contracts-clarinet-test-clarinet-v1:
name: Core Contracts Test Clarinet V1
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
id: git_checkout
uses: actions/checkout@v3
- name: Execute core contract unit tests in Clarinet
id: clarinet_unit_test_v1
uses: docker://hirosystems/clarinet:1.7.1
with:
args: test --manifest-path=./contrib/core-contract-tests/Clarinet.toml contrib/core-contract-tests/tests/bns/name_register_test.ts
check-tests:
name: Check Tests
runs-on: ubuntu-latest
if: always()
needs:
- full-genesis
- unit-tests
- open-api-validation
- core-contracts-clarinet-test
steps:
- name: Check Tests Status
id: check_tests_status
uses: stacks-network/actions/check-jobs-status@main
with:
jobs: ${{ toJson(needs) }}
summary_print: "true"