Skip to content

debug tests

debug tests #208

# This file was auto-generated by the Firebase CLI
# https://github.com/firebase/firebase-tools
name: Deploy to Firebase Hosting on merge
on: push
# Cancel any previous CI runs for this branch or PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: "pnpm"
check-latest: true
- name: Output debugging info
run: node -v && npm -v && pnpm -v
- name: Install
run: pnpm install && pnpm --dir functions install
- name: Lint
run: pnpm run lint
- name: Build
run: pnpm run build:all
- name: Setup emulator cache
uses: actions/cache@v3
with:
path: ~/.cache/firebase/emulators
key: emulators-${{ runner.os }}
- name: Integration tests
run: pnpm run test
# env:
# VITEST_MAX_THREADS: 1
# VITEST_MIN_THREADS: 1
deploy:
if: github.ref_name == 'main' || github.ref_name == 'production'
environment: ${{ github.ref_name == 'main' && 'staging' || github.ref_name == 'production' && 'production' }}
needs: build_and_test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: "pnpm"
check-latest: true
- name: Output debugging info
run: node -v && npm -v && pnpm -v
- name: Install
run: pnpm install && pnpm --dir functions install
# Note: no linting or testing, since it was done in the previous job
- name: Build
run: pnpm run build:all
env:
VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }}
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }}
VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }}
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }}
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }}
VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }}
- name: Create SA key
run: echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}' > $HOME/gcloud.json
- name: Deploy
# This requires a lot of pesky permissions in GCP, inspired from: https://davelms.medium.com/deploy-firebase-functions-using-github-actions-7dbafbd4df77
run: GOOGLE_APPLICATION_CREDENTIALS=$HOME/gcloud.json pnpm run deploy --project ${{ secrets.VITE_FIREBASE_PROJECT_ID }}