Skip to content

Commit

Permalink
ci(graph): reserve stdout for parsable output
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Aug 8, 2023
1 parent 7e42398 commit 6b063a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions scripts/check-dependency-cycles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
# Errors if number of cycle edges detected is too great
set -ueo pipefail

MAX_EDGES=$1
MAX_EDGES=${1-0}

# one of these lines is "Cycles detected"
LINE_COUNT=$(scripts/graph.sh |wc -l)

CYCLIC_EDGE_COUNT=$((LINE_COUNT - 1))
CYCLIC_EDGE_COUNT=$(scripts/graph.sh | wc -l)

echo CYCLIC_EDGE_COUNT $CYCLIC_EDGE_COUNT

Expand Down
4 changes: 2 additions & 2 deletions scripts/graph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ dot -Tpng <packages-graph.dot >"$DIR"/../packages-graph.png
dot -Tsvg <packages-graph.dot >"$DIR"/../packages-graph.svg

if acyclic packages-graph.dot | dot -Tcanon >packages-graph-sans-cycles.dot; then
echo "No cycles in 'dependencies' of packages."
echo 1>&2 "No cycles in 'dependencies' of packages."
else
echo "Cycles detected. These lines appear only in the original graph and not the acyclic variant:"
echo 1>&2 "Cycles detected. Output lines appear only in the original graph and not the acyclic variant:"
comm -23 <(sort packages-graph.dot) <(sort packages-graph-sans-cycles.dot)
fi

0 comments on commit 6b063a8

Please sign in to comment.