ci: report daily turbo integration test results from this repo (#58965)

### What?

A follow up for #58267 and #58394.

We no longer need the git branch for history it's stored in datadog now
and we also decided that we no longer need slack reporting.


Closes PACK-2039

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
This commit is contained in:
Leah 2023-12-04 16:18:42 +01:00 committed by GitHub
parent 63a578f1c3
commit 15215d4c96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 15289 additions and 43058 deletions

View file

@ -20,9 +20,6 @@ packages/react-refresh-utils/**/*.js
packages/react-dev-overlay/lib/**
**/__tmp__/**
.github/actions/next-stats-action/.work
.github/actions/validate-docs-links/lib/index.js
.github/actions/needs-triage/index.js
.github/actions/*/index.mjs
packages/next-codemod/transforms/__testfixtures__/**/*
packages/next-codemod/transforms/__tests__/**/*
packages/next-codemod/**/*.js
@ -40,4 +37,4 @@ bench/nested-deps/**
bench/nested-deps-app-router/**
packages/next-bundle-analyzer/index.d.ts
examples/with-typescript-graphql/lib/gql/
test/development/basic/hmr/components/parse-error.js
test/development/basic/hmr/components/parse-error.js

View file

@ -1 +0,0 @@
lib/

View file

@ -3,4 +3,4 @@ description: 'vercel/next.js specific auto-labeling action'
author: 'Next.js team'
runs:
using: 'node20'
main: 'index.js'
main: 'dist/index.js'

View file

@ -1,11 +1,11 @@
{
"private": true,
"exports": "./index.js",
"exports": "./dist/index.js",
"files": [
"src"
],
"scripts": {
"build": "pnpm types && ncc -m -o . build lib/index.js --license licenses.txt",
"build": "pnpm types && ncc build lib/index.js -m -o dist --license licenses.txt",
"types": "tsc"
},
"devDependencies": {

View file

@ -17,4 +17,4 @@ inputs:
runs:
using: node20
main: index.js
main: dist/index.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,10 +1,10 @@
{
"name": "next-integration-stat",
"private": true,
"main": "src/index.js",
"main": "dist/index.js",
"scripts": {
"lint": "eslint src/",
"pack": "ncc -t -o . build src/index.ts",
"build": "ncc build src/index.ts -t -o dist",
"lint:prettier": "prettier -c . --cache --ignore-path=../../../.prettierignore"
},
"devDependencies": {
@ -19,5 +19,10 @@
"node-fetch": "^2.6.8",
"semver": "^7.3.8",
"strip-ansi": "^7.0.1"
}
},
"engines": {
"node": ">=18.17.0",
"pnpm": "8.9.0"
},
"packageManager": "pnpm@8.9.0"
}

View file

@ -14,12 +14,6 @@ type Job = Awaited<
ReturnType<Octokit['rest']['actions']['listJobsForWorkflowRun']>
>['data']['jobs'][number]
type ExistingComment =
| Awaited<
ReturnType<Octokit['rest']['issues']['listComments']>
>['data'][number]
| undefined
// A comment marker to identify the comment created by this action.
const BOT_COMMENT_MARKER = `<!-- __marker__ next.js integration stats __marker__ -->`
// Header for the test report.
@ -113,112 +107,6 @@ async function fetchJobLogsFromWorkflow(
return { logs, job }
}
// Store a json payload to share via slackapi/slack-github-action into Slack channel
async function createSlackPostSummary(payload: {
shortCurrentNextJsVersion: string
sha: string
currentTestFailedSuiteCount: number
currentTestPassedSuiteCount: number
currentTestTotalSuiteCount: number
currentTestFailedCaseCount: number
currentTestPassedCaseCount: number
currentTestTotalCaseCount: number
suiteCountDiff?: number | null
caseCountDiff?: number | null
baseResults?: TestResultManifest
shortBaseNextJsVersion?: string
baseTestFailedSuiteCount?: number | null
baseTestPassedSuiteCount?: number | null
baseTestTotalSuiteCount?: number | null
baseTestFailedCaseCount?: number | null
baseTestPassedCaseCount?: number | null
baseTestTotalCaseCount?: number | null
}) {
const {
suiteCountDiff,
caseCountDiff,
baseResults,
sha,
shortBaseNextJsVersion,
shortCurrentNextJsVersion,
baseTestFailedSuiteCount,
baseTestPassedSuiteCount,
baseTestTotalSuiteCount,
baseTestFailedCaseCount,
baseTestPassedCaseCount,
baseTestTotalCaseCount,
currentTestFailedSuiteCount,
currentTestPassedSuiteCount,
currentTestTotalSuiteCount,
currentTestFailedCaseCount,
currentTestPassedCaseCount,
currentTestTotalCaseCount,
} = payload
let resultsSummary = ''
if (
Number.isSafeInteger(suiteCountDiff) &&
Number.isSafeInteger(caseCountDiff)
) {
if (suiteCountDiff === 0) {
resultsSummary += 'No changes in suite count.'
} else if (suiteCountDiff > 0) {
resultsSummary += `${suiteCountDiff} suites are fixed`
} else if (suiteCountDiff < 0) {
resultsSummary += `${suiteCountDiff} suites are newly failed`
}
if (caseCountDiff === 0) {
resultsSummary += 'No changes in test cases count.'
} else if (caseCountDiff > 0) {
resultsSummary += `${caseCountDiff} test cases are fixed`
} else if (caseCountDiff < 0) {
resultsSummary += `${caseCountDiff} test cases are newly failed`
}
}
let baseTestSuiteText = 'Summary without base'
let baseTestCaseText = 'Summary without base'
if (
Number.isSafeInteger(baseTestFailedSuiteCount) &&
Number.isSafeInteger(baseTestPassedSuiteCount) &&
Number.isSafeInteger(baseTestTotalSuiteCount)
) {
baseTestSuiteText = `:red_circle: ${baseTestFailedSuiteCount} / :large_green_circle: ${baseTestPassedSuiteCount} (Total: ${baseTestTotalSuiteCount})`
baseTestCaseText = `:red_circle: ${baseTestFailedCaseCount} / :large_green_circle: ${baseTestPassedCaseCount} (Total: ${baseTestTotalCaseCount})`
}
const slackPayloadJson = JSON.stringify(
{
title: 'Next.js integration test status with Turbopack',
// Derived from https://github.com/orgs/community/discussions/25470#discussioncomment-4720013
actionUrl: baseResults
? `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`
: 'Daily test run',
shaUrl: baseResults
? `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/commit/${sha}`
: sha,
baseResultsRef: baseResults?.ref ?? 'N/A',
shortBaseNextJsVersion: shortBaseNextJsVersion ?? 'N/A',
// We're limited to 20 variables in Slack workflows, so combine these as text.
baseTestSuiteText,
baseTestCaseText,
sha: sha.substring(0, 7),
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 slack payload to ./slack-payload.json to report into Slack channel.',
slackPayloadJson
)
fs.writeFileSync('./slack-payload.json', slackPayloadJson)
}
// Collect necessary inputs to run actions,
async function getInputs(): Promise<{
token: string
@ -608,8 +496,7 @@ function getTestSummary(
sha: string,
shouldDiffWithMain: boolean,
baseResults: TestResultManifest | null,
jobResults: TestResultManifest,
shouldShareTestSummaryToSlack: boolean
jobResults: TestResultManifest
) {
// Read current tests summary
const {
@ -669,19 +556,6 @@ function getTestSummary(
if (!baseResults) {
console.log("There's no base to compare")
if (shouldShareTestSummaryToSlack) {
createSlackPostSummary({
shortCurrentNextJsVersion,
sha,
currentTestPassedSuiteCount,
currentTestFailedSuiteCount,
currentTestTotalSuiteCount,
currentTestFailedCaseCount,
currentTestPassedCaseCount,
currentTestTotalCaseCount,
})
}
return `### Test summary
| | Current (${sha}) | Diff |
|---|---|---|
@ -798,29 +672,6 @@ function getTestSummary(
console.log('Newly failed tests', JSON.stringify(newFailedTests, null, 2))
console.log('Fixed tests', JSON.stringify(fixedTests, null, 2))
if (shouldShareTestSummaryToSlack) {
createSlackPostSummary({
shortCurrentNextJsVersion,
sha,
currentTestPassedSuiteCount,
currentTestFailedSuiteCount,
currentTestTotalSuiteCount,
currentTestFailedCaseCount,
currentTestPassedCaseCount,
currentTestTotalCaseCount,
suiteCountDiff,
caseCountDiff,
baseResults,
shortBaseNextJsVersion,
baseTestFailedCaseCount,
baseTestFailedSuiteCount,
baseTestPassedCaseCount,
baseTestPassedSuiteCount,
baseTestTotalCaseCount,
baseTestTotalSuiteCount,
})
}
return ret
}
@ -871,14 +722,6 @@ async function run() {
shouldExpandResultMessages,
} = await 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 =
process.env.NEXT_TURBO_FORCE_SKIP_SLACK_UPDATE === 'true'
? false
: process.env.NEXT_TURBO_FORCE_SLACK_UPDATE === 'true' ||
(!prNumber && !shouldDiffWithMain)
// Collect current PR's failed test results
const jobResults = await getJobResults(octokit, token, sha)
@ -996,8 +839,7 @@ async function run() {
sha,
shouldDiffWithMain,
noBaseComparison ? null : baseResults,
jobResults,
shouldReportSlack
jobResults
),
],
},

View file

@ -1,3 +0,0 @@
**/node_modules
out.md
.work

View file

@ -6,7 +6,7 @@
"src"
],
"scripts": {
"build": "ncc -m -o . build src/index.mjs --license licenses.txt"
"build": "ncc build src/index.mjs -m -o dist --license licenses.txt"
},
"devDependencies": {
"@vercel/ncc": "0.34.0"

View file

@ -0,0 +1,5 @@
name: 'upload-turboyet-data'
description: 'Uploads data for Are We Turbo Yet? to Vercel KV'
runs:
using: 'node20'
main: 'dist/index.js'

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,19 @@
{
"name": "upload-turboyet-data-action",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "ncc build src/main.js -o dist --source-map"
},
"dependencies": {
"@vercel/kv": "^0.2.3"
},
"devDependencies": {
"@vercel/ncc": "^0.36.0"
},
"engines": {
"node": ">=18.17.0",
"pnpm": "8.9.0"
},
"packageManager": "pnpm@8.9.0"
}

