This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Check all crates #12709
Merged
Merged
Check all crates #12709
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fe64411
check all crates individually
joao-paulo-parity 5b99f73
adapt to lack of multiple macos runners
joao-paulo-parity c2096d4
fix cancel-pipeline-cargo-check-each-crate-macos
joao-paulo-parity 17e932a
fix cargo-check-each-crate-macos again
joao-paulo-parity bc535e4
time command execution
joao-paulo-parity 9f6a564
fix YAML anchors
joao-paulo-parity d94857d
Merge branch 'master' into check-all
joao-paulo-parity 53f28d5
add explanation for rounding division
joao-paulo-parity 066103e
ensure the minimum of one crate per group
joao-paulo-parity 3452d16
collect artifacts for pipeline stopper
joao-paulo-parity 05c667f
Merge branch 'master' into check-all
joao-paulo-parity 56d2948
revert hardcoded crates_per_group
joao-paulo-parity 478c87a
re-add crates_per_group=1
joao-paulo-parity File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 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,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
## A script that checks each workspace crate individually. | ||
## It's relevant to check workspace crates individually because otherwise their compilation problems | ||
## due to feature misconfigurations won't be caught, as exemplified by | ||
## https://github.com/paritytech/substrate/issues/12705 | ||
|
||
set -Eeu -o pipefail | ||
shopt -s inherit_errexit | ||
|
||
set -x | ||
|
||
target_group="$1" | ||
groups_total="$2" | ||
|
||
readarray -t workspace_crates < <(\ | ||
cargo tree --workspace --depth 0 | \ | ||
awk '{ if (length($1) == 0 || substr($1, 1, 1) == "[") { skip } else { print $1 } }' | ||
) | ||
|
||
crates_total=${#workspace_crates[*]} | ||
|
||
# We add `crates_total % groups_total > 0` (which evaluates to 1 in case there's a remainder for | ||
# `crates_total % groups_total`) to round UP `crates_total / groups_total` 's potentially-fractional | ||
# result to the nearest integer. Doing that ensures that we'll not miss any crate in case | ||
# `crates_total / groups_total` would normally result in a fractional number, since in those cases | ||
# Bash would round DOWN the result to the nearest integer. For example, if `crates_total = 5` and | ||
# `groups_total = 2`, then `crates_total / groups_total` would round down to 2; since the loop below | ||
# would then step by 2, we'd miss the 5th crate. | ||
crates_per_group=$(( (crates_total / groups_total) + (crates_total % groups_total > 0) )) | ||
|
||
group=1 | ||
for ((i=0; i < crates_total; i += crates_per_group)); do | ||
if [ $group -eq "$target_group" ]; then | ||
for crate in "${workspace_crates[@]:$i:$crates_per_group}"; do | ||
cargo check --locked --release -p "$crate" | ||
done | ||
break | ||
fi | ||
group=$(( group + 1 )) | ||
done |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the
> 0
doing here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a comment in 53f28d5