Skip to content

Commit

Permalink
Merge branch 'main' into sequence-callee
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Feb 4, 2023
2 parents 7acbcdc + b1d013a commit c614575
Show file tree
Hide file tree
Showing 185 changed files with 105,804 additions and 65,964 deletions.
57 changes: 34 additions & 23 deletions .github/actions/next-integration-stat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16450,39 +16450,48 @@
.map((t) => `\t- ${t}`)
.join(" \n")}`;
}
// Store plain textbased summary to share into Slack channel
// Note: Likely we'll need to polish this summary to make it more readable.
// Store a json payload to share via slackapi/slack-github-action into Slack channel
if (shouldShareTestSummaryToSlack) {
let textSummary = `*Next.js integration test status with Turbopack*

*Base: ${baseResults.ref} / ${shortBaseNextJsVersion}*
Test suites: :red_circle: ${baseTestFailedSuiteCount} / :green_circle: ${baseTestPassedSuiteCount} (Total: ${baseTestTotalSuiteCount})
Test cases : :red_circle: ${baseTestFailedCaseCount} / :green_circle: ${baseTestPassedCaseCount} (Total: ${baseTestTotalCaseCount})

*Current: ${sha} / ${shortCurrentNextJsVersion}*
Test suites: :red_circle: ${currentTestFailedSuiteCount} / :green_circle: ${currentTestPassedSuiteCount} (Total: ${currentTestTotalSuiteCount})
Test cases : :red_circle: ${currentTestFailedCaseCount} / :green_circle: ${currentTestPassedCaseCount} (Total: ${currentTestTotalCaseCount})

