From 85439a06472f6bc786aa9fda260472d836b0565e Mon Sep 17 00:00:00 2001 From: Buchi-Einstein Date: Wed, 5 Aug 2026 00:01:41 +0100 Subject: [PATCH] ci: cache node_modules and skip dependency download on cache hit --- .github/workflows/ci.yml | 50 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a618d72..34d1c10e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,15 @@ jobs: node-version: '20' cache: 'pnpm' - - name: Install dependencies + - name: Restore dependencies from cache + id: deps-cache + uses: actions/cache@v4 + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + + - name: Install dependencies (cache miss only) + if: steps.deps-cache.outputs.cache-hit != 'true' run: pnpm install --frozen-lockfile - name: Run Type Check @@ -43,7 +51,15 @@ jobs: node-version: '20' cache: 'pnpm' - - name: Install dependencies + - name: Restore dependencies from cache + id: deps-cache + uses: actions/cache@v4 + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + + - name: Install dependencies (cache miss only) + if: steps.deps-cache.outputs.cache-hit != 'true' run: pnpm install --frozen-lockfile - name: Run Lint @@ -64,7 +80,15 @@ jobs: node-version: '20' cache: 'pnpm' - - name: Install dependencies + - name: Restore dependencies from cache + id: deps-cache + uses: actions/cache@v4 + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + + - name: Install dependencies (cache miss only) + if: steps.deps-cache.outputs.cache-hit != 'true' run: pnpm install --frozen-lockfile - name: Validate UI @@ -89,7 +113,15 @@ jobs: node-version: '20' cache: 'pnpm' - - name: Install dependencies + - name: Restore dependencies from cache + id: deps-cache + uses: actions/cache@v4 + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + + - name: Install dependencies (cache miss only) + if: steps.deps-cache.outputs.cache-hit != 'true' run: pnpm install --frozen-lockfile - name: Run Build @@ -122,7 +154,15 @@ jobs: node-version: '20' cache: 'pnpm' - - name: Install dependencies + - name: Restore dependencies from cache + id: deps-cache + uses: actions/cache@v4 + with: + path: node_modules + key: node-modules-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + + - name: Install dependencies (cache miss only) + if: steps.deps-cache.outputs.cache-hit != 'true' run: pnpm install --frozen-lockfile - name: Run Tests