View file

@ -0,0 +1,90 @@
const fs = require('fs/promises')
const path = require('path')
const { createClient } = require('@vercel/kv')
async function main() {
try {
const file = path.join(
process.cwd(),
'./test-results/nextjs-test-results.json'
)
let passingTests = ''
let failingTests = ''
let passCount = 0
let failCount = 0
const contents = await fs.readFile(file, 'utf-8')
const results = JSON.parse(contents)
let { ref } = results
const currentDate = new Date()
const isoString = currentDate.toISOString()
const timestamp = isoString.slice(0, 19).replace('T', ' ')
for (const result of results.result) {
let suitePassCount = 0
let suiteFailCount = 0
suitePassCount += result.data.numPassedTests
suiteFailCount += result.data.numFailedTests
let suiteName = result.data.testResults[0].name
// remove "/home/runner/work/turbo/turbo/" from the beginning of suiteName
suiteName = suiteName.slice(30)
if (suitePassCount > 0) {
passingTests += `${suiteName}\n`
}
if (suiteFailCount > 0) {
failingTests += `${suiteName}\n`
}
for (const assertionResult of result.data.testResults[0]
.assertionResults) {
let assertion = assertionResult.fullName.replaceAll('`', '\\`')
if (assertionResult.status === 'passed') {
passingTests += `* ${assertion}\n`
} else if (assertionResult.status === 'failed') {
failingTests += `* ${assertion}\n`
}
}
passCount += suitePassCount
failCount += suiteFailCount
if (suitePassCount > 0) {
passingTests += `\n`
}
if (suiteFailCount > 0) {
failingTests += `\n`
}
}
const kv = createClient({
url: process.env.TURBOYET_KV_REST_API_URL,
token: process.env.TURBOYET_KV_REST_API_TOKEN,
})
const testRun = `${ref}\t${timestamp}\t${passCount}/${
passCount + failCount
}`
console.log('TEST RESULT')
console.log(testRun)
await kv.rpush('test-runs', testRun)
console.log('SUCCESSFULLY SAVED RUNS')
await kv.set('passing-tests', passingTests)
console.log('SUCCESSFULLY SAVED PASSING')
await kv.set('failing-tests', failingTests)
console.log('SUCCESSFULLY SAVED FAILING')
} catch (error) {
console.log(error)
}
}
main()

