mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-02-23 10:04:18 -08:00
Create a new GHA for cypress tests
This commit is contained in:
parent
a76ec36a31
commit
2cc6dd017f
1 changed files with 102 additions and 0 deletions
102
.github/workflows/cypress-tests.yml
vendored
Normal file
102
.github/workflows/cypress-tests.yml
vendored
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
name: Cypress Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# Add this back when working with dashboard and parallel
|
||||||
|
# paths:
|
||||||
|
# - "client/**/*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
install:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: client
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [14.x]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
- name: Set DESTINATION_FOLDER for branch
|
||||||
|
run: |
|
||||||
|
echo "DESTINATION_FOLDER=$(echo $PR_NUMBER-$GITHUB_SHA | cut -c 1-11)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Install app
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build app
|
||||||
|
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
|
||||||
|
SITE_URL: "http://usds-geoplatform-justice40-website.s3-website-us-east-1.amazonaws.com/"
|
||||||
|
PATH_PREFIX: "/justice40-tool/${{env.DESTINATION_FOLDER}}"
|
||||||
|
|
||||||
|
- name: Lint app
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
# Disabling for now due to jsonlint - TODO: put this back
|
||||||
|
# - name: License Check
|
||||||
|
# run: npm run licenses
|
||||||
|
|
||||||
|
- name: Run unit tests on app
|
||||||
|
run: npm test
|
||||||
|
|
||||||
|
- name: Check for security vulnerabilities
|
||||||
|
run: npm audit --production
|
||||||
|
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: J40Static
|
||||||
|
# Upload-artifact does not support the default working directory
|
||||||
|
# See more: https://github.com/actions/upload-artifact/issues/87
|
||||||
|
path: ./client/public
|
||||||
|
|
||||||
|
ui-chrome-tests:
|
||||||
|
timeout-minutes: 15
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: cypress/browsers:node14.17.0-chrome88-ff89
|
||||||
|
needs: install
|
||||||
|
strategy:
|
||||||
|
# when one test fails, DO NOT cancel the other
|
||||||
|
# containers, because this will kill Cypress processes
|
||||||
|
# leaving the Dashboard hanging ...
|
||||||
|
# https://github.com/cypress-io/github-action/issues/48
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
# run copies of the current job in parallel
|
||||||
|
containers: [1, 2, 3, 4, 5]
|
||||||
|
steps:
|
||||||
|
- name: Checkout source
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: J40Static
|
||||||
|
path: ./public
|
||||||
|
|
||||||
|
- name: "UI Tests - Chrome"
|
||||||
|
uses: cypress-io/github-action@v2
|
||||||
|
with:
|
||||||
|
start: npm start
|
||||||
|
wait-on: "http://localhost:3000"
|
||||||
|
browser: chrome
|
||||||
|
record: true
|
||||||
|
parallel: true
|
||||||
|
group: "UI - Chrome"
|
||||||
|
env:
|
||||||
|
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
|
||||||
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||||
|
# Recommended: pass the GitHub token lets this action correctly
|
||||||
|
# determine the unique run id necessary to re-run the checks
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
Loading…
Add table
Reference in a new issue