Refactor D3 Map to Support Both Rate Charts and Unknowns Charts #1856
Workflow file for this run
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
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: RUN Frontend Tests | |
env: | |
## Sets environment variables | |
NETLIFY_SITE_NAME: 'health-equity-tracker' | |
GITHUB_PR_NUMBER: ${{github.event.pull_request.number}} | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
paths: | |
- 'frontend/**' # Run when changes occur in the frontend subfolder | |
defaults: | |
run: | |
working-directory: frontend | |
jobs: | |
code-quality: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Biome | |
uses: biomejs/setup-biome@v2 | |
with: | |
version: latest | |
- name: Run Biome | |
run: | | |
echo "Running Biome" | |
echo "🚨 If this fails, run 'npm run cleanup' from your frontend/ local directory, add/commit, and push again." | |
echo "🔧 Also, please check your local pre-commit, as Biome should run on every local commit." | |
echo "See https://github.com/SatcherInstitute/health-equity-tracker?tab=readme-ov-file#install-node-and-pre-commit" | |
biome ci src/ | |
build_frontend: | |
name: Builds frontend | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: frontend/package.json | |
cache: 'npm' | |
cache-dependency-path: frontend/package-lock.json | |
- name: Install dependencies | |
run: npm ci | |
- name: Build React frontend | |
env: | |
NODE_OPTIONS: '--max_old_space_size=4096' | |
VITE_NODE_OPTIONS: '--max_old_space_size=4096' | |
run: npx tsc --noEmit && npm run build:deploy_preview | |
frontend_unit_tests: | |
name: Runs frontend unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: frontend/package.json | |
cache: 'npm' | |
cache-dependency-path: frontend/package-lock.json | |
- name: Install dependencies | |
run: npm ci | |
- name: Run Vitest unit tests | |
run: npm test | |
# If it's a PR creation or update, we'll run the e2e test here on Netlify | |
# if it's a merge to main, the E2E will run in e2eStaging.yml | |
tests_e2e_netlify_prepare: | |
name: Wait for Netlify deploy | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Waiting for "Success" from Netlify Preview | |
uses: Wandalen/wretry.action@master | |
with: | |
action: jakepartusch/[email protected] | |
attempt_limit: 3 | |
attempt_delay: 10000 | |
with: | | |
site_name: ${{env.NETLIFY_SITE_NAME}} | |
max_timeout: 180 | |
tests_e2e_netlify: | |
needs: | |
- tests_e2e_netlify_prepare | |
- code-quality | |
name: Run E2E tests on deploy preview | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: frontend/package.json | |
cache: 'npm' | |
cache-dependency-path: frontend/package-lock.json | |
- name: Install dependencies | |
run: npm ci | |
- name: Install playwright deps | |
run: npx playwright install --with-deps chromium | |
- name: run E2E on DEPLOY_PREVIEW | |
run: npx playwright test --project=E2E_NIGHTLY --workers 4 | |
# base url based on the GITHUB_PR_NUMBER + NETLIFY_SITE_NAME | |
env: | |
E2E_BASE_URL: 'https://deploy-preview-${{env.GITHUB_PR_NUMBER}}--${{env.NETLIFY_SITE_NAME}}.netlify.app' | |
# store test run reports if they fail | |
- uses: actions/upload-artifact@v4 | |
if: ${{ failure() }} | |
with: | |
name: playwright-report | |
path: frontend/playwright-report/ | |
retention-days: 30 |