mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 02:02:43 +00:00
* backport of commitdc104898f7(#21853) * fix multiline * shellcheck, and success message for builds * add full path * cat the summary * fix and faster * fix if condition * base64 in a separate step * echo * check against empty string * add echo * only use matrix ids * only id * echo matrix * remove wrapping array * tojson * try echo again * use jq to get packages * don't quote * only run binary tests once * only run binary tests once * test what's wrong with the binary * separate file * use matrix file * failed test * update comment on success * correct variable name * bae64 fix * output to file * use multiline * fix * fix formatting * fix newline * fix whitespace * correct body, remove comma * small fixes * shellcheck * another shellcheck fix * fix deprecation checker * only run comments for prs * Update .github/workflows/test-go.yml Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com> * Update .github/workflows/test-go.yml Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com> * fixes --------- Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com> * backport of commit3b00dde1ba(#21936) * limit test comments * remove unecessary tee * fix go test condition * fix * fail test * remove ailways entirely * fix columns * make a bunch of tests fail * separate line * include Failures: * remove test fails * fix whitespace * backport of commit245430215c(#21973) * only add binary tests if they exist * shellcheck --------- Co-authored-by: miagilepner <mia.epner@hashicorp.com> Co-authored-by: Mike Palmiotto <mike.palmiotto@hashicorp.com>
42 lines
1.3 KiB
Bash
Executable File
42 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
MAX_TESTS=10
|
|
# this script expects the following env vars to be set
|
|
# error if these are not set
|
|
[ ${GITHUB_TOKEN:?} ]
|
|
[ ${RUN_ID:?} ]
|
|
[ ${REPO:?} ]
|
|
[ ${PR_NUMBER:?} ]
|
|
if [ -z "$TABLE_DATA" ]; then
|
|
BODY="CI Results:
|
|
All Go tests succeeded! :white_check_mark:"
|
|
else
|
|
# Remove any rows that don't have a test name
|
|
# Only keep the test type, test package, test name, and logs column
|
|
# Remove the scroll emoji
|
|
# Remove "github.com/hashicorp/vault" from the package name
|
|
TABLE_DATA=$(echo "$TABLE_DATA" | awk -F\| '{if ($4 != " - ") { print "|" $2 "|" $3 "|" $4 "|" $7 }}' | sed -r 's/ :scroll://' | sed -r 's/github.com\/hashicorp\/vault\///')
|
|
NUM_FAILURES=$(wc -l <<< "$TABLE_DATA")
|
|
|
|
# Check if the number of failures is greater than the maximum tests to display
|
|
# If so, limit the table to MAX_TESTS number of results
|
|
if [ "$NUM_FAILURES" -gt "$MAX_TESTS" ]; then
|
|
TABLE_DATA=$(echo "$TABLE_DATA" | head -n "$MAX_TESTS")
|
|
NUM_OTHER=( $NUM_FAILURES - "$MAX_TESTS" )
|
|
TABLE_DATA="$TABLE_DATA
|
|
|
|
and $NUM_OTHER other tests"
|
|
fi
|
|
|
|
# Add the header for the table
|
|
BODY="CI Results:
|
|
Failures:
|
|
| Test Type | Package | Test | Logs |
|
|
| --------- | ------- | ---- | ---- |
|
|
${TABLE_DATA}"
|
|
fi
|
|
|
|
source ./.github/scripts/gh_comment.sh
|
|
|
|
update_or_create_comment "$REPO" "$PR_NUMBER" "CI Results:" "$BODY" |