name: Continuous Integration

on:
  pull_request:
    branches: [ main ]

jobs:
  test_pull_request:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 16
      
      - name: Install dependencies
        run: |
          npm ci
          cd functions && npm ci
      
      - name: Run Vue.js unit tests
        run: npm run test:unit

      - name: Run Firebase integration tests
        run: npm run test
        working-directory: ./functions

      - name: Build environment
        run: npm run build