From 3ac415154cab22e039f39da23738faf5d27922a5 Mon Sep 17 00:00:00 2001 From: Mrugesh Mohapatra Date: Thu, 24 Sep 2020 23:21:45 +0530 Subject: [PATCH] chore(actions): cache dependencies --- .github/workflows/cypress.yml | 19 ++++++++++++----- .github/workflows/lighthouse-ci.yml | 13 ++++++++++++ .github/workflows/node.js-tests.yml | 32 ++++++++++++++++++++++++----- 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 30407fa8a3..8814c76fac 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -1,9 +1,5 @@ name: Cypress -on: - push: - pull_request: - branches: - - master +on: [push, pull_request] jobs: cypress-run: @@ -33,6 +29,19 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + 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: Set Environment variables run: cp sample.env .env diff --git a/.github/workflows/lighthouse-ci.yml b/.github/workflows/lighthouse-ci.yml index bc30f7ce98..124716b47d 100644 --- a/.github/workflows/lighthouse-ci.yml +++ b/.github/workflows/lighthouse-ci.yml @@ -32,6 +32,19 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + 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: Set Environment variables run: cp sample.env .env diff --git a/.github/workflows/node.js-tests.yml b/.github/workflows/node.js-tests.yml index 74c4b2668d..0e8351ec02 100644 --- a/.github/workflows/node.js-tests.yml +++ b/.github/workflows/node.js-tests.yml @@ -1,9 +1,5 @@ name: Node.js CI -on: - push: - pull_request: - branches: - - master +on: [push, pull_request] jobs: lint: @@ -23,6 +19,19 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + 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: Set Environment variables run: cp sample.env .env @@ -50,6 +59,19 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + 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: Set Environment variables run: cp sample.env .env