mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-29 04:05:21 +08:00
200 lines
6.3 KiB
YAML
200 lines
6.3 KiB
YAML
## 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@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
|
|
- 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@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
- name: Execute core contract unit tests with clarinet-sdk
|
|
id: clarinet_unit_test
|
|
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
|
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@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
|
|
- 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"
|