Merge pull request #100 from jsasitorn/subcollection-guard #130
This file contains 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
name: tests | |
on: [push, pull_request_target] | |
jobs: | |
# Source: https://iterative.ai/blog/testing-external-contributions-using-github-actions-secrets | |
authorize: | |
environment: ${{ github.event_name == 'pull_request_target' && | |
github.event.pull_request.head.repo.full_name != github.repository && | |
'sandbox' || 'internal' }} | |
runs-on: ubuntu-latest | |
steps: | |
- run: true | |
build_and_test: | |
needs: authorize | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.17.1 | |
cache: npm | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/firebase/emulators | |
key: ${{ runner.os }}-firebase-emulators | |
- run: npm install | |
- run: npm install -g firebase-tools | |
- run: cd functions && npm install | |
- name: Run ESLint | |
run: npm run lint | |
continue-on-error: false # Ensure the workflow fails if ESLint fails | |
- name: Run Tests | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
run: npm run test -- --ci --color |