2024-02-12 19:29:14 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eo pipefail
|
|
|
|
|
|
|
|
cleanup() {
|
|
|
|
# Remove if nothing was generated.
|
2024-02-12 21:17:01 +08:00
|
|
|
[ -d artifacts ] && find artifacts -type d -empty -delete
|
2024-02-12 19:29:14 +08:00
|
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
2024-02-12 21:17:01 +08:00
|
|
|
# Make a central directory to store all output artifacts of our test run to
|
|
|
|
# avoid having to configure multiple upload-artifacts steps in the workflow
|
|
|
|
# file.
|
2024-02-12 19:29:14 +08:00
|
|
|
OSSL_CI_ARTIFACTS_PATH="artifacts/"
|
|
|
|
if [ -n "${GITHUB_RUN_NUMBER}" ]; then
|
|
|
|
OSSL_CI_ARTIFACTS_PATH="artifacts/github-${GITHUB_JOB}-${GITHUB_RUN_NUMBER}-${GITHUB_RUN_ID}/"
|
|
|
|
fi
|
|
|
|
mkdir -p "$OSSL_CI_ARTIFACTS_PATH"
|
|
|
|
export OSSL_CI_ARTIFACTS_PATH="$(cd "$OSSL_CI_ARTIFACTS_PATH"; pwd)"
|
|
|
|
|
2024-02-12 21:17:01 +08:00
|
|
|
# Run the tests. This might fail, but we need to capture artifacts anyway.
|
|
|
|
set +e
|
2024-02-12 19:29:14 +08:00
|
|
|
make test HARNESS_JOBS=${HARNESS_JOBS:-4} "$@"
|
2024-02-12 21:17:01 +08:00
|
|
|
RESULT=$?
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Move an interesting subset of the test-runs data we want into the artifacts
|
|
|
|
# staging directory.
|
|
|
|
for test_name in quic_multistream; do
|
|
|
|
if [ -d "test-runs/test_${test_name}" ]; then
|
|
|
|
mv "test-runs/test_${test_name}" "$OSSL_CI_ARTIFACTS_PATH/"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# Log the artifact tree.
|
|
|
|
echo "::group::List of artifact files generated"
|
|
|
|
echo "Test suite exited with $RESULT, artifacts path is $OSSL_CI_ARTIFACTS_PATH"
|
|
|
|
(cd "$OSSL_CI_ARTIFACTS_PATH"; find . -type f | sort)
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
2024-04-25 20:53:26 +08:00
|
|
|
echo "Archive artifacts"
|
|
|
|
tar -czvf artifacts.tar.gz $OSSL_CI_ARTIFACTS_PATH
|
|
|
|
|
2024-02-12 21:17:01 +08:00
|
|
|
exit $RESULT
|