`;
let resultsSummary = "";
if (suiteCountDiff === 0) {
textSummary += "No changes in suite count.";
resultsSummary += "No changes in suite count.";
} else if (suiteCountDiff > 0) {
textSummary += `↓ ${suiteCountDiff} suites are fixed`;
resultsSummary += `↓ ${suiteCountDiff} suites are fixed`;
} else if (suiteCountDiff < 0) {
textSummary += `↑ ${suiteCountDiff} suites are newly failed`;
resultsSummary += `↑ ${suiteCountDiff} suites are newly failed`;
}
if (caseCountDiff === 0) {
textSummary += "No changes in test cases count.";
resultsSummary += "No changes in test cases count.";
} else if (caseCountDiff > 0) {
textSummary += `↓ ${caseCountDiff} test cases are fixed`;
resultsSummary += `↓ ${caseCountDiff} test cases are fixed`;
} else if (caseCountDiff < 0) {
textSummary += `↑ ${caseCountDiff} test cases are newly failed`;
resultsSummary += `↑ ${caseCountDiff} test cases are newly failed`;
}
const slackPayloadJson = JSON.stringify(
{
title: "Next.js integration test status with Turbopack",
// Derived from https://github.com/orgs/community/discussions/25470#discussioncomment-4720013
actionUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
shaUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/commit/${sha}`,
baseResultsRef: baseResults.ref,
shortBaseNextJsVersion,
// We're limited to 20 variables in Slack workflows, so combine these as text.
baseTestSuiteText: `:red_circle: ${baseTestFailedSuiteCount} / :large_green_circle: ${baseTestPassedSuiteCount} (Total: ${baseTestTotalSuiteCount})`,
baseTestCaseText: `:red_circle: ${baseTestFailedCaseCount} / :large_green_circle: ${baseTestPassedCaseCount} (Total: ${baseTestTotalCaseCount})`,
sha,
shortCurrentNextJsVersion,
currentTestSuiteText: `:red_circle: ${currentTestFailedSuiteCount} / :large_green_circle: ${currentTestPassedSuiteCount} (Total: ${currentTestTotalSuiteCount})`,
currentTestCaseText: `:red_circle: ${currentTestFailedCaseCount} / :large_green_circle: ${currentTestPassedCaseCount} (Total: ${currentTestTotalCaseCount})`,
resultsSummary,
},
null,
2
);
console.log(
"Storing text summary to ./test-summary.md to report into Slack channel.",
textSummary
"Storing slack payload to ./slack-paylod.json to report into Slack channel.",
slackPayloadJson
);
fs.writeFileSync("./test-summary.md", textSummary);
fs.writeFileSync("./slack-payload.json", slackPayloadJson);
}
return ret;
}
Expand All @@ -16499,7 +16508,9 @@
} = yield getInputs();
// determine if we want to report summary into slack channel.
// As a first step, we'll only report summary when the test is run against release-to-release. (no main branch regressions yet)
const shouldReportSlack = !prNumber && !shouldDiffWithMain;
const shouldReportSlack =
process.env.NEXT_TURBO_FORCE_SLACK_UPDATE === "true" ||
(!prNumber && !shouldDiffWithMain);
// Collect current PR's failed test results
const failedJobResults = yield getFailedJobResults(octokit, token, sha);
// Get the base to compare against
Expand Down
58 changes: 34 additions & 24 deletions .github/actions/next-integration-stat/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -568,42 +568,50 @@ function getTestSummary(
.join(" \n")}`;
}

// Store plain textbased summary to share into Slack channel
// Note: Likely we'll need to polish this summary to make it more readable.
// Store a json payload to share via slackapi/slack-github-action into Slack channel
if (shouldShareTestSummaryToSlack) {
let textSummary = `*Next.js integration test status with Turbopack*
*Base: ${baseResults.ref} / ${shortBaseNextJsVersion}*
Test suites: :red_circle: ${baseTestFailedSuiteCount} / :green_circle: ${baseTestPassedSuiteCount} (Total: ${baseTestTotalSuiteCount})
Test cases : :red_circle: ${baseTestFailedCaseCount} / :green_circle: ${baseTestPassedCaseCount} (Total: ${baseTestTotalCaseCount})
*Current: ${sha} / ${shortCurrentNextJsVersion}*
Test suites: :red_circle: ${currentTestFailedSuiteCount} / :green_circle: ${currentTestPassedSuiteCount} (Total: ${currentTestTotalSuiteCount})
Test cases : :red_circle: ${currentTestFailedCaseCount} / :green_circle: ${currentTestPassedCaseCount} (Total: ${currentTestTotalCaseCount})
`;

let resultsSummary = "";
if (suiteCountDiff === 0) {
textSummary += "No changes in suite count.";
resultsSummary += "No changes in suite count.";
} else if (suiteCountDiff > 0) {
textSummary += `↓ ${suiteCountDiff} suites are fixed`;
resultsSummary += `↓ ${suiteCountDiff} suites are fixed`;
} else if (suiteCountDiff < 0) {
textSummary += `↑ ${suiteCountDiff} suites are newly failed`;
resultsSummary += `↑ ${suiteCountDiff} suites are newly failed`;
}

if (caseCountDiff === 0) {
textSummary += "No changes in test cases count.";
resultsSummary += "No changes in test cases count.";
} else if (caseCountDiff > 0) {
textSummary += `↓ ${caseCountDiff} test cases are fixed`;
resultsSummary += `↓ ${caseCountDiff} test cases are fixed`;
} else if (caseCountDiff < 0) {
textSummary += `↑ ${caseCountDiff} test cases are newly failed`;
resultsSummary += `↑ ${caseCountDiff} test cases are newly failed`;
}

const slackPayloadJson = JSON.stringify(
{
title: "Next.js integration test status with Turbopack",
// Derived from https://github.com/orgs/community/discussions/25470#discussioncomment-4720013
actionUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
shaUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/commit/${sha}`,
baseResultsRef: baseResults.ref,
shortBaseNextJsVersion,
// We're limited to 20 variables in Slack workflows, so combine these as text.
baseTestSuiteText: `:red_circle: ${baseTestFailedSuiteCount} / :large_green_circle: ${baseTestPassedSuiteCount} (Total: ${baseTestTotalSuiteCount})`,
baseTestCaseText: `:red_circle: ${baseTestFailedCaseCount} / :large_green_circle: ${baseTestPassedCaseCount} (Total: ${baseTestTotalCaseCount})`,
sha,
shortCurrentNextJsVersion,
currentTestSuiteText: `:red_circle: ${currentTestFailedSuiteCount} / :large_green_circle: ${currentTestPassedSuiteCount} (Total: ${currentTestTotalSuiteCount})`,
currentTestCaseText: `:red_circle: ${currentTestFailedCaseCount} / :large_green_circle: ${currentTestPassedCaseCount} (Total: ${currentTestTotalCaseCount})`,
resultsSummary,
},
null,
2
);
console.log(
"Storing text summary to ./test-summary.md to report into Slack channel.",
textSummary
"Storing slack payload to ./slack-paylod.json to report into Slack channel.",
slackPayloadJson
);
fs.writeFileSync("./test-summary.md", textSummary);
fs.writeFileSync("./slack-payload.json", slackPayloadJson);
}

