Skip to content

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

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

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

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: CI/CD
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
defaults:
run:
working-directory: ./apps
jobs:
install:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: apps/package-lock.json
- name: Cache NPM dependencies
uses: actions/cache@v3
id: cache-npm
with:
# npm cache files are stored in `~/.npm`
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
- name: Install package-lock dependencies
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
lint:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
# npm cache files are stored in `~/.npm`
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
- name: Linting app
run: |
npm ci
npm run lint
test:
runs-on: ubuntu-latest
needs: install
steps:
- uses: actions/checkout@v3
#- uses: actions/setup-node@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') }}
- run: npm i [email protected]
- name: Cypress E2E
uses: cypress-io/github-action@v6
with:
install: false
working-directory: ./apps
config: retries=1
# server command starts the json-server required for booklist tests
command: |
npm run server
npm run cy:run