ci: cache npm deps better

avoid reinstalling every time
This commit is contained in:
ethernet 2026-07-29 06:52:33 -04:00
parent ead990a048
commit 62a3155cce
5 changed files with 59 additions and 20 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 }}