Skip to content

Commit

Permalink
Merge branch 'main' into sokra/compile-time-value-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra authored Feb 15, 2023
2 parents 8de732d + 805a5ae commit 633dc5c
Show file tree
Hide file tree
Showing 226 changed files with 4,410 additions and 1,177 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ linker = "rust-lld"
xtask = "run --package xtask --"

[target.'cfg(all())']
rustflags = ["-Aclippy::too_many_arguments"]
rustflags = ["--cfg", "tokio_unstable", "-Aclippy::too_many_arguments"]
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/0-turborepo-bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Turborepo Bug Report
description: Create a bug report for the Turborepo team
title: "[turborepo] "
labels: ["kind: bug", "area: turborepo"]
labels: ["kind: bug", "area: turborepo", "needs: triage"]
body:
- type: markdown
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/1-turbopack-bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: Turbopack Bug Report
description: Create a bug report for the Turbopack team
title: "[turbopack] "
labels: ["kind: bug", "area: turbopack"]
labels: ["kind: bug", "area: turbopack", "needs: triage"]
body:
- type: markdown
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/2-feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Feature Request
description: Create a feature request
labels: ["story"]
labels: ["story", "needs: triage"]
body:
- type: markdown
attributes:
Expand Down
81 changes: 55 additions & 26 deletions .github/actions/next-integration-stat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16005,10 +16005,11 @@
})
.map((logs) => {
var _a, _b, _c, _d;
let failedSplitLogs = logs.split(`failed to pass within`);
const failedSplitLogs = logs.split(`failed to pass within`);
let logLine = failedSplitLogs.shift();
const ret = [];
while (!!failedSplitLogs && failedSplitLogs.length >= 1) {
let failedTest = failedSplitLogs.shift();
while (logLine) {
let failedTest = logLine;
// Look for the failed test file name
failedTest = (
failedTest === null || failedTest === void 0
Expand Down Expand Up @@ -16044,6 +16045,7 @@
name: failedTest,
data: JSON.parse(testData),
});
logLine = failedSplitLogs.shift();
} catch (_) {
console.log(`Failed to parse test data`);
}
Expand Down Expand Up @@ -16323,38 +16325,45 @@
)).data.tree;
// If base is main, get the tree under `test-results/main`
// Otherwise iterate over all the trees under `test-results` then find latest next.js release
let baseTree;
let testResultJsonTree;
if (shouldDiffWithMain) {
console.log("Trying to find latest test results from main branch");
baseTree = testResultsTree.find((tree) => tree.path === "main");
const baseTree = testResultsTree.find((tree) => tree.path === "main");
if (!baseTree || !baseTree.sha) {
console.log("There is no base to compare test results against");
return null;
}
console.log("Found base tree", baseTree);
// Now tree should point the list of .json for the actual test results
testResultJsonTree = (yield octokit.rest.git.getTree(
Object.assign(
Object.assign(
{},
_actions_github__WEBPACK_IMPORTED_MODULE_0__.context.repo
),
{ tree_sha: baseTree.sha }
)
)).data.tree;
} else {
console.log(
"Trying to find latest test results from next.js release"
);
baseTree = testResultsTree
const baseTree = testResultsTree
.filter((tree) => tree.path !== "main")
.reduce((acc, value) => {
if (!acc) {
return value;
}
return semver.gt(value.path, acc.path) ? value : acc;
}, null);
if (!baseTree || !baseTree.sha) {
console.log("There is no base to compare test results against");
return null;
}
console.log("Found base tree", baseTree);
// If the results is for the release, no need to traverse down the tree
testResultJsonTree = [baseTree];
}
if (!baseTree || !baseTree.sha) {
console.log("There is no base to compare test results against");
return null;
}
console.log("Found base tree", baseTree);
// Now tree should point the list of .json for the actual test results
const testResultJsonTree = (yield octokit.rest.git.getTree(
Object.assign(
Object.assign(
{},
_actions_github__WEBPACK_IMPORTED_MODULE_0__.context.repo
),
{ tree_sha: baseTree.sha }
)
)).data.tree;
if (!testResultJsonTree) {
console.log("There is no test results stored in the base yet");
return null;
Expand Down Expand Up @@ -16549,16 +16558,25 @@
const newFailedTests = currentTestFailedNames.filter(
(name) => !baseTestFailedNames.includes(name)
);
if (fixedTests.length > 0) {
ret += `\n:white_check_mark: **Fixed tests:**\n\n${fixedTests
.map((t) => (t.length > 5 ? `\t- ${t}` : t))
.join(" \n")}`;
}
/*
//NOTE: upstream test can be flaky, so this can appear intermittently
//even if there aren't actual fix. To avoid confusion, do not display this
//for now.
if (fixedTests.length > 0) {
ret += `\n:white_check_mark: **Fixed tests:**\n\n${fixedTests
.map((t) => (t.length > 5 ? `\t- ${t}` : t))
.join(" \n")}`;
}*/
if (newFailedTests.length > 0) {
ret += `\n:x: **Newly failed tests:**\n\n${newFailedTests
.map((t) => (t.length > 5 ? `\t- ${t}` : t))
.join(" \n")}`;
}
console.log(
"Newly failed tests",
JSON.stringify(newFailedTests, null, 2)
);
console.log("Fixed tests", JSON.stringify(fixedTests, null, 2));
// Store a json payload to share via slackapi/slack-github-action into Slack channel
if (shouldShareTestSummaryToSlack) {
let resultsSummary = "";
Expand Down Expand Up @@ -16661,6 +16679,7 @@
shouldDiffWithMain
);
const postCommentAsync = createCommentPostAsync(octokit, prNumber);
const failedTestLists = [];
// Consturct a comment body to post test report with summary & full details.
const comments = failedJobResults.result.reduce((acc, value, idx) => {
var _a, _b, _c;
Expand Down Expand Up @@ -16702,6 +16721,7 @@
groupedFails[ancestorKey].push(fail);
}
commentValues.push(`\`${failedTest}\``);
failedTestLists.push(failedTest);
for (const group of Object.keys(groupedFails).sort()) {
const fails = groupedFails[group];
commentValues.push(`\n`);
Expand Down Expand Up @@ -16762,6 +16782,15 @@
];
const isMultipleComments = comments.length > 1;
try {
// Store the list of failed test paths to a file
fs.writeFileSync(
"./failed-test-path-list.json",
JSON.stringify(
failedTestLists.filter((x) => x.length > 5),
null,
2
)
);
if (!prNumber) {
return;
}
Expand Down
77 changes: 54 additions & 23 deletions .github/actions/next-integration-stat/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,12 @@ function collectFailedTestResults(
return true;
})
.map((logs) => {
let failedSplitLogs = logs.split(`failed to pass within`);
const failedSplitLogs = logs.split(`failed to pass within`);
let logLine = failedSplitLogs.shift();
const ret = [];

while (!!failedSplitLogs && failedSplitLogs.length >= 1) {
let failedTest = failedSplitLogs.shift();
while (logLine) {
let failedTest = logLine;
// Look for the failed test file name
failedTest = failedTest?.includes("test/")
? failedTest?.split("\n").pop()?.trim()
Expand All @@ -201,6 +202,7 @@ function collectFailedTestResults(
name: failedTest,
data: JSON.parse(testData),
});
logLine = failedSplitLogs.shift();
} catch (_) {
console.log(`Failed to parse test data`);
}
Expand Down Expand Up @@ -420,41 +422,50 @@ async function getTestResultDiffBase(

// If base is main, get the tree under `test-results/main`
// Otherwise iterate over all the trees under `test-results` then find latest next.js release
let baseTree:
let testResultJsonTree:
| Awaited<
ReturnType<Awaited<Octokit["rest"]["git"]["getTree"]>>
>["data"]["tree"][number]
>["data"]["tree"]
| undefined;

if (shouldDiffWithMain) {
console.log("Trying to find latest test results from main branch");
baseTree = testResultsTree.find((tree) => tree.path === "main");
const baseTree = testResultsTree.find((tree) => tree.path === "main");

if (!baseTree || !baseTree.sha) {
console.log("There is no base to compare test results against");
return null;
}
console.log("Found base tree", baseTree);

// Now tree should point the list of .json for the actual test results
testResultJsonTree = (
await octokit.rest.git.getTree({
...context.repo,
tree_sha: baseTree.sha,
})
).data.tree;
} else {
console.log("Trying to find latest test results from next.js release");
baseTree = testResultsTree
const baseTree = testResultsTree
.filter((tree) => tree.path !== "main")
.reduce((acc, value) => {
if (!acc) {
return value;
}

return semver.gt(value.path, acc.path) ? value : acc;
}, null as any as typeof baseTree);
}
}, null);

if (!baseTree || !baseTree.sha) {
console.log("There is no base to compare test results against");
return null;
}

console.log("Found base tree", baseTree);
if (!baseTree || !baseTree.sha) {
console.log("There is no base to compare test results against");
return null;
}
console.log("Found base tree", baseTree);

// Now tree should point the list of .json for the actual test results
const testResultJsonTree = (
await octokit.rest.git.getTree({
...context.repo,
tree_sha: baseTree.sha,
})
).data.tree;
// If the results is for the release, no need to traverse down the tree
testResultJsonTree = [baseTree];
}

if (!testResultJsonTree) {
console.log("There is no test results stored in the base yet");
Expand Down Expand Up @@ -652,18 +663,25 @@ function getTestSummary(
(name) => !baseTestFailedNames.includes(name)
);

/*
//NOTE: upstream test can be flaky, so this can appear intermittently
//even if there aren't actual fix. To avoid confusion, do not display this
//for now.
if (fixedTests.length > 0) {
ret += `\n:white_check_mark: **Fixed tests:**\n\n${fixedTests
.map((t) => (t.length > 5 ? `\t- ${t}` : t))
.join(" \n")}`;
}
}*/

if (newFailedTests.length > 0) {
ret += `\n:x: **Newly failed tests:**\n\n${newFailedTests
.map((t) => (t.length > 5 ? `\t- ${t}` : t))
.join(" \n")}`;
}

console.log("Newly failed tests", JSON.stringify(newFailedTests, null, 2));
console.log("Fixed tests", JSON.stringify(fixedTests, null, 2));

// Store a json payload to share via slackapi/slack-github-action into Slack channel
if (shouldShareTestSummaryToSlack) {
let resultsSummary = "";
Expand Down Expand Up @@ -773,6 +791,8 @@ async function run() {

const postCommentAsync = createCommentPostAsync(octokit, prNumber);

const failedTestLists = [];

// Consturct a comment body to post test report with summary & full details.
const comments = failedJobResults.result.reduce((acc, value, idx) => {
const { name: failedTest, data: testData } = value;
Expand All @@ -797,6 +817,7 @@ async function run() {
}

commentValues.push(`\`${failedTest}\``);
failedTestLists.push(failedTest);

for (const group of Object.keys(groupedFails).sort()) {
const fails = groupedFails[group];
Expand Down Expand Up @@ -864,6 +885,16 @@ async function run() {
const isMultipleComments = comments.length > 1;

try {
// Store the list of failed test paths to a file
fs.writeFileSync(
"./failed-test-path-list.json",
JSON.stringify(
failedTestLists.filter((x) => x.length > 5),
null,
2
)
);

if (!prNumber) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/bench-turbotrace-against-node-nft.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Bench Turbo trace against @vercel/nft
name: Bench Turbotrace against @vercel/nft

on:
push:
Expand All @@ -21,7 +21,7 @@ jobs:
name: bench

env:
BUILD_ARGS: --release -p turbopack --features bench_against_node_nft bench_against_node_nft
BENCH_ARGS: --release -p turbopack --features bench_against_node_nft bench_against_node_nft

steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/nextjs-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,5 @@ jobs:
name: test-results
path: |
nextjs-test-results.json
failed-test-path-list.json
slack-payload.json
6 changes: 4 additions & 2 deletions .github/workflows/upload-nextjs-integration-test-results.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ jobs:
- name: Print test results
run: |
ls -al ./test-results/main
cat ./test-results/main/nextjs-test-results.json
echo "Print failed test path list:"
cat ./test-results/main/failed-test-path-list.json
echo "NEXTJS_VERSION=$(cat ./test-results/main/nextjs-test-results.json | jq .nextjsVersion | tr -d '"' | cut -d ' ' -f2)" >> $GITHUB_ENV
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "RESULT_SUBPATH=$(if ${{ inputs.is_main_branch }}; then echo 'main'; else echo ${{ env.NEXTJS_VERSION }}; fi)" >> $GITHUB_ENV
Expand All @@ -45,7 +46,8 @@ jobs:
run: |
echo "Configured test result subpath for ${{ env.RESULT_SUBPATH }} / ${{ env.NEXTJS_VERSION }} / ${{ env.SHA_SHORT }}"
mkdir -p test-results/${{ env.RESULT_SUBPATH }}
mv test-results/main/nextjs-test-results.json test-results/${{ env.RESULT_SUBPATH }}/$(date '+%Y%m%d%H%M')-${{ env.NEXTJS_VERSION }}-${{ env.SHA_SHORT }}.json
mv -v test-results/main/nextjs-test-results.json test-results/${{ env.RESULT_SUBPATH }}/$(date '+%Y%m%d%H%M')-${{ env.NEXTJS_VERSION }}-${{ env.SHA_SHORT }}.json
mv -fvn test-results/main/failed-test-path-list.json test-results/${{ env.RESULT_SUBPATH }}/failed-test-path-list.json
ls -al ./test-results
ls -al ./test-results/${{ env.RESULT_SUBPATH }}
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"go.lintTool": "golangci-lint",
"files.associations": {
"libturbo.h": "c"
"libturbo.h": "c",
"turbo.json": "jsonc"
},
"[cram]": {
"editor.trimAutoWhitespace": false,
Expand Down
Loading

0 comments on commit 633dc5c

Please sign in to comment.