solana: Add fmt, check, clippy, and test targets to Makefile

Add fmt, check, and clippy targets to the Makefile so that people don't
have to remember the exact set of parameters needed.  Also fix the test
target since we no longer run the tests through docker.
This commit is contained in:
Chirantan Ekbote 2022-09-09 15:46:10 +09:00 committed by Chirantan Ekbote
parent 9d7e56bbfc
commit d5b7bee86e
2 changed files with 19 additions and 5 deletions

View File

@ -18,7 +18,7 @@ FROM solana AS builder
RUN mkdir -p /opt/solana/deps
ENV EMITTER_ADDRESS="11111111111111111111111111111115"
ARG EMITTER_ADDRESS="11111111111111111111111111111115"
ARG BRIDGE_ADDRESS
RUN [ -n "${BRIDGE_ADDRESS}" ]

View File

@ -24,7 +24,7 @@ nft_bridge_AUTHORITY_devnet=6sbzC1eH4FTujJXWj51eQe25cYvr4xfXbJ1vAj7j2k5J
SOURCE_FILES=$(shell find . -name "*.rs" -or -name "*.lock" -or -name "*.toml" | grep -v "target") Dockerfile
.PHONY: clean all help artifacts deploy/bridge deploy/token_bridge deploy/nft_bridge .FORCE
.PHONY: clean all help artifacts deploy/bridge deploy/token_bridge deploy/nft_bridge .FORCE fmt check clippy test
-include ../Makefile.help
@ -77,9 +77,23 @@ wasm: $(SOURCE_FILES)
DOCKER_BUILDKIT=1 docker build -f Dockerfile.wasm -o type=local,dest=$@ .
cp -r $@/* ..
test:
@echo "Running integration tests"
DOCKER_BUILDKIT=1 docker build -f Dockerfile --target ci_tests --build-arg BRIDGE_ADDRESS=${bridge_ADDRESS_devnet} .
fmt: $(SOURCE_FILES)
cargo fmt --check --all --manifest-path Cargo.toml
check: $(SOURCE_FILES)
cargo check --workspace --tests --manifest-path Cargo.toml \
--features "nft-bridge/instructions token-bridge/instructions wormhole-bridge-solana/instructions"
clippy: $(SOURCE_FILES)
cargo clippy --workspace --tests --manifest-path Cargo.toml \
--features "nft-bridge/instructions token-bridge/instructions wormhole-bridge-solana/instructions"
test: $(SOURCE_FILES)
DOCKER_BUILDKIT=1 docker build -f Dockerfile --build-arg BRIDGE_ADDRESS=${bridge_ADDRESS_devnet} \
--build-arg EMITTER_ADDRESS=CiByUvEcx7w2HA4VHcPCBUAFQ73Won9kB36zW9VjirSr -o target/deploy .
BPF_OUT_DIR=$(realpath $(dir $(firstword $(MAKEFILE_LIST))))/target/deploy \
cargo test --workspace \
--features "nft-bridge/instructions token-bridge/instructions wormhole-bridge-solana/instructions"
clean:
rm -rf artifacts-mainnet artifacts-testnet artifacts-devnet *-buffer-*.txt