From 93ad0ae03681d4d99f7a2c78bff6235f5c7dc208 Mon Sep 17 00:00:00 2001 From: Oscar Dominguez Date: Wed, 13 Oct 2021 09:34:58 +0200 Subject: [PATCH] ci(workflow): add cache to workflows using actions/setup-node (#43830) --- .github/workflows/codesee-arch-diagram.yml | 1 + .github/workflows/node.js-tests-upcoming.yml | 15 +------ .github/workflows/node.js-tests.yml | 43 ++------------------ 3 files changed, 5 insertions(+), 54 deletions(-) diff --git a/.github/workflows/codesee-arch-diagram.yml b/.github/workflows/codesee-arch-diagram.yml index 383168a90f..81b2d555de 100644 --- a/.github/workflows/codesee-arch-diagram.yml +++ b/.github/workflows/codesee-arch-diagram.yml @@ -41,6 +41,7 @@ jobs: if: ${{ fromJSON(steps.detect-languages.outputs.languages).javascript }} with: node-version: '14' + cache: npm - name: Configure Python 3.x uses: actions/setup-python@v2 diff --git a/.github/workflows/node.js-tests-upcoming.yml b/.github/workflows/node.js-tests-upcoming.yml index 39e18b41d3..a799cb75ad 100644 --- a/.github/workflows/node.js-tests-upcoming.yml +++ b/.github/workflows/node.js-tests-upcoming.yml @@ -9,7 +9,6 @@ on: # run this Action every 14 days - cron: '0 * */14 * *' workflow_dispatch: - jobs: lint: name: Lint @@ -59,19 +58,7 @@ jobs: uses: actions/setup-node@v2 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 }}- + cache: npm - name: Set Environment variables run: | diff --git a/.github/workflows/node.js-tests.yml b/.github/workflows/node.js-tests.yml index ebcdfe676a..2664f32ae4 100644 --- a/.github/workflows/node.js-tests.yml +++ b/.github/workflows/node.js-tests.yml @@ -4,7 +4,6 @@ on: branches-ignore: - 'renovate/**' pull_request: - jobs: lint: name: Lint @@ -51,19 +50,7 @@ jobs: uses: actions/setup-node@v2 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 }}- + cache: npm - name: Set Environment variables run: cp sample.env .env @@ -94,19 +81,7 @@ jobs: uses: actions/setup-node@v2 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 }}- + cache: npm - name: Set Environment variables run: | @@ -140,19 +115,7 @@ jobs: uses: actions/setup-node@v2 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 }}- + cache: npm - name: Set Environment variables run: cp sample.env .env