Update cicd.js.yml - cache-dependency path and string around cache path #59
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
# 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/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
cache-dependency-path: app/package-lock.json | |
# 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 | |
- name: Linting app | |
#working-directory: ./apps | |
#run: | # remove npm ci once caching step works | |
#npm ci | |
run: 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') }} | |
- name: Cypress E2E | |
uses: cypress-io/github-action@v6 | |
with: | |
# install: false | |
working-directory: ./apps/ | |
config: retries=1 | |
command: npm run cy:run | |