Prijem z dohody #1604
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
name: Quality Assurance | |
on: | |
pull_request: | |
branches: [ master ] | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
with: | |
submodules: 'recursive' | |
- name: Read .nvmrc | |
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" | |
id: nvm | |
- name: Use Node.js (.nvmrc) | |
uses: actions/setup-node@master | |
with: | |
node-version: '${{ steps.nvm.outputs.NVMRC }}' | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules-and-next | |
with: | |
path: | | |
~/.yarn | |
~/.cache/Cypress | |
./node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile | |
- name: Lint | |
run: yarn lint | |
- name: Prettier | |
run: yarn prettier | |
- name: TypeScript | |
run: yarn check:ts | |
unit: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
with: | |
submodules: 'recursive' | |
- name: Read .nvmrc | |
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" | |
id: nvm | |
- name: Use Node.js (.nvmrc) | |
uses: actions/setup-node@master | |
with: | |
node-version: '${{ steps.nvm.outputs.NVMRC }}' | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules-and-next | |
with: | |
path: | | |
~/.yarn | |
~/.cache/Cypress | |
./node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile | |
- name: Unit Tests | |
run: yarn test --ci | |
functional: | |
name: Functional tests | |
runs-on: ubuntu-latest | |
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 multiple copies of the current job in parallel | |
# Cypress seems to run on all but one machines defined here | |
containers: [1, 2, 3, 4, 5] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
with: | |
submodules: 'recursive' | |
- name: Read .nvmrc | |
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" | |
id: nvm | |
- name: Use Node.js (.nvmrc) | |
uses: actions/setup-node@master | |
with: | |
node-version: '${{ steps.nvm.outputs.NVMRC }}' | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules-and-next | |
with: | |
path: | | |
~/.yarn | |
~/.cache/Cypress | |
./node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn build | |
# because of "record" and "parallel" parameters | |
# these containers will load balance all found tests among themselves | |
# https://github.com/cypress-io/github-action | |
- name: Cypress run | |
uses: cypress-io/github-action@v4 | |
with: | |
start: npm start | |
install: false | |
record: true | |
parallel: true | |
group: 'Functional Tests' | |
env: | |
PORT: 3000 | |
# pass the Dashboard record key as an environment variable | |
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 }} | |
# env vars for local server started via `npm start` | |
autoformtoken: ${{ secrets.AUTOFORMTOKEN }} | |
# navody.digital base url for redirect | |
NAVODY_BASE_URL: https://staging.navody.digital | |
- name: 'Upload Downloads Artifact' | |
uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: cypress-downloads-folder-${{ strategy.job-index }} | |
path: cypress/downloads/ | |
retention-days: 90 |