File diff suppressed because one or more lines are too long

View file

@ -1,12 +1,12 @@
{
"private": true,
"type": "module",
"exports": "./lib/index.js",
"exports": "./dist/index.js",
"files": [
"src"
],
"scripts": {
"build": "pnpm types && ncc -m -o ./lib build src/index.ts --license licenses.txt",
"build": "pnpm types && ncc build src/index.ts -m -o ./dist --license licenses.txt",
"types": "tsc"
},
"devDependencies": {

View file

@ -25,6 +25,37 @@ importers:
specifier: 5.1.6
version: 5.1.6
actions/next-integration-stat:
dependencies:
'@actions/core':
specifier: ^1.10.0
version: 1.10.0
'@actions/exec':
specifier: ^1.1.1
version: 1.1.1
'@actions/github':
specifier: ^5.1.1
version: 5.1.1
node-fetch:
specifier: ^2.6.8
version: 2.6.12
semver:
specifier: ^7.3.8
version: 7.5.4
strip-ansi:
specifier: ^7.0.1
version: 7.1.0
devDependencies:
'@types/node':
specifier: ^18.11.18
version: 18.16.19
'@vercel/ncc':
specifier: 0.34.0
version: 0.34.0
typescript:
specifier: ^4.4.4
version: 4.9.5
actions/next-stats-action:
dependencies:
async-sema:
@ -81,6 +112,16 @@ importers:
specifier: 0.34.0
version: 0.34.0
actions/upload-turboyet-data:
dependencies:
'@vercel/kv':
specifier: ^0.2.3
version: 0.2.4
devDependencies:
'@vercel/ncc':
specifier: ^0.36.0
version: 0.36.1
actions/validate-docs-links:
dependencies:
'@actions/core':
@ -130,6 +171,12 @@ packages:
uuid: 8.3.2
dev: false
/@actions/exec@1.1.1:
resolution: {integrity: sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==}
dependencies:
'@actions/io': 1.1.3
dev: false
/@actions/github@5.1.1:
resolution: {integrity: sha512-Nk59rMDoJaV+mHCOJPXuvB1zIbomlKS0dmSIqPGxd0enAXBnOfn4VWF+CGtRCwXZG9Epa54tZA7VIRlJDS8A6g==}
dependencies:
@ -147,6 +194,10 @@ packages:
tunnel: 0.0.6
dev: false
/@actions/io@1.1.3:
resolution: {integrity: sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==}
dev: false
/@octokit/auth-token@2.5.0:
resolution: {integrity: sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==}
dependencies:
@ -287,11 +338,34 @@ packages:
resolution: {integrity: sha512-cputDpIbFgLUaGQn6Vqg3/YsJwxUwHLO13v3i5ouxT4lat0khip9AEWxtERujXV9wxIB1EyF97BSJFt6vpdI8g==}
dev: false
/@upstash/redis@1.24.3:
resolution: {integrity: sha512-gw6d4IA1biB4eye5ESaXc0zOlVQI94aptsBvVcTghYWu1kRmOrJFoMFEDCa8p5uzluyYAOFCuY2GWLR6O4ZoIw==}
dependencies:
crypto-js: 4.2.0
dev: false
/@vercel/kv@0.2.4:
resolution: {integrity: sha512-wbIOOXhg6MzmNMzKFSWbbLAS65hCZcJN33z1coENzI1M0fOX55yE9v9LwVGqkzdItp3eZsv6pYvwcmGtllyLTw==}
engines: {node: '>=14.6'}
dependencies:
'@upstash/redis': 1.24.3
dev: false
/@vercel/ncc@0.34.0:
resolution: {integrity: sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A==}
hasBin: true
dev: true
/@vercel/ncc@0.36.1:
resolution: {integrity: sha512-S4cL7Taa9yb5qbv+6wLgiKVZ03Qfkc4jGRuiUQMQ8HGBD5pcNRnHeYM33zBvJE4/zJGjJJ8GScB+WmTsn9mORw==}
hasBin: true
dev: true
/ansi-regex@6.0.1:
resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==}
engines: {node: '>=12'}
dev: false
/argparse@1.0.10:
resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==}
dependencies:
@ -380,6 +454,10 @@ packages:
which: 1.3.1
dev: false
/crypto-js@4.2.0:
resolution: {integrity: sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==}
dev: false
/delayed-stream@1.0.0:
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
engines: {node: '>=0.4.0'}
@ -954,6 +1032,14 @@ packages:
lru-cache: 6.0.0
dev: false
/semver@7.5.4:
resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==}
engines: {node: '>=10'}
hasBin: true
dependencies:
lru-cache: 6.0.0
dev: false
/shebang-command@1.2.0:
resolution: {integrity: sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==}
engines: {node: '>=0.10.0'}
@ -982,6 +1068,13 @@ packages:
resolution: {integrity: sha512-d/5Z4/2iiCnHw6Xzghyhb+GcmF89bxwgXG60wjIiZaxnymbyOmI8Hk4VqHXiVVp6u2ysaskFfXg3ekCj4WNftQ==}
dev: false
/strip-ansi@7.1.0:
resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==}
engines: {node: '>=12'}
dependencies:
ansi-regex: 6.0.1
dev: false
/strip-bom-string@1.0.0:
resolution: {integrity: sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==}
engines: {node: '>=0.10.0'}
@ -1024,6 +1117,12 @@ packages:
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
dev: false
/typescript@4.9.5:
resolution: {integrity: sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==}
engines: {node: '>=4.2.0'}
hasBin: true
dev: true
/typescript@5.1.6:
resolution: {integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==}
engines: {node: '>=14.17'}

