-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WEB3-113: chore: CI coverage of examples (#229)
Inspired by #227 this PR runs `cargo fmt` `cargo sort` `cargo clippy` `cargo test` and `forge tests` for all examples in the CI. It uses a bash script to find all examples under the `example` folder instead of manually listing them. It also addresses all the found linter warnings. closes WEB3-109 closes Web3-110
- Loading branch information
Showing
16 changed files
with
75 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
fmt_sort(){ | ||
while read path; do | ||
printf "Project: %s\n" "$path" | ||
cargo fmt --all --check --manifest-path "$path" | ||
(cd "${path%/*}"; cargo sort --workspace --check) | ||
done | ||
} | ||
|
||
grep -rl --include "Cargo.toml" '\[workspace\]' | sort -u | fmt_sort |
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,11 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
clippy(){ | ||
while read path; do | ||
printf "Project: %s\n" "$path" | ||
cargo clippy --workspace --all-targets --all-features --manifest-path "$path" | ||
done | ||
} | ||
|
||
grep -rl --include "Cargo.toml" '\[workspace\]' | sort -u | clippy |
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,12 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
build_test(){ | ||
while read path; do | ||
printf "Project: %s\n" "$path" | ||
cargo build --workspace --all-features --manifest-path "$path" | ||
cargo test --workspace --all-features --manifest-path "$path" | ||
done | ||
} | ||
|
||
find . -maxdepth 2 -mindepth 2 -name 'Cargo.toml' | sort -u | build_test |
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,11 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
fmt(){ | ||
while read path; do | ||
printf "Project: %s\n" "$path" | ||
(cd "${path%/*}"; forge fmt --check) | ||
done | ||
} | ||
|
||
find . -maxdepth 2 -mindepth 2 -name 'foundry.toml' | sort -u | fmt |
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,11 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
test(){ | ||
while read path; do | ||
printf "Project: %s\n" "$path" | ||
(cd "${path%/*}"; forge test -vvvv) | ||
done | ||
} | ||
|
||
find . -maxdepth 2 -mindepth 2 -name 'foundry.toml' | sort -u | test |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
[toolchain] | ||
channel = "1.79" | ||
channel = "stable" | ||
components = ["clippy", "rustfmt", "rust-src"] | ||
targets = [] | ||
profile = "minimal" | ||
profile = "minimal" |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[toolchain] | ||
channel = "stable" | ||
components = ["rustfmt", "rust-src"] | ||
components = ["clippy", "rustfmt", "rust-src"] | ||
profile = "minimal" |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "core" | ||
name = "token-stats-core" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "methods" | ||
name = "token-stats-methods" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[toolchain] | ||
channel = "stable" | ||
components = ["rustfmt", "rust-src"] | ||
profile = "minimal" | ||
components = ["clippy", "rustfmt", "rust-src"] | ||
profile = "minimal" |