Skip to content

Promote

Promote #224

Workflow file for this run

name: Pull Request Events
on: pull_request
permissions:
contents: write
id-token: write
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
test-functional:
name: Functional tests
runs-on: ubuntu-latest
environment:
name: dev
steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false
- name: 💾 Cache firebase emulators
uses: actions/cache@v4
with:
path: /home/runner/.cache/firebase/emulators
key: ${{ runner.os }}-firebase-emulators-${{ hashFiles('emulator-cache/**') }}
continue-on-error: true
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: 📥 Download dependencies
run: npm ci
- name: 💻 Install Playwright Browsers
run: npx playwright install chromium --with-deps
- name: 🚀 Start App
run: |
npm run start:e2e-resources &
npx wait-on http://127.0.0.1:5173
npx wait-on http://127.0.0.1:4000/auth
env:
VITE_QUAD_WORD: ${{ secrets.QUAD_WORD }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
VITE_BUILD: development
- name: ⏯️ Run Playwright Tests
run: npm run e2e
- name: ⬆️ Upload Artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
test-unit:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: ⬇️ Set up code
uses: actions/checkout@v4
with:
show-progress: false
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: 📥 Download dependencies
run: npm ci
- name: 🧪 Run tests
run: npm test
test-build:
name: Test build
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v4
with:
show-progress: false
- name: ⎔ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: npm
- name: 📥 Download dependencies
run: |
npm ci
- name: 📦 Build
env:
VITE_QUAD_WORD: test
VITE_FIREBASE_CONFIG: '{}'
run: npm run build
deploy-preview:
name: Firebase preview
runs-on: ubuntu-latest
needs: [test-functional, test-unit, test-build]
if: ${{ github.event.sender.type == 'User' }}
environment:
name: dev
steps:
- name: 🚀 Deploy
uses: agrc/firebase-website-deploy-composite-action@v1
with:
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
service-account-email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
project-id: ${{ secrets.PROJECT_ID }}
preview: yes
prebuild-command: |
cd functions
echo "ENVIRONMENT=stage" > .env
echo "AGS_HOST=https://wrimaps.at.utah.gov" >> .env
build-command: npm run build:stage
repo-token: ${{ secrets.GITHUB_TOKEN }}
env:
VITE_QUAD_WORD: ${{ secrets.QUAD_WORD }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}