From fec6f86e647ec4b78a45992cad9d59ad5820e49c Mon Sep 17 00:00:00 2001 From: Jacinta Ferrant Date: Wed, 18 Dec 2024 19:06:55 -0500 Subject: [PATCH] Add stacks-signer-tests.yml to run stacks signer unit tests in CI Signed-off-by: Jacinta Ferrant --- .github/workflows/ci.yml | 23 +++++++++++++ .github/workflows/stacks-signer-tests.yml | 41 +++++++++++++++++++++++ .github/workflows/standalone-tests.yml | 17 ++++++++++ 3 files changed, 81 insertions(+) create mode 100644 .github/workflows/stacks-signer-tests.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c59f23e8d..8b285a4e33 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -209,6 +209,29 @@ jobs: - check-release uses: ./.github/workflows/p2p-tests.yml + + stacks-signer-tests: + if: | + needs.check-release.outputs.is_release == 'true' || ( + github.event_name == 'workflow_dispatch' || + github.event_name == 'pull_request' || + github.event_name == 'merge_group' || + ( + contains(' + refs/heads/master + refs/heads/develop + refs/heads/next + ', github.event.pull_request.head.ref) && + github.event_name == 'push' + ) + ) + name: Stacks Signer Unit Tests + needs: + - rustfmt + - create-cache + - check-release + uses: ./.github/workflows/stacks-signer-tests.yml + ## Test to run on a tagged release ## ## Runs when: diff --git a/.github/workflows/stacks-signer-tests.yml b/.github/workflows/stacks-signer-tests.yml new file mode 100644 index 0000000000..5e234ddb8e --- /dev/null +++ b/.github/workflows/stacks-signer-tests.yml @@ -0,0 +1,41 @@ +## Run Stacks Signer Unit Tests +name: Tests::Stacks Signer Unit Tests + +on: + workflow_call: + +env: + 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: + unit-tests: + name: Unit Tests + runs-on: ubuntu-latest + steps: + # Checkout the latest code + - name: Checkout Latest Code + uses: actions/checkout@v3 + + # Install Rust toolchain + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + + # Run unit tests + - name: Run Unit Tests + run: cargo test -p stacks-signer -- --nocapture --test-threads 1 + continue-on-error: true + + # Upload code coverage results + - name: Code Coverage + uses: stacks-network/actions/codecov@main + with: + test-name: stacks-signer-tests diff --git a/.github/workflows/standalone-tests.yml b/.github/workflows/standalone-tests.yml index 8a56acc3ec..6eba6de42d 100644 --- a/.github/workflows/standalone-tests.yml +++ b/.github/workflows/standalone-tests.yml @@ -25,6 +25,7 @@ on: - Slow Tests - Stacks-Core Tests - SBTC Tests + - Stacks-Signer Tests ## Set the display name to the test being run run-name: ${{ inputs.workflow }} @@ -148,3 +149,19 @@ jobs: - create-cache uses: ./.github/workflows/sbtc-tests.yml + ## Runs when: + ## either or of the following: + ## - workflow is 'Release Tests' + ## - workflow is 'CI Tests' + ## - workflow is 'Stacks-Signer Tests' + stacks-signer-tests: + if: | + ( + inputs.workflow == 'Release Tests' || + inputs.workflow == 'CI Tests' || + inputs.workflow == 'Stacks-Signer Tests' + ) + name: Stacks Signer Tests + needs: + - create-cache + uses: ./.github/workflows/stacks-signer-tests.yml \ No newline at end of file