From e58c696e69454d7cd94ebeed257dad61f49f2db9 Mon Sep 17 00:00:00 2001 From: Francisco Giordano Date: Fri, 6 Nov 2020 23:39:56 -0300 Subject: [PATCH] Improve GitHub Actions node_modules caching --- .github/workflows/test.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d76128fc7..905efdf73 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,11 +14,13 @@ jobs: with: node-version: 10.x - uses: actions/cache@v2 + id: cache with: - path: ~/.npm - key: npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: npm- + path: '**/node_modules' + key: npm-v2-${{ hashFiles('**/package-lock.json') }} + restore-keys: npm-v2- - run: npm ci + if: steps.cache.outputs.cache-hit != 'true' - run: npm run lint - run: npm run test @@ -30,10 +32,12 @@ jobs: with: node-version: 10.x - uses: actions/cache@v2 + id: cache with: - path: ~/.npm - key: npm-${{ hashFiles('**/package-lock.json') }} - restore-keys: npm- + path: '**/node_modules' + key: npm-v2-${{ hashFiles('**/package-lock.json') }} + restore-keys: npm-v2- - run: npm ci + if: steps.cache.outputs.cache-hit != 'true' - run: npm run coverage - uses: codecov/codecov-action@v1