Firebase JS SDK Nightly Next.js #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2024 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: Firebase JS SDK Nightly Next.js | |
on: | |
schedule: | |
- cron: "0 0 * * *" # Nightly | |
pull_request: | |
branches: | |
- main | |
paths: # Only run if files in these paths change | |
- 'js-sdk-framework-tests/nextjs/**' | |
- '.github/workflows/js-sdk-nightly-next-js.yaml' | |
- 'package.json' # Root package.json | |
- 'lerna.json' | |
- 'yarn.lock' | |
workflow_dispatch: | |
permissions: read-all | |
jobs: | |
nextjs-tests: | |
name: Next.js Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Set up Node (20) | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: 'yarn' | |
cache-dependency-path: yarn.lock # Root yarn.lock | |
- name: Install Monorepo Dependencies | |
run: yarn install | |
working-directory: ./ # Run yarn install from the root | |
- name: Write Project Config for Next.js | |
env: | |
PROJECT_CONFIG: ${{ secrets.PROJECT_CONFIG }} | |
run: echo "export const firebaseConfig = $PROJECT_CONFIG;" > src/lib/app_tests/firebase.ts | |
working-directory: ./js-sdk-framework-tests/nextjs | |
- name: Restore cached playwright browsers | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/ms-playwright | |
# Key uses the playwright.config.ts from the nextjs package | |
key: playwright-browsers-${{ hashFiles('js-sdk-framework-tests/nextjs/playwright.config.ts') }} | |
- name: Setup Next.js App (Playwright browsers) | |
run: yarn setup:nextjs | |
- name: Build Next.js App | |
run: yarn build:nextjs | |
- name: Run Next.js tests | |
run: yarn test:nextjs | |
- name: Send email on failure | |
if: failure() && github.event_name == 'schedule' # Only send email for scheduled nightly runs | |
uses: ./.github/actions/send-email | |
with: | |
api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }} | |
domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }} | |
from: 'GitHub <admin-github@${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}>' | |
to: ${{ secrets.FIREBASE_NEXTJS_TESTS_GITHUB_EMAILS }} | |
subject: 'Nightly build of ${{github.repository}} failed!' | |
html: > | |
<b>The nightly workflow to test the Firebase JS SDK with Next.js failed on: ${{github.repository}}</b> | |
<br /><br />Navigate to the | |
<a href="https://github.com/FirebaseExtended/firebase-js-sdk-framework-tests/actions/runs/${{github.run_id}}">failed workflow</a> | |
to look further into what went wrong. | |
continue-on-error: true |