Skip to content

Instantly share code, notes, and snippets.

@vittorio-nardone
Created September 8, 2020 13:55
Show Gist options
  • Save vittorio-nardone/a041fc2a0ccf514d876c5ceb0c713ed9 to your computer and use it in GitHub Desktop.
Save vittorio-nardone/a041fc2a0ccf514d876c5ceb0c713ed9 to your computer and use it in GitHub Desktop.
AWS Amplify CI/CD pipeline with code linter (JS / Python) and Cypress end-to-end test
version: 1
backend:
phases:
build:
commands:
- '# Evaluate backend Python code quality'
- find amplify/backend/function -name index.py -type f | xargs pylint --fail-under=5 --rcfile=pylint.rc
- '# Execute Amplify CLI with the helper script'
- amplifyPush --simple
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npx eslint src/*.js
- npm run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
test:
artifacts:
baseDirectory: cypress
configFilePath: '**/mochawesome.json'
files:
- '**/*.png'
- '**/*.mp4'
phases:
preTest:
commands:
- npm install
- npm install wait-on
- npm install mocha mochawesome mochawesome-merge mochawesome-report-generator
- 'npm start & npx wait-on http://localhost:3000'
test:
commands:
- 'npx cypress run --reporter mochawesome --reporter-options "reportDir=cypress/report/mochawesome-report,overwrite=false,html=false,json=true,timestamp=mmddyyyy_HHMMss"'
postTest:
commands:
- npx mochawesome-merge ./cypress/report/mochawesome-report/mochawesome*.json > cypress/report/mochawesome.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment