Unverified Commit 818aa245 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[ci] Allow configuring the base URL for preview builds (#93464)

parent 5452439f
......@@ -1036,7 +1036,7 @@ function generatePrTarballSection(actionInfo) {
<summary><strong>📎 Tarball URL</strong></summary>
\`\`\`
https://vercel-packages.vercel.app/next/commits/${actionInfo.commitId}/next
${actionInfo.previewBuildsBaseUrl}/commits/${actionInfo.commitId}/next
\`\`\`
</details>
......
......@@ -15,6 +15,7 @@ module.exports = function actionInfo() {
GITHUB_REPOSITORY,
GITHUB_EVENT_PATH,
PR_STATS_COMMENT_TOKEN,
PREVIEW_BUILDS_BASE_URL,
} = process.env
delete process.env.GITHUB_TOKEN
......@@ -59,6 +60,8 @@ module.exports = function actionInfo() {
isRelease:
GITHUB_REPOSITORY === 'vercel/next.js' &&
(GITHUB_REF || '').includes('canary'),
previewBuildsBaseUrl:
PREVIEW_BUILDS_BASE_URL || 'https://vercel-packages.vercel.app/next',
}
if (info.isRelease) {
......
......@@ -483,7 +483,7 @@ jobs:
- name: Create tarballs
# github.event.after is available on push and pull_request#synchronize events.
# For workflow_dispatch events, github.sha is the head commit.
run: node scripts/create-preview-tarballs.js "${{ github.event.after || github.sha }}" "${{ runner.temp }}/preview-tarballs"
run: node scripts/create-preview-tarballs.js "${{ github.event.after || github.sha }}" "${{ runner.temp }}/preview-tarballs" "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
- name: Upload tarballs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
......
......@@ -782,7 +782,8 @@ jobs:
node scripts/test-new-tests.mjs \
--flake-detection \
--mode dev \
--group ${{ matrix.group }}
--group ${{ matrix.group }} \
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
stepName: 'test-new-tests-dev-${{matrix.group}}'
timeout_minutes: 60 # Increase the default timeout as tests are intentionally run multiple times to detect flakes
......@@ -807,7 +808,8 @@ jobs:
node scripts/test-new-tests.mjs \
--flake-detection \
--mode start \
--group ${{ matrix.group }}
--group ${{ matrix.group }} \
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
stepName: 'test-new-tests-start-${{matrix.group}}'
timeout_minutes: 60 # Increase the default timeout as tests are intentionally run multiple times to detect flakes
secrets: inherit
......@@ -834,7 +836,8 @@ jobs:
export __NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES=true
node scripts/test-new-tests.mjs \
--mode deploy \
--group ${{ matrix.group }}
--group ${{ matrix.group }} \
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
stepName: 'test-new-tests-deploy-${{matrix.group}}'
secrets: inherit
......@@ -868,7 +871,8 @@ jobs:
export NEXT_E2E_TEST_TIMEOUT=240000
node scripts/test-new-tests.mjs \
--mode deploy \
--group ${{ matrix.group }}
--group ${{ matrix.group }} \
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
stepName: 'test-new-tests-deploy-cache-components-${{matrix.group}}'
secrets: inherit
......
......@@ -121,6 +121,7 @@ jobs:
TURBO_TEAM: ${{ env.TURBO_TEAM }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_CACHE: ${{ env.TURBO_CACHE }}
PREVIEW_BUILDS_BASE_URL: ${{ vars.PREVIEW_BUILDS_BASE_URL }}
- name: Upload stats results
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
......
......@@ -8,7 +8,9 @@ async function main() {
const [
githubHeadSha,
tarballDirectory = path.join(os.tmpdir(), 'vercel-nextjs-preview-tarballs'),
baseUrlArg,
] = process.argv.slice(2)
const baseUrl = baseUrlArg || 'https://vercel-packages.vercel.app/next'
const repoRoot = path.resolve(__dirname, '..')
await fs.mkdir(tarballDirectory, { recursive: true })
......@@ -87,13 +89,13 @@ async function main() {
for (const packageInfo of packages) {
packagesByVersion.set(
packageInfo.name,
`https://vercel-packages.vercel.app/next/commits/${githubHeadSha}/${packageInfo.name}`
`${baseUrl}/commits/${githubHeadSha}/${packageInfo.name}`
)
}
for (const nextSwcPackageName of nextSwcPackageNames) {
packagesByVersion.set(
nextSwcPackageName,
`https://vercel-packages.vercel.app/next/commits/${githubHeadSha}/${nextSwcPackageName}`
`${baseUrl}/commits/${githubHeadSha}/${nextSwcPackageName}`
)
}
......
......@@ -14,11 +14,14 @@ async function main() {
const argv = await yargs(process.argv.slice(2))
.string('mode')
.string('group')
.string('preview-builds-base-url')
.boolean('flake-detection').argv
const testMode = argv.mode
const isFlakeDetectionMode = argv['flake-detection']
const attempts = isFlakeDetectionMode ? 3 : 1
const previewBuildsBaseUrl =
argv['preview-builds-base-url'] || 'https://vercel-packages.vercel.app/next'
if (testMode && !['dev', 'deploy', 'start'].includes(testMode)) {
throw new Error(
......@@ -92,7 +95,7 @@ async function main() {
// PR number endpoint (which resolves the PR to a SHA on every request).
const nextTestVersion =
testMode === 'deploy'
? `https://vercel-packages.vercel.app/next/commits/${commitSha}/next`
? `${previewBuildsBaseUrl}/commits/${commitSha}/next`
: undefined
if (nextTestVersion) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment