mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Fix GitHub comment
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#! /bin/bash
|
||||
# Script to bootstrap a Linux environment for CI.
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
# Check if sudo privileges are available
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "This script must be run using sudo."
|
||||
@@ -52,6 +54,18 @@ curl -fsSL https://keys.openpgp.org/vks/v1/by-fingerprint/32A37959C2FA5C3C99EFBC
|
||||
echo "deb [signed-by=/usr/share/keyrings/buildkite-agent-archive-keyring.gpg] https://apt.buildkite.com/buildkite-agent stable main" \
|
||||
| tee /etc/apt/sources.list.d/buildkite-agent.list > /dev/null
|
||||
|
||||
# Install libssl1.1 if not Debian 11
|
||||
if [ "${DEBIAN_VERSION}" != "bullseye" ]; then
|
||||
echo "deb http://security.ubuntu.com/ubuntu focal-security main" > tee /etc/apt/sources.list.d/focal-security.list
|
||||
for key in '871920D1991BC93C' '3B4FE6ACC0B21F32'; do
|
||||
gpg --keyserver keyserver.ubuntu.com --recv-keys "${key}"
|
||||
gpg --export --armor "${key}" | apt-key add -
|
||||
done
|
||||
apt-get update
|
||||
apt-get install -y --reinstall --no-install-recommends libssl1.1
|
||||
rm -f /etc/apt/sources.list.d/focal-security.list
|
||||
fi
|
||||
|
||||
# Install dependencies
|
||||
apt-get update
|
||||
apt-get install -y --reinstall --no-install-recommends \
|
||||
|
||||
@@ -111,14 +111,13 @@ async function runTests(target) {
|
||||
}
|
||||
|
||||
if (isGitHubAction) {
|
||||
const markdown = formatTestToMarkdown(result);
|
||||
if (markdown) {
|
||||
const summaryPath = process.env["GITHUB_STEP_SUMMARY"];
|
||||
if (summaryPath) {
|
||||
appendFileSync(summaryPath, markdown);
|
||||
}
|
||||
appendFileSync("comment.md", markdown);
|
||||
const summaryPath = process.env["GITHUB_STEP_SUMMARY"];
|
||||
if (summaryPath) {
|
||||
const longMarkdown = formatTestToMarkdown(result);
|
||||
appendFileSync(summaryPath, longMarkdown);
|
||||
}
|
||||
const shortMarkdown = formatTestToMarkdown(result, true);
|
||||
appendFileSync("comment.md", shortMarkdown);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -137,7 +136,7 @@ async function runTests(target) {
|
||||
const failedTests = results.filter(({ ok }) => !ok);
|
||||
if (isGitHubAction) {
|
||||
reportOutputToGitHubAction("failing_tests_count", failedTests.length);
|
||||
const markdown = formatTestToMarkdown(...failedTests);
|
||||
const markdown = formatTestToMarkdown(failedTests);
|
||||
reportOutputToGitHubAction("failing_tests", markdown);
|
||||
}
|
||||
}
|
||||
@@ -1049,10 +1048,12 @@ async function runTask(title, fn) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {...TestResult} results
|
||||
* @param {TestResult | TestResult[]} result
|
||||
* @param {boolean} concise
|
||||
* @returns {string}
|
||||
*/
|
||||
function formatTestToMarkdown(...results) {
|
||||
function formatTestToMarkdown(result, concise) {
|
||||
const results = Array.isArray(result) ? result : [result];
|
||||
const buildLabel = getBuildLabel();
|
||||
const buildUrl = getBuildUrl();
|
||||
const platform = buildUrl ? `<a href="${buildUrl}">${buildLabel}</a>` : buildLabel;
|
||||
@@ -1089,7 +1090,9 @@ function formatTestToMarkdown(...results) {
|
||||
}
|
||||
markdown += ` on ${platform}</summary>\n\n`;
|
||||
|
||||
if (isBuildKite) {
|
||||
if (concise) {
|
||||
// No preview
|
||||
} else if (isBuildKite) {
|
||||
const preview = escapeCodeBlock(stdout);
|
||||
markdown += `\`\`\`terminal\n${preview}\n\`\`\`\n`;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user