Skip to content

feat: add cargo hack check on ci #6262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 51 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
82fbfb1
make http-parser and ctrlc optional features
Jiloc Jun 30, 2025
cb16f1a
remove regex from stacks-common
Jiloc Jun 30, 2025
f348b65
move serde_json to workspace. refactor stacks common cargo
Jiloc Jul 1, 2025
6775c85
removed time
Jiloc Jul 1, 2025
7442358
add vm feature flag
Jiloc Jul 1, 2025
75b0191
fix format
Jiloc Jul 2, 2025
5e2eeac
clippy
Jiloc Jul 2, 2025
d186115
make rand optional for CosmWasm support
Jiloc Jul 3, 2025
a9c14bf
Merge branch 'chore/stacks-common-optional-requirements' into chore/c…
Jiloc Jul 3, 2025
97c968c
substitute ::generate with ::from_bytes
Jiloc Jul 3, 2025
d64ad0b
Merge branch 'chore/stacks-common-optional-requirements' into chore/c…
Jiloc Jul 3, 2025
f6621cb
add custom dummy getdefault
Jiloc Jul 4, 2025
526c0d1
Merge branch 'chore/stacks-common-optional-requirements' into chore/c…
Jiloc Jul 4, 2025
309e98d
remove getrandom::register_custom_getrandom for wasm-deterministic
Jiloc Jul 4, 2025
9f9d721
Merge branch 'chore/stacks-common-optional-requirements' into chore/c…
Jiloc Jul 4, 2025
5405302
remove unused rand-chacha
Jiloc Jul 7, 2025
492b0e0
proxy stacks-common wasm features in clarity
Jiloc Jul 7, 2025
c007bc6
update Cargo.lock
Jiloc Jul 7, 2025
0f9fecb
add git hack check workflow
Jiloc Jul 7, 2025
018885a
Merge branch 'develop' into chore/clarity-vm-feature-gate
Jiloc Jul 7, 2025
9703978
Merge branch 'chore/clarity-vm-feature-gate' into feature/cargo-hack-…
Jiloc Jul 7, 2025
96f77c8
remove stacks-signer/monitoring_prom from features
Jiloc Jul 7, 2025
66cf8ba
remove summary job. pin taiki-e/install-action
Jiloc Jul 8, 2025
85c72ce
split cache between wasm-deterministic and wasm-web
Jiloc Jul 8, 2025
6b35872
fix cargo check features=testing for stacks-node
Jiloc Jul 8, 2025
0c956e2
Merge branch 'develop' into feature/cargo-hack-check-ci
Jiloc Jul 8, 2025
fd13754
Update .github/workflows/cargo-hack-check.yml
Jiloc Jul 8, 2025
2ebf15e
remove http-parser feature
Jiloc Jul 9, 2025
5783141
Merge branch 'develop' into chore/stacks-common-optional-requirements
Jiloc Jul 9, 2025
13aa4b5
Merge branch 'chore/stacks-common-optional-requirements' into chore/c…
Jiloc Jul 9, 2025
0f4dbe5
Merge branch 'chore/clarity-vm-feature-gate' into feature/cargo-hack-…
Jiloc Jul 9, 2025
190d4e9
Merge branch 'feature/cargo-hack-check-ci' of github.com:Jiloc/stacks…
Jiloc Jul 9, 2025
d54bc3d
add persist-credentials: false to checkouts
Jiloc Jul 9, 2025
06b120b
add toolchain name to cache
Jiloc Jul 9, 2025
372d08c
remove now redundant cargo checks
Jiloc Jul 9, 2025
908b21c
remove unused default features
Jiloc Jul 9, 2025
1029432
Merge branch 'chore/stacks-common-optional-requirements' into chore/c…
Jiloc Jul 9, 2025
7dba0eb
remove unused slog import
Jiloc Jul 9, 2025
9770d5a
Merge branch 'chore/clarity-vm-feature-gate' into feature/cargo-hack-…
Jiloc Jul 9, 2025
5694877
update cargo.lock
Jiloc Jul 9, 2025
4a70884
Merge branch 'chore/stacks-common-optional-requirements' into chore/c…
Jiloc Jul 9, 2025
66d9077
disable unused defaul-features for clarity
Jiloc Jul 9, 2025
37c823f
Merge branch 'chore/clarity-vm-feature-gate' into feature/cargo-hack-…
Jiloc Jul 9, 2025
4fdd73e
split linux and windows jobs
Jiloc Jul 10, 2025
06b010a
remove clippy::assertions_on_constants
Jiloc Jul 10, 2025
dc7be7b
Merge branch 'develop' into chore/stacks-common-optional-requirements
Jiloc Jul 11, 2025
016ace1
Merge branch 'chore/stacks-common-optional-requirements' into chore/c…
Jiloc Jul 11, 2025
44fcfb6
Merge branch 'chore/clarity-vm-feature-gate' into feature/cargo-hack-…
Jiloc Jul 11, 2025
e982df6
Revert "split linux and windows jobs"
Jiloc Jul 11, 2025
1e8c83c
install targets with the target param
Jiloc Jul 11, 2025
75c4155
Merge branch 'develop' into feature/cargo-hack-check-ci
Jiloc Jul 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions .github/workflows/cargo-hack-check.yml
Original file line number Diff line number Diff line change
@@ -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 \
-p stacks-common \
--each-feature \
--no-dev-deps \
--exclude-features=default,rusqlite,testing,wasm-deterministic \
--features=wasm-web

- name: "Clarity & Stacks-Common WASM Deterministic"
command: |
cargo hack check \
-p clarity \
-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 }}
31 changes: 26 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -145,26 +145,47 @@ jobs:
- check-release
uses: ./.github/workflows/stacks-core-tests.yml

## Checks to run on built binaries
## 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

## Cargo check for Linux/Windows/Wasm32 targets with all features
##
## 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
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
##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: Core build tests
name: Constants Check

# Only run when:
# - PRs are (re)opened against develop branch
# Validates that the constants dumped by stacks-inspect match expected values
on:
workflow_call:

jobs:
check-consts:
name: Check the constants from stacks-inspect
Expand All @@ -26,27 +25,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: |
Expand Down
29 changes: 18 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,29 @@ members = [

# Dependencies we want to keep the same between workspace members
[workspace.dependencies]
ed25519-dalek = { version = "2.1.1", features = ["serde", "rand_core"] }
ed25519-dalek = { version = "2.1.1", default-features = false }
hashbrown = { version = "0.15.2", features = ["serde"] }
lazy_static = "1.4.0"
rand_core = "0.6.4"
rand = "0.8"
rand_chacha = "0.3.1"
tikv-jemallocator = "0.5.4"
serde = "1"
serde_derive = "1"
serde_json = { version = "1.0", features = ["arbitrary_precision", "unbounded_depth"] }
slog = { version = "2.5.2", features = [ "max_level_trace" ] }
rusqlite = { version = "0.31.0", features = ["blob", "serde_json", "i128_blob", "bundled", "trace"] }
tikv-jemallocator = "0.5.4"
thiserror = "1.0.65"
toml = "0.5.6"

# Use a bit more than default optimization for
# dev builds to speed up test execution
# dev builds to speed up test execution
[profile.dev]
opt-level = 1

# Use release-level optimization for dependencies
# This slows down "first" builds on development environments,
# but won't impact subsequent builds.
# but won't impact subsequent builds.
[profile.dev.package."*"]
opt-level = 3

Expand Down
Loading
Loading