-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tooling: swap out cargo-make for make (#359)
* swap out cargo-make for make * feat: add self documented Makefile targets * refactor: use single default profile for both local and CI tests * docs: make command fail if there are warnings * ci: split test and lint workflows * address review comments * ci: try defining lint and test as reusable jobs * ci: remove workflow dependency and run ci on merges on next and main * ci: make targets consistent with miden-base * docs: fixes to documentation * make: add fix target for makefile * ci: remove rust-toolchain from test and lint workflows * lint: fix clippy issues * make: reorder sections to be the same as miden base * make: restrict separators to 100 chars width * ci: remove rustup update on mkdocs job * make: add targets to build and install
- Loading branch information
Showing
16 changed files
with
245 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Lint | ||
on: | ||
push: | ||
branches: [main, next] | ||
pull_request: | ||
types: [opened, repoened, synchronize] | ||
|
||
jobs: | ||
clippy: | ||
name: Clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@main | ||
- name: Install Rust with clippy | ||
run: | | ||
rustup update --no-self-update nightly | ||
rustup +nightly component add clippy | ||
- name: make - clippy | ||
run: make clippy | ||
|
||
rustfmt: | ||
name: rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@main | ||
- name: Install Rust with rustfmt | ||
run: | | ||
rustup update --no-self-update nightly | ||
rustup +nightly component add rustfmt | ||
- name: make - format-check | ||
run: make format-check | ||
|
||
mkdocs: | ||
name: build mkdocs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@main | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.x | ||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | ||
- uses: actions/cache@v4 | ||
with: | ||
key: mkdocs-material-${{ env.cache_id }} | ||
path: .cache | ||
restore-keys: | | ||
mkdocs-material- | ||
- run: make doc-build | ||
|
||
rustdocs: | ||
name: build rust documentation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@main | ||
- name: Install Rust | ||
run: rustup update --no-self-update | ||
- name: make - doc | ||
run: make doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Test | ||
on: | ||
push: | ||
branches: [main, next] | ||
pull_request: | ||
types: [opened, repoened, synchronize] | ||
|
||
jobs: | ||
test: | ||
name: Test Rust ${{matrix.toolchain}} on ${{matrix.os}} | ||
runs-on: ${{matrix.os}}-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
toolchain: [stable, nightly] | ||
os: [ubuntu] | ||
steps: | ||
- uses: actions/checkout@main | ||
- name: Install Rust with ${{matrix.toolchain}} toolchain | ||
run: rustup update --no-self-update ${{ matrix.toolchain }} | ||
- uses: taiki-e/install-action@nextest | ||
- name: make - test | ||
run: make test | ||
|
||
integration_tests: | ||
name: integration_tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@main | ||
- name: Install Rust | ||
run: rustup update --no-self-update | ||
- uses: taiki-e/install-action@nextest | ||
- run: make clean-node | ||
- run: make node | ||
- run: make start-node > /dev/null & | ||
- run: make integration-test-full | ||
- name: Kill miden-node | ||
if: always() | ||
run: make kill-node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
.DEFAULT_GOAL := help | ||
|
||
.PHONY: help | ||
help: ## Show description of all commands | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
# --- Variables ----------------------------------------------------------------------------------- | ||
|
||
FEATURES_INTEGRATION_TESTING="integration" | ||
FEATURES_CLI="testing,concurrent" | ||
NODE_FEATURES_TESTING="testing" | ||
WARNINGS=RUSTDOCFLAGS="-D warnings" | ||
|
||
# --- Linting ------------------------------------------------------------------------------------- | ||
|
||
.PHONY: clippy | ||
clippy: ## Runs clippy on all targets with config | ||
cargo +nightly clippy --workspace --tests --all-targets --all-features -- -D clippy::all -D warnings | ||
|
||
.PHONY: fix | ||
fix: ## Runs Fix with configs | ||
cargo +nightly fix --allow-staged --allow-dirty --all-targets --all-features | ||
|
||
.PHONY: format | ||
format: ## Runs format using nightly toolchain | ||
cargo +nightly fmt --all | ||
|
||
.PHONY: format-check | ||
format-check: ## Runs format using nightly toolchain but only in check mode | ||
cargo +nightly fmt --all --check | ||
|
||
.PHONY: lint | ||
lint: format fix clippy ## Runs all linting tasks at once (clippy, fixing, formatting) | ||
|
||
# --- Documentation site -------------------------------------------------------------------------- | ||
|
||
.PHONY: doc-deps | ||
doc-deps: ## Install dependencies to build and serve documentation site | ||
pip3 install -r scripts/docs_requirements.txt | ||
|
||
.PHONY: doc-build | ||
doc-build: doc-deps ## Build documentation site | ||
mkdocs build | ||
|
||
.PHONY: doc-serve | ||
doc-serve: doc-deps ## Serve documentation site | ||
mkdocs serve | ||
|
||
# --- Rust documentation -------------------------------------------------------------------------- | ||
|
||
.PHONY: doc | ||
doc: ## Generates & checks rust documentation | ||
$(WARNINGS) cargo doc --all-features --keep-going --release | ||
|
||
# --- Testing ------------------------------------------------------------------------------------- | ||
|
||
.PHONY: test | ||
test: ## Run tests | ||
cargo nextest run --release --workspace | ||
|
||
# --- Integration testing ------------------------------------------------------------------------- | ||
|
||
.PHONY: integration-test | ||
integration-test: ## Run integration tests | ||
cargo nextest run --release --test=integration --features $(FEATURES_INTEGRATION_TESTING) | ||
|
||
.PHONY: integration-test-full | ||
integration-test-full: ## Run the integration test binary with ignored tests included | ||
cargo nextest run --release --test=integration --features $(FEATURES_INTEGRATION_TESTING) | ||
cargo nextest run --release --test=integration --features $(FEATURES_INTEGRATION_TESTING) --run-ignored ignored-only -- test_import_genesis_accounts_can_be_used_for_transactions | ||
|
||
.PHONY: kill-node | ||
kill-node: ## Kill node process | ||
pkill miden-node || echo 'process not running' | ||
|
||
.PHONY: clean-node | ||
clean-node: ## Clean node directory | ||
rm -rf miden-node | ||
|
||
.PHONY: node | ||
node: ## Setup node | ||
if [ -d miden-node ]; then cd miden-node ; else git clone https://github.com/0xPolygonMiden/miden-node.git && cd miden-node; fi | ||
cd miden-node && git checkout main && git pull origin main && cargo update | ||
cd miden-node && rm -rf miden-store.sqlite3* | ||
cd miden-node && cargo run --bin miden-node --features $(NODE_FEATURES_TESTING) -- make-genesis --inputs-path ../tests/config/genesis.toml --force | ||
|
||
.PHONY: start-node | ||
start-node: ## Run node | ||
cd miden-node && cargo run --bin miden-node --features $(NODE_FEATURES_TESTING) -- start --config ../tests/config/miden-node.toml node | ||
|
||
# --- Installing ---------------------------------------------------------------------------------- | ||
|
||
install: ## Installs the CLI binary using the current dir | ||
cargo install --features $(FEATURES_CLI) --path . | ||
|
||
# --- Building ------------------------------------------------------------------------------------ | ||
|
||
build: ## Builds the CLI binary and client library in release mode | ||
cargo build --release --features $(FEATURES_CLI) |
Oops, something went wrong.