From 7b7f0fd4fcffaef5f784c5581ca0d99af2ad6131 Mon Sep 17 00:00:00 2001 From: kamei Date: Tue, 7 Mar 2023 00:16:50 +0900 Subject: [PATCH] Improve node_module install (#584) --- .github/workflows/ci.yml | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b72137d1..a2aff39f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,15 +25,15 @@ jobs: node-version: ${{ matrix.node-version }} - name: Use cached node_modules + id: use_cached_node_modules uses: actions/cache@v3 with: path: node_modules - key: nodeModules-${{ hashFiles('yarn.lock') }}-${{ matrix.node-version }} - restore-keys: | - nodeModules- + key: nodeModules-${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }} - name: install - run: yarn install --frozen-lockfile + if: steps.use_cached_node_modules.outputs.cache-hit != 'true' + run: yarn install --frozen-lockfile --prefer-offline build: name: build @@ -52,13 +52,11 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Use cached node_modules + - name: Restore cached node_modules uses: actions/cache/restore@v3 with: path: node_modules - key: nodeModules-${{ hashFiles('yarn.lock') }}-${{ matrix.node-version }} - restore-keys: | - nodeModules- + key: nodeModules-${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }} - name: build run: | @@ -78,13 +76,11 @@ jobs: with: node-version: 18 - - name: Use cached node_modules + - name: Restore cached node_modules uses: actions/cache/restore@v3 with: path: node_modules - key: nodeModules-${{ hashFiles('yarn.lock') }}-18 - restore-keys: | - nodeModules- + key: nodeModules-18-${{ hashFiles('yarn.lock') }} - name: lint run: yarn lint @@ -102,13 +98,11 @@ jobs: with: node-version: 18 - - name: Use cached node_modules + - name: Restore cached node_modules uses: actions/cache/restore@v3 with: path: node_modules - key: nodeModules-${{ hashFiles('yarn.lock') }}-18 - restore-keys: | - nodeModules- + key: nodeModules-18-${{ hashFiles('yarn.lock') }} - name: typecheck run: yarn typecheck @@ -126,13 +120,11 @@ jobs: with: node-version: 18 - - name: Use cached node_modules + - name: Restore cached node_modules uses: actions/cache/restore@v3 with: path: node_modules - key: nodeModules-${{ hashFiles('yarn.lock') }}-18 - restore-keys: | - nodeModules- + key: nodeModules-18-${{ hashFiles('yarn.lock') }} - name: generate docs run: yarn generate:docs @@ -151,13 +143,11 @@ jobs: with: node-version: 18 - - name: Use cached node_modules + - name: Restore cached node_modules uses: actions/cache/restore@v3 with: path: node_modules - key: nodeModules-${{ hashFiles('yarn.lock') }}-18 - restore-keys: | - nodeModules- + key: nodeModules-18-${{ hashFiles('yarn.lock') }} - name: build for test run: yarn build