69 lines
1.9 KiB
YAML
69 lines
1.9 KiB
YAML
# Backend CI — Cloud Functions build+tests and Firestore security-rules tests.
|
|
#
|
|
# The rules job needs BOTH Node and Java: the Firestore emulator is a JVM
|
|
# process. jest does NOT boot the emulator itself (its globalSetup only points
|
|
# FIRESTORE_EMULATOR_HOST at port 8180 per firebase.json) — so the suite runs
|
|
# under `firebase emulators:exec`, which boots the emulator, runs the tests,
|
|
# and tears it down. `--project demo-closer` keeps it fully offline (demo-*
|
|
# projects never touch production).
|
|
name: Backend CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, dev]
|
|
pull_request:
|
|
|
|
jobs:
|
|
functions:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: npm
|
|
cache-dependency-path: functions/package-lock.json
|
|
|
|
- name: Install
|
|
working-directory: functions
|
|
run: npm ci
|
|
|
|
- name: Build (tsc)
|
|
working-directory: functions
|
|
run: npm run build
|
|
|
|
- name: Test
|
|
working-directory: functions
|
|
run: npm test
|
|
|
|
firestore-rules:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: "17"
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
cache: npm
|
|
cache-dependency-path: firestore-tests/package-lock.json
|
|
|
|
- name: Install
|
|
working-directory: firestore-tests
|
|
run: npm ci
|
|
|
|
# Runs from the repo root: emulators:exec reads firebase.json (rules path +
|
|
# emulator port 8180) there, boots the emulator, runs the suite, tears down.
|
|
- name: Rules tests (under emulators:exec)
|
|
run: >
|
|
firestore-tests/node_modules/.bin/firebase emulators:exec
|
|
--only firestore --project demo-closer
|
|
"cd firestore-tests && npx jest --runInBand"
|