Skip to content

Commit

Permalink
CI: features cleanup
Browse files Browse the repository at this point in the history
- Move commands to justfile
- Use matrix: run without `--tests` or with
- Only check pairs of features. This tests that each feature works with
  each other feature. This should cover most problems while hopefully
  keeping runtime reasable.
- Fix sqlite-unbundled feature in nix-shell.
  • Loading branch information
sveitser committed Mar 7, 2025
1 parent 7608376 commit 7f719bb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 14 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/cargo-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,33 @@ concurrency:
jobs:
cargo-features:
runs-on: ubuntu-latest
strategy:
matrix:
command:
- just check-features-ci
- just check-features-ci --tests
steps:
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@just

- name: Checkout Repository
uses: actions/checkout@v4

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
tool-cache: false
dotnet: false
haskell: false
large-packages: false
docker-images: false
swap-storage: false

# Note: this job doesn't use a cache on purpose because it mostly compiles
# the crates in this repo over and over again with different feature
# combinations. Adding caching would not speed it up much and further
# contribute to our cache usage.

# Includes checks for `--no-default-features` and `--all-features` as well
# as each individual feature enabled.
- name: Check compilation for feature combinations
run: |
cargo hack check --feature-powerset --exclude hotshot --exclude hotshot-builder-api --exclude hotshot-task-impls --exclude hotshot-macros --exclude hotshot-events-service --exclude hotshot-utils --exclude hotshot-orchestrator --exclude hotshot-query-service --exclude hotshot-stake-table --exclude hotshot-state-prover --exclude hotshot-task --exclude hotshot-testing --exclude hotshot-types --exclude hotshot-libp2p-networking --exclude hotshot-contract-adapter --exclude hotshot-example-types --exclude vid
- name: Check compilation for feature combinations (--tests)
# combinations. The target directory gets really large. Adding caching
# would not speed it up much and further contribute to our cache usage.
- name: Check compilation feature combinations
run: |
cargo hack check --feature-powerset --tests --exclude hotshot --exclude hotshot-builder-api --exclude hotshot-task-impls --exclude hotshot-macros --exclude hotshot-events-service --exclude hotshot-utils --exclude hotshot-orchestrator --exclude hotshot-query-service --exclude hotshot-stake-table --exclude hotshot-state-prover --exclude hotshot-task --exclude hotshot-testing --exclude hotshot-types --exclude hotshot-libp2p-networking --exclude hotshot-contract-adapter --exclude hotshot-example-types --exclude vid
${{ maxtrix.command }}
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@
# Add rust binaries to PATH for native demo
export PATH="$PWD/$CARGO_TARGET_DIR/debug:$PATH"
# Needed to compile with the sqlite-unbundled feature
export LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";
'' + self.checks.${system}.pre-commit-check.shellHook;
RUST_SRC_PATH = "${stableToolchain}/lib/rustlib/src/rust/library";
FOUNDRY_SOLC = "${solc}/bin/solc";
Expand Down
25 changes: 25 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,31 @@ clippy:
check-features *args:
cargo hack check --each-feature {{args}}

check-features-ci *args:
# check each pair of features plus `default` and `--no-default-features`
cargo hack check --feature-powerset \
--depth 2 \
--exclude contract-bindings-alloy \
--exclude contract-bindings-ethers \
--exclude hotshot \
--exclude hotshot-builder-api \
--exclude hotshot-contract-adapter \
--exclude hotshot-events-service \
--exclude hotshot-example-types \
--exclude hotshot-libp2p-networking \
--exclude hotshot-macros \
--exclude hotshot-orchestrator \
--exclude hotshot-query-service \
--exclude hotshot-stake-table \
--exclude hotshot-state-prover \
--exclude hotshot-task \
--exclude hotshot-task-impls \
--exclude hotshot-testing \
--exclude hotshot-types \
--exclude hotshot-utils \
--exclude vid \
{{args}}

# Helpful shortcuts for local development
dev-orchestrator:
target/release/orchestrator -p 8080 -n 1
Expand Down

0 comments on commit 7f719bb

Please sign in to comment.