return ret;
Expand All @@ -616,7 +624,9 @@ async function run() {

// determine if we want to report summary into slack channel.
// As a first step, we'll only report summary when the test is run against release-to-release. (no main branch regressions yet)
const shouldReportSlack = !prNumber && !shouldDiffWithMain;
const shouldReportSlack =
process.env.NEXT_TURBO_FORCE_SLACK_UPDATE === "true" ||
(!prNumber && !shouldDiffWithMain);

// Collect current PR's failed test results
const failedJobResults = await getFailedJobResults(octokit, token, sha);
Expand Down
19 changes: 5 additions & 14 deletions .github/workflows/nextjs-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ on:
# Allow to specify Next.js version to run integration test against.
# If not specified, will use latest release version including canary.
version:
required: false
type: string
workflow_dispatch:
force_post_to_slack:
type: boolean

jobs:
# Build debug build of next-dev to use in integration test.
Expand Down Expand Up @@ -160,17 +160,6 @@ jobs:
RECORD_REPLAY_METADATA_TEST_RUN_TITLE: testIntegration / Group ${{ matrix.group }}
NEXT_INTEGRATION_TEST: true
- name: Send test data to Slack workflow
id: slack
uses: slackapi/slack-github-action@v1.23.0
with:
payload: |
{
"text": "Hello from Next.js+Turbo integration tests!"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.NEXT_TURBO_INTEGRATION_SLACK_WEBHOOK_URL }}

# Collect integration test results from execute_tests,
# Store it as github artifact for next step to consume.
collect_nextjs_integration_stat:
Expand All @@ -185,11 +174,13 @@ jobs:

- name: Collect integration test stat
uses: ./.github/actions/next-integration-stat
env:
NEXT_TURBO_FORCE_SLACK_UPDATE: "${{ inputs.force_post_to_slack }}"

- name: Store artifacts
uses: actions/upload-artifact@v3
with:
name: test-results
path: |
nextjs-test-results.json
test-summary.md
slack-payload.json
39 changes: 37 additions & 2 deletions .github/workflows/on-nextjs-release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ on:
# This is the event type defined by next.js upstream's `repository_dispatch` workflow dispatches.
types: [nextjs-release-published]
workflow_dispatch:
inputs:
version:
description: Next.js version
type: string
force_post_to_slack:
description: Post test results to Slack
type: boolean

jobs:
# Debug purpose, write down release version.
Expand All @@ -15,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Print release tag
run: echo "Found a new release ${{ github.event.client_payload.version }}"
run: echo "Found a new release via ${{ github.event_name }} -- ${{ inputs.version || github.event.client_payload.version }}"

# Trigger actual next.js integration tests.
next_js_integration:
Expand All @@ -24,12 +31,40 @@ jobs:
pull-requests: write
uses: ./.github/workflows/nextjs-integration-test.yml
with:
version: ${{ github.event.client_payload.version }}
force_post_to_slack: ${{ inputs.force_post_to_slack }}
version: ${{ inputs.version || github.event.client_payload.version }}

# Upload test results to branch.
upload_test_results:
name: Upload test results
# Don't upload results when this workflow is run manually via workflow_dispatch
if: ${{ github.event_name != 'workflow_dispatch' }}
needs: [next_js_integration]
uses: ./.github/workflows/upload-nextjs-integration-test-results.yml
with:
is_main_branch: false

post_to_slack:
needs: [next_js_integration]
name: Post results to Slack
runs-on: ubuntu-latest
steps:
- name: Download summary.md artifact
uses: actions/download-artifact@v3
with:
name: test-results
- name: Check if summary file was generated
id: summary_check
run: |
if stat slack-payload.json; then
echo "should_continue=true" >> $GITHUB_OUTPUT
else
echo "should_continue=false" >> $GITHUB_OUTPUT
fi
- name: Send test data to Slack workflow
if: steps.summary_check.outputs.should_continue == 'true'
uses: slackapi/slack-github-action@v1.23.0
with:
payload-file-path: "./slack-payload.json"
env:
SLACK_WEBHOOK_URL: ${{ secrets.NEXT_TURBO_INTEGRATION_SLACK_WEBHOOK_URL }}
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ crates/next-core/js/src/compiled
crates/turbopack-node/js/src/compiled
crates/turbopack/bench.json
crates/turbopack/tests
crates/turbopack-ecmascript/tests/analyzer/graph
crates/next-transform-strip-page-exports/tests
crates/next-transform-dynamic/tests
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cli/cmd/turbo/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package main

