Skip to content

Commit

Permalink
Update cicd.js.yml -remove node step, add artifact step, use correct …
Browse files Browse the repository at this point in the history
…params for running json server (#16)

* Update cicd.js.yml - cache-dependency path and string around cache path

* Update cicd.js.yml - typo in cache dependency path

* Update cicd.js.yml - fix another typo

* Update cicd.js.yml - comment out node step and add back npm ci

* Update cicd.js.yml - only install cypress for test job

* Update cicd.js.yml - add additional run command to test job for starting json-server

* Update cicd.js.yml - added screenshot artifact being saved on test failure

* Update cicd.js.yml - fixed cypress step to use correct action parameters
  • Loading branch information
TzolkinB authored Feb 16, 2024
1 parent 8d1dbd7 commit 53c59cc
Showing 1 changed file with 23 additions and 25 deletions.
48 changes: 23 additions & 25 deletions .github/workflows/cicd.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

defaults:
run:
working-directory: ./apps/
working-directory: ./apps

jobs:
install:
Expand All @@ -30,6 +30,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: apps/package-lock.json

- name: Cache NPM dependencies
uses: actions/cache@v3
Expand All @@ -49,22 +50,14 @@ jobs:
needs: install
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/cache@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# TODO: This step still not working since eslint not found message
#- name: Cache NPM dependencies
#uses: actions/cache@v3
#with:
# npm cache files are stored in `~/.npm`
#path: ~/.npm
#key: npm-${{ hashFiles('package-lock.json') }}
# Checks say "Cache restored successfully" but "npm run lint" still says eslint not found

# npm cache files are stored in `~/.npm`
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}

- name: Linting app
#working-directory: ./apps
run: | # remove npm ci once caching step works
run: |
npm ci
npm run lint
Expand All @@ -74,22 +67,27 @@ jobs:
needs: install
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/cache@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# TODO use install false once cache is working
#- uses: actions/cache@v3
#with:
# npm cache files are stored in `~/.npm`
#path: ~/.npm
#key: npm-${{ hashFiles('package-lock.json') }}
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
- name: Cypress E2E
uses: cypress-io/github-action@v6
with:
# install: false
working-directory: ./apps/
working-directory: ./apps
config: retries=1
# start parameter is used for starting the server, json-server is required for booklist tests
start: npm run server
# command parameter overwrites the Cypress run command with your custom command
command: npm run cy:run
- name: Artifacts
uses: actions/upload-artifact@v4
# store screenshots only on failures
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: warn


0 comments on commit 53c59cc

Please sign in to comment.