fix: package.json to reduce vulnerabilities #113
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: e2e | ||
on: | ||
push: | ||
branches: | ||
# Disable for now. I'll run e2e before push. | ||
- e2e_disabled | ||
jobs: | ||
#----------------------------------------- | ||
# e2e test | ||
#----------------------------------------- | ||
e2e: | ||
runs-on: ubuntu-18.04 | ||
container: | ||
image: cypress/browsers:node14.15.0-chrome86-ff82 | ||
options: --user 1001 --shm-size=2g | ||
#needs: build | ||
name: e2e test | ||
# Service containers to run with `container-job` | ||
services: | ||
# Label used to access the service container | ||
postgres-service: | ||
# Docker Hub image | ||
image: postgres | ||
# Provide the password for postgres | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: password | ||
POSTGRES_DB: postgres | ||
# use postgres for the host here because we have specified a container for the job. | ||
# If we were running the job on the VM this would be localhost | ||
POSTGRES_HOST: postgres | ||
# Set health checks to wait until postgres has started | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
# Maps tcp port 5432 on service container to the host | ||
ports: ["5432:5432"] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# browser: chrome | ||
# browser: [ chrome, firefox ] | ||
containers: [1, 2, 3] | ||
# Run e2e only on develop | ||
# FIXME: if: github.ref == 'refs/heads/e2e' || github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# CRA "Bug" : https://github.com/facebook/create-react-app/issues/7612 | ||
# - name: Fixing known bug | ||
# run: echo "fs.inotify.max_user_watches=524288" >> /etc/sysctl.conf | ||
# e2e | ||
# https://medium.com/swlh/publish-your-cypress-test-report-with-github-actions-47248788713a | ||
# https://github.com/bahmutov/cypress-gh-action-example/tree/master/.github/workflows | ||
- name: e2e | ||
uses: cypress-io/github-action@v2 | ||
with: | ||
working-directory: /home/runner/work/calcetto/calcetto | ||
# Start server and wait for response | ||
start: npm run test:app:server , npm run test:app:client | ||
wait-on: 'http://localhost:5000 , http://localhost:5001' | ||
# Test options | ||
# config: baseUrl=http://localhost:5001 | ||
# browser: ${{ matrix.browser }} | ||
browser: chrome | ||
# FIXME: check code coverage | ||
parallel: true | ||
group: 'e2e_${{ matrix.browser }}' | ||
headless: true | ||
record: true | ||
env: | ||
# DEBUG: cypress:webpack | ||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_ENV: test | ||
DATABASE_URL: 'postgresql://postgres:password@postgres-service:5432/postgres' | ||
DATABASE_SCHEMA: test_${{ matrix.browser }}_${{ matrix.containers }} | ||
IS_DOCKER: true | ||
# if tests fails save screenshots | ||
- name: Save screenshots on failure | ||
uses: actions/[email protected] | ||
if: failure() | ||
with: | ||
name: cypress-screenshots | ||
path: cypress/screenshots | ||
# if tests success save videos and coverage | ||
- name: Save videos | ||
uses: actions/[email protected] | ||
if: always() | ||
with: | ||
name: cypress-videos | ||
path: cypress/videos | ||
# TODO: e2e coverage | ||
- name: Save Coverage | ||
if: ${{ success() }} | ||
uses: actions/[email protected] | ||
with: | ||
name: coverage-cypress | ||
path: | | ||
coverage | ||
# if tests success save videos and coverage | ||
# - name: Merge coverage from different processes | ||
# if tests success save videos and coverage | ||
# - name: Save e2e-coverage | ||