View file

@ -91,7 +91,7 @@ jobs:
node-version: 18
- run: corepack enable
- name: 'Run link checker'
run: node ./.github/actions/validate-docs-links/lib
run: node ./.github/actions/validate-docs-links/dist/index.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -16,12 +16,6 @@ on:
diff_base:
type: string
default: 'main'
force_post_to_slack:
type: boolean
# Skip posting to slack regardless of the conditions.
skip_post_to_slack:
type: boolean
default: false
# Workflow-common env variables
env:
@ -169,9 +163,6 @@ jobs:
uses: ./.github/actions/next-integration-stat
with:
diff_base: ${{ inputs.diff_base }}
env:
NEXT_TURBO_FORCE_SLACK_UPDATE: '${{ inputs.force_post_to_slack }}'
NEXT_TURBO_FORCE_SKIP_SLACK_UPDATE: '${{ inputs.skip_post_to_slack }}'
- name: Store artifacts
uses: actions/upload-artifact@v3
@ -181,7 +172,6 @@ jobs:
nextjs-test-results.json
failed-test-path-list.json
passed-test-path-list.json
slack-payload.json
upload_test_report:
needs: [test-dev, test-integration]

View file

@ -12,11 +12,6 @@ on:
type: string
default: 'canary'
post_to_slack:
description: Post test results to Slack
type: boolean
default: false
jobs:
# Trigger actual next.js integration tests.
next_js_integration:
@ -28,40 +23,11 @@ jobs:
with:
diff_base: 'none'
version: ${{ inputs.version || 'canary' }}
skip_post_to_slack: ${{ github.event_name != 'schedule' && inputs.post_to_slack != true }}
# Upload test results to branch.
# Upload test results to KV, but only for scheduled runs.
upload_test_results:
name: Upload test results
needs: [next_js_integration]
if: ${{ github.event_name == 'schedule' }} && always()
uses: ./.github/workflows/upload-nextjs-integration-test-results.yml
secrets: inherit
with:
is_main_branch: true
# post_to_slack:
# needs: [next_js_integration]
# name: Post results to Slack
# runs-on: ubuntu-latest
# if: always()
# 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 }}

