From bcf2313a34fc29794fb85f1a93d1fbec629a05dd Mon Sep 17 00:00:00 2001 From: GeopJr <18014039+GeopJr@users.noreply.github.com> Date: Tue, 30 Mar 2021 18:39:33 +0000 Subject: [PATCH] ci: cache node_modules (#6048) --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e04386fcc..12819d3e2a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,14 @@ jobs: - uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} + - id: npm-cache-dir + run: echo "::set-output name=dir::$(npm config get cache)" + - uses: actions/cache@v2 + id: npm-cache + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node- - run: npm install - run: npm test env: @@ -23,6 +31,14 @@ jobs: steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 + - id: npm-cache-dir + run: echo "::set-output name=dir::$(npm config get cache)" + - uses: actions/cache@v2 + id: npm-cache + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node- - run: 'npm i && npm run lint' Unit: runs-on: ${{ matrix.os }} @@ -33,4 +49,12 @@ jobs: steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 + - id: npm-cache-dir + run: echo "::set-output name=dir::$(npm config get cache)" + - uses: actions/cache@v2 + id: npm-cache + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: ${{ runner.os }}-node- - run: 'npm i && npm run test:unit'