Skip to content

Commit 49e66de

Browse files
misc: add makefile (#1071)
* chore: add makefile * nit: types + use make check-features * nit * imp: add install-tools
1 parent e78c372 commit 49e66de

File tree

5 files changed

+47
-7
lines changed

5 files changed

+47
-7
lines changed

.github/workflows/no-std.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
override: true
4040
- run: |
4141
cd ci/no-std-check
42-
make check-panic-conflict
42+
make check-no-std
4343
4444
check-substrate:
4545
name: Check no_std substrate support

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Cache cargo dependencies
3333
uses: Swatinem/rust-cache@v2
3434
- name: Publish crates (dry run)
35-
run: cargo release --workspace --no-push --no-tag --no-publish --exclude ibc-derive
35+
run: make check-release
3636
env:
3737
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
3838

@@ -48,7 +48,7 @@ jobs:
4848
- name: Cache cargo dependencies
4949
uses: Swatinem/rust-cache@v2
5050
- name: Publish crates
51-
run: yes | cargo release --workspace --no-push --no-tag --exclude ibc-derive --allow-branch HEAD --execute
51+
run: yes | make release
5252
env:
5353
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
5454

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
uses: taiki-e/install-action@cargo-hack
6262
- uses: Swatinem/rust-cache@v2
6363
- name: Run cargo hack
64-
run: cargo hack check --workspace --feature-powerset --exclude-features default
64+
run: make check-features
6565

6666
nightly_fmt:
6767
runs-on: ubuntu-latest

ci/no-std-check/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ NIGHTLY_VERSION=nightly
22

33
.DEFAULT_GOAL := help
44

5-
.PHONY: all setup build-substrate check-panic-conflict check-cargo-build-std check-wasm check-substrate help
5+
.PHONY: all setup build-substrate check-no-std check-cargo-build-std check-wasm check-substrate help
66

77
all: ## Run the setup and all checks
88
$(MAKE) build-substrate
9-
$(MAKE) check-panic-conflict
9+
$(MAKE) check-no-std
1010
$(MAKE) check-cargo-build-std
1111
$(MAKE) check-wasm
1212
$(MAKE) check-substrate
@@ -21,7 +21,7 @@ build-substrate: ## Build with Substrate support
2121
--no-default-features \
2222
--features use-substrate,substrate-std
2323

24-
check-panic-conflict: ## Check for `no_std` compliance by installing a panic handler, and any other crate importing `std` will cause a conflict. Runs on default target.
24+
check-no-std: ## Check for `no_std` compliance by installing a panic handler, and any other crate importing `std` will cause a conflict. Runs on default target.
2525
cargo build \
2626
--no-default-features \
2727
--features panic-handler

makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.PHONY: help
2+
3+
help: ## Display help message.
4+
@echo "Usage: make <target>"
5+
@awk 'BEGIN {FS = ":.*?## "}/^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
6+
7+
install-tools: ## Install development tools including nightly rustfmt, cargo-hack and cargo-release.
8+
rustup component add rustfmt --toolchain nightly
9+
cargo install cargo-hack
10+
cargo install cargo-release
11+
12+
lint: ## Lint the code using rustfmt, clippy and whitespace lints.
13+
cargo +nightly fmt --all --check
14+
cargo clippy --all-targets --all-features
15+
cargo clippy --all-targets --no-default-features
16+
bash ./ci/code-quality/whitespace-lints.sh
17+
18+
check-features: ## Check that project compiles with all combinations of features.
19+
cargo hack check --workspace --feature-powerset --exclude-features default
20+
21+
check-docs: ## Build documentation with all features and without default features.
22+
cargo doc --all --all-features --release
23+
cargo doc --all --no-default-features --release
24+
25+
check-no-std: ## Check that libraries compile with `no_std` feature.
26+
$(MAKE) -C ./ci/no-std-check $@
27+
28+
check-cw: ## Check that the CosmWasm smart contract compiles.
29+
cd ./ci/cw-check \
30+
&& cargo build --target wasm32-unknown-unknown --no-default-features --release
31+
32+
test: ## Run tests with all features and without default features.
33+
cargo test --all-targets --all-features
34+
cargo test --all-targets --no-default-features
35+
36+
check-release: ## Check that the release build compiles.
37+
cargo release --workspace --no-push --no-tag --no-publish --exclude ibc-derive
38+
39+
release: ## Perform an actual release and publishes to crates.io.
40+
cargo release --workspace --no-push --no-tag --exclude ibc-derive --allow-branch HEAD --execute

0 commit comments

Comments
 (0)