[feat] Add comprehensive caching to CI/CD workflows

- Add ESLint cache (.eslintcache) to auto-fix and fork PR workflows
- Add npm cache to all Node.js setup steps across workflows
- Add Vite build cache (node_modules/.vite) to improve build performance
- Add Playwright browser cache with version-specific keys
- Optimize test-ui, vitest, release, and auto-fix workflows

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
snomiao
2025-08-14 13:45:29 +00:00
parent b87a251e6b
commit 2e6bf4896e
4 changed files with 67 additions and 6 deletions

View File

@@ -18,7 +18,16 @@ jobs:
- name: Setup ComfyUI Frontend and Backend
uses: Comfy-Org/ComfyUI_frontend_setup_action@v2.3
# Step 1: Run lint and format fixes
# Step 1: Cache ESLint for better performance
- name: Cache ESLint
uses: actions/cache@v4
with:
path: ComfyUI_frontend/.eslintcache
key: ${{ runner.os }}-eslint-${{ hashFiles('ComfyUI_frontend/eslint.config.js', 'ComfyUI_frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-eslint-
# Step 2: Run lint and format fixes
- name: Run ESLint with auto-fix
run: npm run lint:fix
working-directory: ComfyUI_frontend
@@ -27,7 +36,7 @@ jobs:
run: npm run format
working-directory: ComfyUI_frontend
# Step 2: Update locales (only if there are relevant changes)
# Step 3: Update locales (only if there are relevant changes)
- name: Check if locale updates needed
id: check-locale-changes
run: |
@@ -63,7 +72,7 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
working-directory: ComfyUI_frontend
# Step 3: Check for any changes from both lint-format and locale updates
# Step 4: Check for any changes from both lint-format and locale updates
- name: Check for changes
id: verify-changed-files
run: |
@@ -77,7 +86,7 @@ jobs:
fi
working-directory: ComfyUI_frontend
# Step 4: Commit all changes in a single commit
# Step 5: Commit all changes in a single commit
- name: Commit auto-fixes and locale updates
if: steps.verify-changed-files.outputs.changed == 'true'
run: |
@@ -94,7 +103,7 @@ jobs:
git push origin HEAD:${{ github.head_ref }}
working-directory: ComfyUI_frontend
# Step 5: Run final validation
# Step 6: Run final validation
- name: Final validation
run: |
npm run lint
@@ -102,7 +111,7 @@ jobs:
npm run knip
working-directory: ComfyUI_frontend
# Step 6: Comment on PR about what was fixed
# Step 7: Comment on PR about what was fixed
- name: Comment on PR about auto-fixes
if: steps.verify-changed-files.outputs.changed == 'true'
uses: actions/github-script@v7
@@ -149,6 +158,14 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Cache ESLint
uses: actions/cache@v4
with:
path: .eslintcache
key: ${{ runner.os }}-eslint-fork-${{ hashFiles('eslint.config.js', 'package-lock.json') }}
restore-keys: |
${{ runner.os }}-eslint-fork-
- name: Check linting and formatting
id: check-lint-format
run: |

View File

@@ -22,6 +22,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'
- name: Get current version
id: current_version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
@@ -34,6 +35,13 @@ jobs:
else
echo "is_prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Cache Vite build
uses: actions/cache@v4
with:
path: node_modules/.vite
key: ${{ runner.os }}-vite-release-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-vite-release-
- name: Build project
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
@@ -117,6 +125,7 @@ jobs:
with:
node-version: 'lts/*'
registry-url: https://registry.npmjs.org
cache: 'npm'
- run: npm ci
- run: npm run build:types
- name: Publish package

View File

@@ -35,6 +35,16 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'
cache-dependency-path: ComfyUI_frontend/package-lock.json
- name: Cache Vite build
uses: actions/cache@v4
with:
path: ComfyUI_frontend/node_modules/.vite
key: ${{ runner.os }}-vite-build-${{ hashFiles('ComfyUI_frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-vite-build-
- name: Build ComfyUI_frontend
run: |
@@ -92,7 +102,23 @@ jobs:
wait-for-it --service 127.0.0.1:8188 -t 600
working-directory: ComfyUI
- name: Get Playwright version
id: playwright-version
run: echo "version=$(npm list @playwright/test --depth=0 --json | jq -r '.dependencies["@playwright/test"].version')" >> $GITHUB_OUTPUT
working-directory: ComfyUI_frontend
- name: Cache Playwright browsers
uses: actions/cache@v4
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}-chromium
restore-keys: |
${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}-
${{ runner.os }}-playwright-
- name: Install Playwright Browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install chromium --with-deps
working-directory: ComfyUI_frontend

View File

@@ -17,10 +17,19 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Cache Vite
uses: actions/cache@v4
with:
path: node_modules/.vite
key: ${{ runner.os }}-vite-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-vite-
- name: Run Vitest tests
run: |
npm run test:component