Merge branch 'main' of https://github.com/avantifellows/quiz-frontend #579
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: CI | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
pre-commit: | |
name: Pre-commit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
- uses: pre-commit/[email protected] | |
unit-tests: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Dependencies | |
run: npm install | |
- name: Run Test Cases | |
# command to run tests and generate coverage metrics | |
run: npm run test:unit | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
flags: unittest,chrome | |
e2e-tests-chrome-desktop: | |
name: E2E tests on Chrome Desktop | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/Cypress | |
node_modules | |
key: my-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
- name: Install Cypress | |
run: npm i cypress | |
- name: Cypress run | |
uses: cypress-io/github-action@v3 | |
with: | |
browser: chrome | |
install: false | |
record: true | |
tag: chrome-desktop | |
start: npm run serve | |
wait-on: "http://localhost:8080" | |
env: | |
VUE_APP_BACKEND: http://127.0.0.1:8000 | |
VUE_APP_FORM_LAMBDA: ${{ secrets.VUE_APP_FORM_LAMBDA }} | |
# pass the Dashboard record key as an environment variable | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# pass GitHub token to allow accurately detecting a build vs a re-run build | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/cypress-io/github-action/issues/124#issuecomment-653180260 | |
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
flags: ui,chrome | |
e2e-tests-chrome-mobile: | |
name: E2E tests on Chrome Mobile | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/Cypress | |
node_modules | |
key: my-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
- name: Install Cypress | |
run: npm i cypress | |
- name: Cypress run | |
uses: cypress-io/github-action@v3 | |
with: | |
config: "viewportWidth=375,viewportHeight=667" | |
browser: chrome | |
install: false | |
record: true | |
tag: chrome-mobile | |
start: npm run serve | |
wait-on: "http://localhost:8080" | |
env: | |
VUE_APP_BACKEND: http://127.0.0.1:8000 | |
VUE_APP_FORM_LAMBDA: ${{ secrets.VUE_APP_FORM_LAMBDA }} | |
# pass the Dashboard record key as an environment variable | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# pass GitHub token to allow accurately detecting a build vs a re-run build | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/cypress-io/github-action/issues/124#issuecomment-653180260 | |
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} | |
install-cypress: | |
name: Install Cypress | |
runs-on: ubuntu-latest | |
container: cypress/browsers:node14.17.0-chrome88-ff89 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cypress install | |
uses: cypress-io/github-action@v3 | |
with: | |
runTests: false | |
e2e-tests-firefox-desktop: | |
name: E2E tests on Firefox Desktop | |
runs-on: ubuntu-latest | |
container: | |
image: cypress/browsers:node14.17.0-chrome88-ff89 | |
options: --user 1001 | |
needs: install-cypress | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/Cypress | |
node_modules | |
key: my-cache-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
- name: Install Cypress | |
run: npm i cypress | |
- name: Cypress run | |
uses: cypress-io/github-action@v3 | |
with: | |
browser: firefox | |
install: false | |
record: true | |
tag: firefox-desktop | |
start: npm run serve | |
wait-on: "http://localhost:8080" | |
env: | |
VUE_APP_BACKEND: http://127.0.0.1:8000 | |
VUE_APP_FORM_LAMBDA: ${{ secrets.VUE_APP_FORM_LAMBDA }} | |
# pass the Dashboard record key as an environment variable | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# pass GitHub token to allow accurately detecting a build vs a re-run build | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/cypress-io/github-action/issues/124#issuecomment-653180260 | |
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }} |