From 62a3155cce5e5f50d90c563e2bf1874ed277ddb4 Mon Sep 17 00:00:00 2001 From: ethernet Date: Wed, 29 Jul 2026 06:52:33 -0400 Subject: [PATCH] ci: cache npm deps better avoid reinstalling every time --- .github/workflows/deploy-site.yml | 31 +++++++++++++++----------- .github/workflows/docs-site-checks.yml | 11 ++++++--- .github/workflows/e2e-desktop.yml | 9 +++++++- .github/workflows/js-autofix.yml | 8 ++++++- .github/workflows/js-tests.yml | 20 +++++++++++++++-- 5 files changed, 59 insertions(+), 20 deletions(-) diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml index e44a12301ef8..bf2ceca837b8 100644 --- a/.github/workflows/deploy-site.yml +++ b/.github/workflows/deploy-site.yml @@ -54,7 +54,7 @@ jobs: name: github-pages url: ${{ steps.deploy.outputs.page_url }} steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Get GitHub App token id: app-token @@ -63,13 +63,24 @@ jobs: client-id: ${{ vars.APP_CLIENT_ID }} private-key: ${{ secrets.APP_PRIVATE_KEY }} - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22 - cache: npm - cache-dependency-path: website/package-lock.json - - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 + - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + id: npm-cache + with: + path: website/node_modules + key: node-modules-cache-${{ hashFiles('website/package-lock.json') }} + + - name: Install website dependencies + uses: ./.github/actions/retry + with: + command: npm ci + working-directory: website + if: steps.npm-cache.outputs.cache-hit != 'true' + + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: '3.11' @@ -160,12 +171,6 @@ jobs: - name: Regenerate per-skill docs pages + catalogs run: python3 website/scripts/generate-skill-docs.py - - name: Install dependencies - uses: ./.github/actions/retry - with: - command: npm ci - working-directory: website - - name: Build Docusaurus run: npm run build working-directory: website @@ -186,10 +191,10 @@ jobs: fi - name: Upload artifact - uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3 + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3 with: path: _site - name: Deploy to GitHub Pages id: deploy - uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 diff --git a/.github/workflows/docs-site-checks.yml b/.github/workflows/docs-site-checks.yml index 419706711bc5..2bd4c03192a8 100644 --- a/.github/workflows/docs-site-checks.yml +++ b/.github/workflows/docs-site-checks.yml @@ -16,18 +16,23 @@ jobs: - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22 - cache: npm - cache-dependency-path: website/package-lock.json + + - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + id: npm-cache + with: + path: website/node_modules + key: node-modules-cache-${{ hashFiles('website/package-lock.json') }} - name: Install website dependencies uses: ./.github/actions/retry with: command: npm ci working-directory: website + if: steps.npm-cache.outputs.cache-hit != 'true' - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: - python-version: "3.11" + python-version: '3.11' - name: Install ascii-guard uses: ./.github/actions/retry diff --git a/.github/workflows/e2e-desktop.yml b/.github/workflows/e2e-desktop.yml index 389cdc5caf3e..147c8ec5065e 100644 --- a/.github/workflows/e2e-desktop.yml +++ b/.github/workflows/e2e-desktop.yml @@ -33,13 +33,20 @@ jobs: - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22 - cache: npm + + - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + id: npm-cache + with: + path: node_modules + key: node-modules-cache-${{ hashFiles('package-lock.json') }} + # Full npm ci (not --ignore-scripts): electron's postinstall # downloads the binary we launch, and node-pty's native build is # needed for the terminal pane. - uses: ./.github/actions/retry with: command: npm ci + if: steps.npm-cache.outputs.cache-hit != 'true' # ── Python (for the hermes serve backend) ────────────────────────── - name: Install uv diff --git a/.github/workflows/js-autofix.yml b/.github/workflows/js-autofix.yml index 151966359b2d..d831209b9043 100644 --- a/.github/workflows/js-autofix.yml +++ b/.github/workflows/js-autofix.yml @@ -68,12 +68,18 @@ jobs: - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22 - cache: npm + + - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + id: npm-cache + with: + path: node_modules + key: node-modules-cache-${{ hashFiles('package-lock.json') }} # --ignore-scripts: eslint only needs TS sources + eslint packages. - uses: ./.github/actions/retry with: command: npm ci --ignore-scripts + if: steps.npm-cache.outputs.cache-hit != 'true' - name: npm run fix in all workspaces # continue-on-error: if un-fixable errors exist on main, we still want diff --git a/.github/workflows/js-tests.yml b/.github/workflows/js-tests.yml index 027f790ce352..c7c8bf4ca2cf 100644 --- a/.github/workflows/js-tests.yml +++ b/.github/workflows/js-tests.yml @@ -16,10 +16,18 @@ jobs: - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22 - cache: npm + + - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + id: npm-cache + with: + path: node_modules + key: node-modules-cache-${{ hashFiles('package-lock.json') }} + - uses: ./.github/actions/retry with: command: npm ci --ignore-scripts + if: steps.npm-cache.outputs.cache-hit != 'true' + - id: set-matrix run: | node -e ' @@ -62,10 +70,18 @@ jobs: - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22 - cache: npm + + - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 + id: npm-cache + with: + path: node_modules + key: node-modules-cache-${{ hashFiles('package-lock.json') }} + - uses: ./.github/actions/retry with: command: npm ci + if: steps.npm-cache.outputs.cache-hit != 'true' + - uses: ./.github/actions/profile with: label: js-${{ matrix.package }}-${{ matrix.script }}