const turboVersion = "1.7.3-canary.1"
const turboVersion = "1.7.3"
17 changes: 17 additions & 0 deletions cli/integration_tests/lockfile_aware_caching/berry.t
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ Only b should have a cache miss
Cached: 0 cached, 1 total
Time:\s*[\.0-9]+m?s (re)

Add lockfile changes to a commit
$ git add . && git commit -m "bump lockfile" --quiet
Only root and b should be rebuilt since only the deps for b had a version bump
$ ${TURBO} build --filter="[HEAD^1]" --dry=json | jq ".packages"
[
"//",
"b"
]

Bump of root workspace invalidates all packages
$ patch yarn.lock turbo-bump.patch
Expand All @@ -79,3 +87,12 @@ Bump of root workspace invalidates all packages
Cached: 0 cached, 1 total
Time:\s*[\.0-9]+m?s (re)

Add lockfile changes to a commit
$ git add . && git commit -m "global lockfile change" --quiet
Everything should be rebuilt as a dependency of the root package got bumped
$ ${TURBO} build --filter="[HEAD^1]" --dry=json | jq ".packages | sort"
[
"//",
"a",
"b"
]
17 changes: 17 additions & 0 deletions cli/integration_tests/lockfile_aware_caching/npm.t
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ Only b should have a cache miss
Cached: 0 cached, 1 total
Time:\s*[\.0-9]+m?s (re)

Add lockfile changes to a commit
$ git add . && git commit -m "bump lockfile" --quiet
Only root and b should be rebuilt since only the deps for b had a version bump
$ ${TURBO} build --filter="[HEAD^1]" --dry=json | jq ".packages"
[
"//",
"b"
]

Bump of root workspace invalidates all packages
$ patch package-lock.json turbo-bump.patch
Expand Down Expand Up @@ -103,3 +111,12 @@ Bump of root workspace invalidates all packages
Cached: 0 cached, 1 total
Time:\s*[\.0-9]+m?s (re)

Add lockfile changes to a commit
$ git add . && git commit -m "global lockfile change" --quiet
Everything should be rebuilt as a dependency of the root package got bumped
$ ${TURBO} build --filter="[HEAD^1]" --dry=json | jq ".packages | sort"
[
"//",
"a",
"b"
]
17 changes: 17 additions & 0 deletions cli/integration_tests/lockfile_aware_caching/pnpm.t
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ Only b should have a cache miss
Cached: 0 cached, 1 total
Time:\s*[\.0-9]+m?s (re)

Add lockfile changes to a commit
$ git add . && git commit -m "bump pnpm-lock" --quiet
Only root and b should be rebuilt since only the deps for b had a version bump
$ ${TURBO} build --filter="[HEAD^1]" --dry=json | jq ".packages"
[
"//",
"b"
]

Bump of root workspace invalidates all packages
$ patch pnpm-lock.yaml turbo-bump.patch
Expand Down Expand Up @@ -103,3 +111,12 @@ Bump of root workspace invalidates all packages
Cached: 0 cached, 1 total
Time:\s*[\.0-9]+m?s (re)

Add lockfile changes to a commit
$ git add . && git commit -m "global lockfile change" --quiet
Everything should be rebuilt as a dependency of the root package got bumped
$ ${TURBO} build --filter="[HEAD^1]" --dry=json | jq ".packages | sort"
[
"//",
"a",
"b"
]
2 changes: 2 additions & 0 deletions cli/integration_tests/lockfile_aware_caching/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ git init ${TARGET_DIR} --quiet
GIT_ARGS="--git-dir=${TARGET_DIR}/.git --work-tree=${TARGET_DIR}"
git ${GIT_ARGS} config user.email "turbo-test@example.com"
git ${GIT_ARGS} config user.name "Turbo Test"
echo ".turbo" >> ${TARGET_DIR}/.gitignore
echo "node_modules" >> ${TARGET_DIR}/.gitignore
git ${GIT_ARGS} add .
git ${GIT_ARGS} commit -m "Initial" --quiet

Loading

0 comments on commit c614575

Please sign in to comment.