Skip to content

Commit 9e965de

Browse files
authored
CI: hack check (#125)
1 parent abe9bd3 commit 9e965de

File tree

6 files changed

+43
-6
lines changed

6 files changed

+43
-6
lines changed

.github/workflows/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,26 @@ jobs:
4747
- name: Run clippy
4848
run: make clippy
4949

50+
check_features:
51+
name: Check Features
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
- uses: actions/cache@v4
56+
with:
57+
path: |
58+
~/.cargo/registry
59+
~/.cargo/git
60+
key: cargo-hack-${{ hashFiles('**/Cargo.lock') }}
61+
restore-keys: |
62+
cargo-hack-
63+
- uses: dtolnay/rust-toolchain@stable
64+
- uses: taiki-e/install-action@v2
65+
with:
66+
tool: cargo-hack
67+
- name: Check all feature combinations
68+
run: make check-features
69+
5070
cargo_build_test:
5171
name: Cargo Build and Test
5272
runs-on: ubuntu-latest

Makefile

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
NIGHTLY_TOOLCHAIN := nightly-2024-11-22
22
SOLANA_VERSION := 2.2.0
33

4-
.PHONY: audit build-test-programs prepublish publish format format-check clippy test nightly-version solana-version
4+
.PHONY: audit build-test-programs prepublish publish format format-check \
5+
clippy test check-features all-checks nightly-version solana-version
56

67
# Print the nightly toolchain version for CI
78
nightly-version:
@@ -38,6 +39,7 @@ prepublish:
3839
@$(MAKE) build-test-programs
3940
@$(MAKE) format-check
4041
@$(MAKE) clippy
42+
@$(MAKE) check-features
4143
@$(MAKE) test
4244

4345
# Publish crates in order
@@ -76,6 +78,19 @@ format-check:
7678
clippy:
7779
@cargo +$(NIGHTLY_TOOLCHAIN) clippy --all --all-features --all-targets -- -D warnings
7880

81+
# Check all feature combinations with cargo-hack
82+
check-features:
83+
@cargo hack check --feature-powerset --no-dev-deps
84+
7985
# Run tests
8086
test:
81-
@cargo test --all-features
87+
@cargo test --all-features
88+
89+
# Run all checks in sequence
90+
all-checks:
91+
@echo "Running all checks..."
92+
@$(MAKE) format-check
93+
@$(MAKE) clippy
94+
@$(MAKE) check-features
95+
@$(MAKE) test
96+
@echo "All checks passed!"

harness/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ fuzz-fd = [
2323
"dep:mollusk-svm-fuzz-fixture-firedancer",
2424
"dep:mollusk-svm-fuzz-fs",
2525
]
26-
serde = ["dep:serde"]
26+
serde = [
27+
"dep:serde",
28+
"mollusk-svm-result/serde",
29+
]
2730

2831
[dependencies]
2932
agave-feature-set = { workspace = true }

result/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ solana-rent = { workspace = true }
2121
[features]
2222
default = []
2323
fuzz = ["dep:mollusk-svm-fuzz-fixture"]
24-
serde = ["dep:serde"]
24+
serde = ["dep:serde", "solana-pubkey/serde"]

result/src/fuzz.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use crate::types::{InstructionResult, ProgramResult};
44

5-
#[cfg(feature = "fuzz")]
65
impl From<&InstructionResult> for mollusk_svm_fuzz_fixture::effects::Effects {
76
fn from(input: &InstructionResult) -> Self {
87
let compute_units_consumed = input.compute_units_consumed;
@@ -27,7 +26,6 @@ impl From<&InstructionResult> for mollusk_svm_fuzz_fixture::effects::Effects {
2726
}
2827
}
2928

30-
#[cfg(feature = "fuzz")]
3129
impl From<&mollusk_svm_fuzz_fixture::effects::Effects> for InstructionResult {
3230
fn from(input: &mollusk_svm_fuzz_fixture::effects::Effects) -> Self {
3331
use solana_instruction::error::InstructionError;

result/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
pub mod check;
3232
pub mod compare;
3333
pub mod config;
34+
#[cfg(feature = "fuzz")]
3435
pub mod fuzz;
3536
pub mod types;
3637

0 commit comments

Comments
 (0)