.PHONY: setup clean fmt-check fmt clippy clippy-release check check-release check-wasm build build-release test test-release integration check-integration harness harness-down docker-rustsdk-build docker-rustsdk-run docker-test fetch-openapi-specs generate-clients ci doc help
OPENAPI_GENERATOR_VERSION := v6.6.0
OPENAPI_IMAGE := openapitools/openapi-generator-cli:$(OPENAPI_GENERATOR_VERSION)
setup:
rustup component add rustfmt clippy
rustup target install wasm32-unknown-unknown
cargo fetch
lefthook install
clean:
cargo clean
fmt-check:
cargo fmt --all -- --check
fmt:
cargo fmt --all
clippy:
cargo clippy --workspace --all-targets -- -D warnings
clippy-release:
cargo clippy --release --workspace --all-targets -- -D warnings
check:
cargo check --workspace
check-release:
cargo check --release --workspace
check-wasm:
cargo check --target wasm32-unknown-unknown
build:
cargo build --workspace
build-release:
cargo build --release --workspace
test:
cargo test --workspace --lib --examples --tests
test-release:
cargo test --release --workspace --lib --examples --tests
integration:
cargo test --test features_runner --
check-integration:
cargo test --test features_runner --no-run
harness:
./test-harness.sh up
harness-down:
./test-harness.sh down
docker-rustsdk-build:
docker build -t rust-sdk-testing .
docker-rustsdk-run:
docker ps -a
docker run -it --network host rust-sdk-testing:latest
docker-test: harness docker-rustsdk-build docker-rustsdk-run
fetch-openapi-specs:
curl -fsSL -o openapi/specs/algod.oas3.json \
https://raw.githubusercontent.com/algorand/go-algorand/master/daemon/algod/api/algod.oas3.yml
curl -fsSL -o openapi/specs/indexer.oas3.json \
https://raw.githubusercontent.com/algorand/indexer/main/api/indexer.oas3.yml
generate-clients:
python3 openapi/preprocess.py
docker run --rm -v "$(CURDIR)":/local $(OPENAPI_IMAGE) generate \
-c /local/openapi/config-algod.yaml --skip-validate-spec \
-t /local/openapi/templates \
-i /local/openapi/generated/_specs/algod.oas3.json -o /local/openapi/generated/algod
docker run --rm -v "$(CURDIR)":/local $(OPENAPI_IMAGE) generate \
-c /local/openapi/config-indexer.yaml --skip-validate-spec \
-t /local/openapi/templates \
-i /local/openapi/generated/_specs/indexer.oas3.json -o /local/openapi/generated/indexer
@echo 'Formatting generated output so the diff reflects only semantic drift...'
find openapi/generated/algod openapi/generated/indexer -name '*.rs' \
| xargs rustfmt --edition 2024
@echo 'Regenerated into openapi/generated/. Models relocate to algonaut_model,'
@echo 'apis stay in the client crate (ADR relocate-generated-models). Review drift:'
@echo ' git diff --no-index openapi/generated/algod/src/models algonaut_model/src/algod'
@echo ' git diff --no-index openapi/generated/algod/src/apis algonaut_algod/src/apis'
@echo ' git diff --no-index openapi/generated/indexer/src/models algonaut_model/src/indexer'
@echo ' git diff --no-index openapi/generated/indexer/src/apis algonaut_indexer/src/apis'
ci: fmt-check clippy test check-integration build
doc:
cargo doc --no-deps --open
help:
@echo ''
@echo 'Usage:'
@echo ' make [target]'
@echo ''
@echo 'Targets:'
@awk '/^[a-zA-Z\-\_0-9]+:/ { \
helpMessage = match(lastLine, /^# (.*)/); \
if (helpMessage) { \
helpCommand = substr($$1, 0, index($$1, ":")); \
helpMessage = substr(lastLine, RSTART + 2, RLENGTH); \
printf "\033[36m%-30s\033[0m %s\n", helpCommand,helpMessage; \
} \
} \
{ lastLine = $$0 }' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help