Skip to content

Commit

Permalink
solana: Add build, test, and lint targets to top-level dir
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
johnsaigle committed May 9, 2024
1 parent 55dce5f commit 2974b80
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ build-evm-prod: clean-evm
gen-evm-bindings: build-evm-prod
cd sdk && npm ci && cd evm && npm run generate

.PHONY: build-solana
build-solana:
cd solana; BPF_OUT_DIR="$(pwd)/target/deploy" cargo build-sbf

.PHONY: build-anchor
build-anchor:
cd solana; make _anchor-build

#######################
## TESTS

Expand All @@ -30,11 +38,32 @@ check-format:
fix-format:
cd evm && forge fmt

.PHONY: test
.PHONY: test-evm
test-evm:
cd evm && forge test -vvv


# Verify that the contracts do not include PUSH0 opcodes
test-push0:
cd evm && forge build --extra-output evm.bytecode.opcodes
@if grep -qr --include \*.json PUSH0 ./evm/out; then echo "Contract uses PUSH0 instruction" 1>&2; exit 1; else echo "PUSH0 Verification Succeeded"; fi

.PHONY: test-solana-unit
test-solana-unit:
cd solana; cargo build-sbf --features "mainnet"
cd solana; cargo test-sbf --features "mainnet"
cd solana; cargo test

.PHONY: test-anchor
test-anchor:
cd solana; make anchor-test

.PHONY: test-solana
test-solana: build-solana test-solana-unit build-anchor test-anchor


.PHONY: lint
lint-solana:
cargo fmt --check --all --manifest-path solana/Cargo.toml
cargo check --workspace --tests --manifest-path solana/Cargo.toml
cargo clippy --workspace --tests --manifest-path solana/Cargo.toml

0 comments on commit 2974b80

Please sign in to comment.