View file

@ -1,16 +1,10 @@
# Reusable workflow to upload next.js integration test result to specific branch `nextjs-integration-test-data`
# This workflow assumes `next-integration-test` workflow has been executed and test results are stored in `test-results/main` directory.
# Reusable workflow to upload next.js integration test results to KV for https://areweturboyet.com/
# This workflow assumes the `next-integration-test` workflow has been executed
# and test reports have been uploaded to the `test-results` artifact.
name: Update next.js integration test results
on:
workflow_call:
inputs:
# Boolean flag to indicate if this workflow is triggered by default branch update.
# If this flag is set to true, then the workflow will upload test results to subpath `/main`.
# Otherwise, the workflow will upload test results to subpath `/${nextjs-version}`.
is_main_branch:
required: true
type: boolean
workflow_dispatch:
jobs:
@ -18,53 +12,25 @@ jobs:
name: Upload test results
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: nextjs-integration-test-data
- name: Git pull
run: |
git pull --depth=1 --no-tags origin nextjs-integration-test-data
# First, grab test results into `test-results/main` directory from artifact stored by `next-integration-test`.
- name: Grab test results
# Download test results into the `test-results` directory from the artifact created by `nextjs-integration-test`.
- name: Download test results artifact
uses: actions/download-artifact@v3
with:
name: test-results
path: test-results/main
path: test-results
# Read next.js version from test results, set necessary environment variables.
- name: Print test results
run: |
rm -rf ./test-results/main/slack-payload.json
ls -al ./test-results/main
echo "Print failed test path list:"
cat ./test-results/main/failed-test-path-list.json
echo "Print passed test path list:"
cat ./test-results/main/passed-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
::group::Passed test paths
cat ./test-results/passed-test-path-list.json
::endgroup::
# Copy test results to `${date}-${nextjs-version}-${sha-short}.json`.
# If workflow is not coming from main branch update, then we need to move test results to subpath `/${nextjs-version}`.
- name: Congifure subpath
run: |
echo "Configured test result subpath for ${{ env.RESULT_SUBPATH }} / ${{ env.NEXTJS_VERSION }} / ${{ env.SHA_SHORT }}"
mkdir -p test-results/${{ env.RESULT_SUBPATH }}
cp -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 }}
::group::Failed test paths
cat ./test-results/failed-test-path-list.json
::endgroup::
- name: Push data to branch
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: test-results/**
commit_message: 'test(integration): Integration test results for ${{ env.NEXTJS_VERSION }} (${{ env.SHA_SHORT }})'
- name: 'Upload Are We Turbo Yet data'
- name: 'Upload results to "Are We Turbo Yet" KV'
env:
TURBOYET_KV_REST_API_URL: ${{ secrets.TURBOYET_KV_REST_API_URL }}
TURBOYET_KV_REST_API_TOKEN: ${{ secrets.TURBOYET_KV_REST_API_TOKEN }}

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
# build output
dist
!.github/actions/*/dist
.next
target
packages/next/wasm/@next

View file

@ -16,9 +16,6 @@ packages/next/src/bundles/webpack/packages/*.runtime.js
packages/next/src/bundles/webpack/packages/lazy-compilation-*.js
.github/actions/next-stats-action/.work
.github/actions/validate-docs-links/lib/index.js
.github/actions/needs-triage/index.js
.github/actions/*/index.mjs
packages/next-swc/crates/**/tests/**/output*
packages/next-swc/crates/core/tests/loader/issue-32553/input.js