Skip to content

Commit f41e2b5

Browse files
johnsaiglenvsriram
authored andcommitted
solana: Add build, test, and lint targets to top-level dir
Adds Makefile targets for common Solana tasks in the top-level directory. This allows the test and build pipeline to be run from the main directory for both the EVM and Solana implementations. This also helps to capture the Solana commands that are configured in the .github/workflows/solana.yml file. In case this codebase is merged or adapted into the Wormhole monorepo, the GitHub workflow may be removed for modified. Therefore it is beneficial to track the expected test configurations here.
1 parent cc3565c commit f41e2b5

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

Makefile

+30-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ build-evm-prod: clean-evm
1919
gen-evm-bindings: build-evm-prod
2020
npm ci && cd evm/ts && npm run generate
2121

22+
.PHONY: build-solana
23+
build-solana:
24+
cd solana; BPF_OUT_DIR="$(pwd)/target/deploy" cargo build-sbf
25+
26+
.PHONY: build-anchor
27+
build-anchor:
28+
cd solana; make _anchor-build
29+
2230
#######################
2331
## TESTS
2432

@@ -30,11 +38,32 @@ check-format:
3038
fix-format:
3139
cd evm && forge fmt
3240

33-
.PHONY: test
41+
.PHONY: test-evm
3442
test-evm:
3543
cd evm && forge test -vvv
3644

45+
3746
# Verify that the contracts do not include PUSH0 opcodes
3847
test-push0:
3948
cd evm && forge build --extra-output evm.bytecode.opcodes
4049
@if grep -qr --include \*.json PUSH0 ./evm/out; then echo "Contract uses PUSH0 instruction" 1>&2; exit 1; else echo "PUSH0 Verification Succeeded"; fi
50+
51+
.PHONY: test-solana-unit
52+
test-solana-unit:
53+
cd solana; cargo build-sbf --features "mainnet"
54+
cd solana; cargo test-sbf --features "mainnet"
55+
cd solana; cargo test
56+
57+
.PHONY: test-anchor
58+
test-anchor:
59+
cd solana; make anchor-test
60+
61+
.PHONY: test-solana
62+
test-solana: build-solana test-solana-unit build-anchor test-anchor
63+
64+
65+
.PHONY: lint
66+
lint-solana:
67+
cargo fmt --check --all --manifest-path solana/Cargo.toml
68+
cargo check --workspace --tests --manifest-path solana/Cargo.toml
69+
cargo clippy --workspace --tests --manifest-path solana/Cargo.toml

0 commit comments

Comments
 (0)