From 4ad4ef4985d48117295257cfc6cc2ff108e140d3 Mon Sep 17 00:00:00 2001 From: Gauthier Fiorentino Date: Thu, 14 Mar 2024 16:50:34 +0100 Subject: [PATCH] CI: Adds cache to node modules --- .github/workflows/build.yml | 4 +++- .github/workflows/tests.yml | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d80cb46..92f574b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,12 +15,14 @@ jobs: node-version: 18.12.1 cache: npm - name: Cache node modules + id: cache-packages uses: actions/cache@v3 with: path: ./node_modules key: ${{ hashFiles('package-lock.json') }} - name: Install - run: npm ci + if: ${{ steps.cache-packages.outputs.cache-hit != 'true' }} + run: npm ci --omit=dev - name: Build run: npm run build - name: Upload artifact diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5a09637..cadcfbb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,6 +14,12 @@ jobs: # TODO: add version to a .nvmrc or at least a variable node-version: 18.12.1 cache: npm + - name: Cache node modules + id: cache-packages + uses: actions/cache@v3 + with: + path: ./node_modules + key: ${{ hashFiles('package-lock.json') }} - name: Install run: npm ci - name: Run tests