diff --git a/.github/workflows/cargo-hack-check.yml b/.github/workflows/cargo-hack-check.yml new file mode 100644 index 0000000000..c1f208562d --- /dev/null +++ b/.github/workflows/cargo-hack-check.yml @@ -0,0 +1,118 @@ +name: Cargo Hack Check + +on: + workflow_call: + +env: + RUST_BACKTRACE: full + +concurrency: + group: cargo-hack-check-${{ github.head_ref || github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + # Setup job to prepare common dependencies + setup: + name: Setup + runs-on: ubuntu-latest + outputs: + rust-toolchain: ${{ steps.toolchain.outputs.rust-toolchain }} + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Get Rust toolchain + id: toolchain + run: echo "rust-toolchain=$(cat ./rust-toolchain)" >> $GITHUB_OUTPUT + + # Native targets (Windows/Linux) + native-targets: + name: All Crates (Windows/Linux) + runs-on: ubuntu-latest + needs: setup + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Setup Rust with Cache + uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1 + with: + toolchain: ${{ needs.setup.outputs.rust-toolchain }} + target: x86_64-pc-windows-gnu,x86_64-unknown-linux-gnu + cache: true + cache-key: cargo-hack-native-${{ needs.setup.outputs.rust-toolchain }}-${{ hashFiles('**/Cargo.lock') }} + + - name: Install cargo-hack + uses: taiki-e/install-action@2383334cf567d78771fc7d89b6b3802ef1412cf6 # v2.56.8 + with: + tool: cargo-hack + + - name: Install Windows cross-compilation tools + run: | + sudo apt-get update + sudo apt-get install -y gcc-mingw-w64-x86-64 + + - name: Run cargo hack check + run: | + cargo hack check \ + --all \ + --each-feature \ + --no-dev-deps \ + --exclude-features=wasm-deterministic,wasm-web \ + --target x86_64-pc-windows-gnu \ + --target x86_64-unknown-linux-gnu + + # WASM targets - separate cache since dependencies differ + wasm-targets: + name: ${{ matrix.name }} + runs-on: ubuntu-latest + needs: setup + strategy: + fail-fast: false + matrix: + include: + - name: "Clarity & Stacks-Common WASM Web" + command: | + cargo hack check \ + -p clarity-serialization \ + -p stacks-common \ + --each-feature \ + --no-dev-deps \ + --exclude-features=default,rusqlite,ctrlc-handler,wasm-deterministic \ + --features=wasm-web + + - name: "Clarity & Stacks-Common WASM Deterministic" + command: | + cargo hack check \ + -p clarity-serialization \ + -p stacks-common \ + --each-feature \ + --no-dev-deps \ + --include-features=wasm-deterministic,slog_json \ + --features=wasm-deterministic + + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + + - name: Setup Rust with Cache + uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1 + with: + toolchain: ${{ needs.setup.outputs.rust-toolchain }} + target: wasm32-unknown-unknown + cache: true + cache-key: cargo-hack-wasm-${{ matrix.name }}-${{ needs.setup.outputs.rust-toolchain }}-${{ hashFiles('**/Cargo.lock') }} + + - name: Install cargo-hack + uses: taiki-e/install-action@2383334cf567d78771fc7d89b6b3802ef1412cf6 # v2.56.8 + with: + tool: cargo-hack + + - name: Run cargo hack check + run: ${{ matrix.command }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ae2b64189..1d892d8d51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,7 +93,7 @@ jobs: needs: - rustfmt - check-release - secrets: inherit + secrets: inherit uses: ./.github/workflows/github-release.yml with: node_tag: ${{ needs.check-release.outputs.node_tag }} @@ -145,6 +145,27 @@ jobs: - check-release uses: ./.github/workflows/stacks-core-tests.yml + ## Validate constants dumped by stacks-inspect + ## + ## Runs when: + ## - it is a node or signer-only release run + ## or any of: + ## - this workflow is called manually + ## - PR is opened + ## - PR added to merge queue + constants-check: + if: | + needs.check-release.outputs.is_node_release == 'true' || + needs.check-release.outputs.is_signer_release == 'true' || + github.event_name == 'workflow_dispatch' || + github.event_name == 'pull_request' || + github.event_name == 'merge_group' + name: Constants Check + needs: + - rustfmt + - check-release + uses: ./.github/workflows/constants-check.yml + ## Checks to run on built binaries ## ## Runs when: @@ -153,18 +174,18 @@ jobs: ## - this workflow is called manually ## - PR is opened ## - PR added to merge queue - stacks-core-build-tests: + cargo-hack-check: if: | needs.check-release.outputs.is_node_release == 'true' || needs.check-release.outputs.is_signer_release == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' || github.event_name == 'merge_group' - name: Stacks Core Build Tests + name: Cargo Hack Check needs: - rustfmt - check-release - uses: ./.github/workflows/core-build-tests.yml + uses: ./.github/workflows/cargo-hack-check.yml ## Checks to run on built binaries ## diff --git a/.github/workflows/core-build-tests.yml b/.github/workflows/constants-check.yml similarity index 66% rename from .github/workflows/core-build-tests.yml rename to .github/workflows/constants-check.yml index b6ce3f487a..1f12007feb 100644 --- a/.github/workflows/core-build-tests.yml +++ b/.github/workflows/constants-check.yml @@ -1,10 +1,10 @@ -name: Core build tests +name: Constants Check # Only run when: # - PRs are (re)opened against develop branch on: workflow_call: - + jobs: check-consts: name: Check the constants from stacks-inspect @@ -26,27 +26,6 @@ jobs: with: toolchain: ${{ env.RUST_TOOLCHAIN }} - ## run cargo check steps - - name: Cargo Check - id: cargo_check - run: | - cargo check - - - name: Cargo Check (monitoring_prom) - id: cargo_check_prom - run: | - cargo check --features monitoring_prom - - - name: Cargo Check (clarity) - id: cargo_check_clarity - run: | - cargo check -p clarity --no-default-features - - - name: Cargo Check (stacks-common) - id: cargo_check_stacks-common - run: | - cargo check -p stacks-common --no-default-features - - name: Dump constants JSON id: consts-dump run: | diff --git a/clarity/Cargo.toml b/clarity/Cargo.toml index 8e5ff0661f..bd03934a1f 100644 --- a/clarity/Cargo.toml +++ b/clarity/Cargo.toml @@ -51,7 +51,7 @@ default = ["rusqlite"] developer-mode = ["stacks_common/developer-mode"] slog_json = ["stacks_common/slog_json"] rusqlite = ["stacks_common/rusqlite", "dep:rusqlite"] -testing = ["rstest", "rstest_reuse"] +testing = ["rstest", "rstest_reuse", "rusqlite"] devtools = [] rollback_value_check = [] disable-costs = [] diff --git a/stacks-node/Cargo.toml b/stacks-node/Cargo.toml index 61766e5053..d2b8e916b9 100644 --- a/stacks-node/Cargo.toml +++ b/stacks-node/Cargo.toml @@ -70,11 +70,11 @@ name = "stacks-events" path = "src/stacks_events.rs" [features] -monitoring_prom = ["stacks/monitoring_prom", "stacks-signer/monitoring_prom", "async-h1", "async-std", "http-types"] +monitoring_prom = ["stacks/monitoring_prom", "async-h1", "async-std", "http-types"] slog_json = ["stacks/slog_json", "stacks-common/slog_json", "clarity/slog_json"] prod-genesis-chainstate = [] default = [] -testing = ["stacks-common/testing", "stacks/testing", "clarity/testing", "stacks-signer/testing"] +testing = ["stacks-common/testing", "stacks/testing", "clarity/testing"] build-signer-v3-1-0-0-13 = ["signer_v3_1_0_0_13", "libsigner_v3_1_0_0_13", "stacks_v3_1_00_13", "stacks_common_v3_1_00_13"] [package.metadata.pinny]