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