Skip to content

Commit 9632de4

Browse files
committed
Add Periphery errors as Buildkite annotation
1 parent 7916cc4 commit 9632de4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.buildkite/commands/run-periphery.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ tar -xf build-products.tar
1212

1313
### Run the Tests
1414

15+
PERIPHERY_OUTPUT_FILE="periphery-errors.txt"
16+
1517
echo '+++ :periphery: Detecting unused code'
1618
set +e
1719
# This is the script in the root.
18-
./Scripts/Periphery/setup-and-run-periphery.sh --strict --quiet --skip-build --index-store-path 'DerivedData/Index.noindex/DataStore/'
20+
./Scripts/Periphery/setup-and-run-periphery.sh \
21+
--strict --quiet --skip-build --index-store-path 'DerivedData/Index.noindex/DataStore/' \
22+
--write-results "$PERIPHERY_OUTPUT_FILE"
1923
TESTS_EXIT_STATUS=$?
2024
set -e
2125

@@ -28,8 +32,11 @@ if [[ "$TESTS_EXIT_STATUS" -ne 0 ]]; then
2832
echo 'If you think there is a false positive violation, please check the known issues of Periphery at https://github.com/peripheryapp/periphery/issues.'
2933
echo 'If you think a violation is valid but it should be surpressed for any reason, please apply the `// periphery: ignore - {your-reason-here}` comment.'
3034
echo ''
35+
# Add the periphery errors as a Buildkite annotation
36+
echo "## Periphery found unused code\n\n\`\`\`\n$(cat "$PERIPHERY_OUTPUT_FILE")\n\`\`\`" | buildkite-agent annotate --context periphery --style error
3137
else
3238
echo '😊 No unused code found.'
39+
buildkite-agent annotate --context periphery --style success --append 'No unused code found by Periphery :tada:'
3340
fi
3441

3542
echo '--- 🚦 Report Exit code'

0 commit comments

Comments
 (0)