mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-02-22 09:41:26 -08:00
65 lines
1.9 KiB
YAML
65 lines
1.9 KiB
YAML
name: Pull Request Frontend
|
|
on:
|
|
pull_request:
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
env:
|
|
node-version: 18.x
|
|
jobs:
|
|
# JOB to run change detection
|
|
detect-fe-changes:
|
|
name: Detect frontend changes
|
|
runs-on: ubuntu-latest
|
|
# Required permissions
|
|
permissions:
|
|
pull-requests: read
|
|
# Set job outputs to values from filter step
|
|
outputs:
|
|
frontend: ${{ steps.filter.outputs.frontend }}
|
|
steps:
|
|
# For pull requests it's not necessary to checkout the code
|
|
- uses: dorny/paths-filter@v3
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
frontend:
|
|
- 'client/**'
|
|
- '.github/workflows/pr_frontend.yml'
|
|
frontend-build:
|
|
name: Frontend build
|
|
needs: detect-fe-changes
|
|
if: ${{ needs.detect-fe-changes.outputs.frontend == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
environment: PR
|
|
defaults:
|
|
run:
|
|
working-directory: client
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js ${{ env.node-version }}
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: ${{ env.node-version }}
|
|
- name: Install
|
|
run: npm ci
|
|
- name: Build
|
|
run: npm run build --if-present
|
|
env:
|
|
# See the client readme for more info on environment variables:
|
|
# https://github.com/usds/justice40-tool/blob/main/client/README.md
|
|
DATA_SOURCE: cdn
|
|
# TODO: Update main URL when either is back up
|
|
SITE_URL: "${{ secrets.SITE_URL }}"
|
|
- name: Get directory contents
|
|
run: ls -la public
|
|
- name: Lint
|
|
run: npm run lint
|
|
- name: License Check
|
|
run: npm run licenses
|
|
- name: Unit tests
|
|
run: npm test
|
|
- name: Spanish translation test
|
|
run: npm run test:intl-translations
|
|
# - name: Check for security vulnerabilities
|
|
# run: npm audit --production
|