-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: setup cicd vercel #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
*Lighthouse ran on https://mobilitydatabase-3tecx7whc-mobility-data.vercel.app/ * (Desktop)
*Lighthouse ran on https://mobilitydatabase-3tecx7whc-mobility-data.vercel.app/feeds * (Desktop)
*Lighthouse ran on https://mobilitydatabase-3tecx7whc-mobility-data.vercel.app/feeds/gtfs/mdb-2126 * (Desktop)
*Lighthouse ran on https://mobilitydatabase-3tecx7whc-mobility-data.vercel.app/feeds/gtfs_rt/mdb-2585 * (Desktop)
*Lighthouse ran on https://mobilitydatabase-3tecx7whc-mobility-data.vercel.app/gbfs/gbfs-flamingo_porirua * (Desktop)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces Vercel deployment automation through GitHub Actions, replacing the previous standalone Next.js output configuration. The changes implement a three-tiered deployment strategy: preview deployments for pull requests using the DEV environment, automatic staging deployments for the main branch (via Vercel's branching), and production deployments triggered by GitHub releases or manual workflow dispatch.
Changes:
- Migrated from static
robots.txtfiles to dynamic Next.jsrobots()function based on Vercel environment - Replaced hardcoded API URLs in MSW handlers with wildcard patterns for environment flexibility
- Removed standalone output mode from Next.js config for Vercel compatibility
- Added GitHub Actions workflows for preview deployments (with Lighthouse checks) and production releases
- Enhanced test setup with Firebase Auth mocks and environment detection improvements
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/setupTests.ts | Added Firebase Auth provider mocks and polyfills for test environment |
| src/mocks/handlers.ts | Switched from environment-based URLs to wildcard patterns for API mocking |
| src/lib/firebase-admin.ts | Formatting change (line break) for consistency |
| src/app/robots.ts | New dynamic robots.txt generation based on Vercel environment variable |
| src/app/layout.tsx | Added environment-aware robots meta tags |
| src/app/context/RemoteConfigProvider.spec.tsx | Removed entire test file |
| public/robots.txt | Deleted static production robots file |
| public/robots.staging.txt | Deleted static staging robots file |
| package.json | Specified Node.js 24.x engine requirement |
| next.config.mjs | Removed standalone output mode and commented assetPrefix |
| cypress.config.ts | Improved CI detection logic for environment selection |
| .github/workflows/verecl-prod-on-release.yml | New workflow for production deployments via releases |
| .github/workflows/vercel-preview-pr.yml | New workflow for PR preview deployments with quality checks |
| .github/workflows/README.md | Documentation for deployment workflows |
| .github/lighthouserc.js | Lighthouse CI configuration for performance testing |
| .github/config.yml | GitHub bot configuration for welcoming new contributors |
| .github/PULL_REQUEST_TEMPLATE.md | Standardized PR template with checklist |
Comments suppressed due to low confidence (1)
src/app/context/RemoteConfigProvider.spec.tsx:1
- The entire test file for
userHasBypassfunction has been deleted. Ensure that equivalent test coverage exists elsewhere for the bypass configuration logic, or consider whether this functionality still exists and needs testing.
|
|
||
| - name: Format lighthouse score | ||
| id: format_lighthouse_score | ||
| uses: actions/github-script@v3 |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The action actions/github-script@v3 is outdated. The latest stable version is v7. Consider updating to actions/github-script@v7 for better performance and security.
| uses: actions/github-script@v3 | |
| uses: actions/github-script@v7 |
| disabled: false | ||
| }, | ||
| extraHeaders: JSON.stringify({ | ||
| 'x-vercel-protection-bypass': String(process.env.VERCEL_AUTOMATION_BYPASS_SECRET) |
Copilot
AI
Jan 29, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If VERCEL_AUTOMATION_BYPASS_SECRET is undefined, this will set the header value to the string 'undefined'. This should handle the undefined case explicitly or ensure the environment variable is always set.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| types: [opened, synchronize, reopened] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the types here to avoid confusion; by default, only the listed types are executed.
| @@ -0,0 +1,147 @@ | |||
| name: Vercel Preview (PR) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove "Vercel" from the file name and title. We can use this workflow to run lint, unit tests, Cypress tests, and other checks that do not necessarily involve Vercel.
| jobs: | ||
| deploy_preview: | ||
| # ✅ Only run for same-repo PRs (not forks) | ||
| if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use this workflow to run all the checks, such as lint, unit tests, and Cypress. The condition should be applied only in the step that deploys the preview to Vercel.
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 24.12.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick]: create a variable with the node version within the workflow and replace the value here and other places that is used(the same for the other workflow), example
| run: npm i -g vercel@latest | ||
|
|
||
| - name: Pull environment variables from Vercel for e2e tests | ||
| run: vercel env pull .env.local --environment=preview --yes --token=${{ env.VERCEL_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question]: Do we need to access the Vercel configuration to run the Cypress tests? If yes, this will be an issue with developers that don't have access to Vercel and also in forks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do for the only reason of getting the .env variables. You do have a point that they will not be able to run this. Lets create a ticket on how we can mock services in the e2e test to not require a .env file so that it's easier to run. This could also be an extension to create a mock server for dev environment without .env secrets
| @@ -0,0 +1,16 @@ | |||
| import { type MetadataRoute } from 'next'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm reading this correctly, the robots.txt is implemented as a server-side component. If this is true, then my comment:
The robots.txt file is highly used and doesn't change at runtime. This file is intrinsic static per environment. It's preferable to have one file per environment and manage the deployment of the correct one during build time instead of having a server-side function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is robots.txt a file or a folder?

Introduces CICD setup for Vercel deployments. This is the github actions aspect of it, there were a
Vercel Settings (Not reflected in PR)
Github Actions Summary
On PR to main -> code checks, deploy preview url (DEV), lighthouse check
Once code is in main -> Vercel branching strategy will automatically deploy to the staging environment (QA)
Productions has 3 ways to deploy
Note about the prototype workflow
I copied functionality from our previous cicd, with the exception of prototypes. Because the .env vars live on Vercel, to mimic functionality of previous prototyping we would need to create 3 environments
dev/qa/prod-prototype. As this was workflow / environment was not frequently used, I omitted it from this PR and is something to evaluate in the future