Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Revert "Sort crates before splitting them into groups (+ some improve…
Browse files Browse the repository at this point in the history
…ments) (#12755)"

This reverts commit fde8391.
  • Loading branch information
rcny committed Nov 25, 2022
1 parent fde8391 commit 7261d77
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions scripts/ci/gitlab/check-each-crate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,17 @@
set -Eeu -o pipefail
shopt -s inherit_errexit

set -vx
set -x

target_group="$1"
groups_total="$2"

readarray -t workspace_crates < <(\
cargo tree --workspace --depth 0 --prefix none |
awk '{ if (length($1) == 0 || substr($1, 1, 1) == "[") { skip } else { print $1 } }' |
sort |
uniq
cargo tree --workspace --depth 0 | \
awk '{ if (length($1) == 0 || substr($1, 1, 1) == "[") { skip } else { print $1 } }'
)

crates_total=${#workspace_crates[*]}
if [ "$crates_total" -lt 1 ]; then
>&2 echo "No crates detected for $PWD"
exit 1
fi

if [ "$crates_total" -lt "$groups_total" ]; then
# `crates_total / groups_total` would result in 0, so round it up to 1
Expand All @@ -43,9 +37,7 @@ fi
group=1
for ((i=0; i < crates_total; i += crates_per_group)); do
if [ $group -eq "$target_group" ]; then
crates_in_group=("${workspace_crates[@]:$i:$crates_per_group}")
echo "crates in the group: ${crates_in_group[*]}" >/dev/null # >/dev/null due to "set -x"
for crate in "${crates_in_group[@]}"; do
for crate in "${workspace_crates[@]:$i:$crates_per_group}"; do
cargo check --locked --release -p "$crate"
done
break
Expand Down

0 comments on commit 7261d77

Please sign in to comment.