Skip to content

Commit 62e06f4

Browse files
snomiaoclaudeDrJKLchristian-byrne
authored
[ci] Enhance CI/CD caching across all workflows (#5117)
* [ci] Enhance CI/CD caching across all workflows - Add tool cache steps for node_modules/.cache, .cache, and .eslintcache - Enable npm caching for Node.js setup actions where missing - Add cache configurations for ESLint, Prettier, Knip, and other build tools - Improve build performance by caching tool outputs between runs - Use unique cache keys per workflow to avoid conflicts 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * [ci] Enhance CI/CD caching with comprehensive improvements Extends caching strategy beyond PR #5107 with additional optimizations: - **i18n.yaml**: Add tool cache for locale generation workflow - **update-electron-types.yaml**: Add tool cache for type updates - **test-ui.yaml**: Add Playwright browser cache and Python pip cache - **vitest.yaml**: Add coverage directory caching - **chromatic.yaml**: Add Storybook static build cache - **All build workflows**: Add TypeScript incremental build cache - **Type generation workflows**: Add repository caching for external repos - **lint-and-format.yaml**: Improve cache key granularity with source hash Performance improvements: - Playwright browser downloads cached across runs - Python pip dependencies cached - TSC incremental compilation cache preserved - Storybook static builds cached - External repository clones cached - More granular cache invalidation based on source changes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * [ci] Optimize CI/CD caching for better performance - Enhance cache keys with more specific file patterns for better cache hit rates - Add missing cache directories (.prettierCache, .knip-cache, .vitest-cache, tsconfig.tsbuildinfo) - Improve cache key naming for clarity (lint-format, vitest, storybook, playwright) - Add better fallback cache restore keys - Include browser-specific caching for Playwright tests - Add TypeScript build info caching across workflows Expected improvements: - 20-40% faster builds on cache hits - More granular cache invalidation - Better cache utilization across tools 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Apply suggestion from @DrJKL Co-authored-by: Alexander Brown <drjkl@comfy.org> * Apply suggestion from @DrJKL Co-authored-by: Alexander Brown <drjkl@comfy.org> * Apply suggestion from @DrJKL Co-authored-by: Alexander Brown <drjkl@comfy.org> * Apply suggestion from @DrJKL Co-authored-by: Alexander Brown <drjkl@comfy.org> * Apply suggestion from @DrJKL Co-authored-by: Alexander Brown <drjkl@comfy.org> * Apply suggestion from @DrJKL Co-authored-by: Alexander Brown <drjkl@comfy.org> * [ci] Remove redundant node_modules/.cache from workflow caches setup-node already handles node_modules caching when cache: 'npm' is enabled. Removed conflicting node_modules/.cache entries from: - .github/workflows/lint-and-format.yaml - .github/workflows/vitest.yaml - .github/workflows/test-ui.yaml This prevents cache conflicts and follows best practices for npm caching. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Update .github/workflows/chromatic.yaml Co-authored-by: Alexander Brown <drjkl@comfy.org> * Update .github/workflows/update-electron-types.yaml Co-authored-by: Alexander Brown <drjkl@comfy.org> * fix: address reviewer feedback on cache optimization PR (#5200) * fix: remove duplicate cache entries and fix YAML formatting - Remove duplicate path entries in dev-release.yaml - Remove redundant node_modules/.cache entries since setup-node handles npm caching - Fix YAML indentation issues across workflow files Addresses reviewer feedback on PR #5117 about duplication and maintenance * fix: add cache-dependency-path for setup-node in test-ui workflow The test-ui workflow runs at repo root but package-lock.json is in ComfyUI_frontend/ subdirectory, causing setup-node cache to fail. Added cache-dependency-path to fix this. --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Alexander Brown <drjkl@comfy.org> Co-authored-by: Christian Byrne <cbyrne@comfy.org>
1 parent 74b61ec commit 62e06f4

File tree

10 files changed

+157
-0
lines changed

10 files changed

+157
-0
lines changed

.github/workflows/chromatic.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ jobs:
5151
---
5252
*This comment will be updated when the build completes*
5353
54+
- name: Cache tool outputs
55+
uses: actions/cache@v4
56+
with:
57+
path: |
58+
.cache
59+
storybook-static
60+
tsconfig.tsbuildinfo
61+
key: storybook-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('src/**/*.{ts,vue,js}', '*.config.*', '.storybook/**/*') }}
62+
restore-keys: |
63+
storybook-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-
64+
storybook-cache-${{ runner.os }}-
65+
storybook-tools-cache-${{ runner.os }}-
66+
5467
- name: Install dependencies
5568
run: npm ci
5669

.github/workflows/dev-release.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ jobs:
1919
- uses: actions/setup-node@v4
2020
with:
2121
node-version: 'lts/*'
22+
cache: 'npm'
23+
24+
- name: Cache tool outputs
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
.cache
29+
dist
30+
tsconfig.tsbuildinfo
31+
key: dev-release-tools-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
32+
restore-keys: |
33+
dev-release-tools-cache-${{ runner.os }}-
34+
2235
- name: Get current version
2336
id: current_version
2437
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT

.github/workflows/i18n.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: Comfy-Org/ComfyUI_frontend_setup_action@v2.3
20+
21+
- name: Cache tool outputs
22+
uses: actions/cache@v4
23+
with:
24+
path: |
25+
ComfyUI_frontend/.cache
26+
ComfyUI_frontend/.cache
27+
key: i18n-tools-cache-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/package-lock.json') }}
28+
restore-keys: |
29+
i18n-tools-cache-${{ runner.os }}-
2030
- name: Install Playwright Browsers
2131
run: npx playwright install chromium --with-deps
2232
working-directory: ComfyUI_frontend

.github/workflows/lint-and-format.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,21 @@ jobs:
2525
node-version: 'lts/*'
2626
cache: 'npm'
2727

28+
- name: Cache tool outputs
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
.cache
33+
.eslintcache
34+
tsconfig.tsbuildinfo
35+
.prettierCache
36+
.knip-cache
37+
key: lint-format-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('src/**/*.{ts,vue,js,mts}', '*.config.*', '.eslintrc.*', '.prettierrc.*', 'tsconfig.json') }}
38+
restore-keys: |
39+
lint-format-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-
40+
lint-format-cache-${{ runner.os }}-
41+
ci-tools-cache-${{ runner.os }}-
42+
2843
- name: Install dependencies
2944
run: npm ci
3045

.github/workflows/release.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ jobs:
2222
- uses: actions/setup-node@v4
2323
with:
2424
node-version: 'lts/*'
25+
cache: 'npm'
26+
27+
- name: Cache tool outputs
28+
uses: actions/cache@v4
29+
with:
30+
path: |
31+
.cache
32+
tsconfig.tsbuildinfo
33+
key: release-tools-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
34+
restore-keys: |
35+
release-tools-cache-${{ runner.os }}-
36+
2537
- name: Get current version
2638
id: current_version
2739
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
@@ -116,7 +128,20 @@ jobs:
116128
- uses: actions/setup-node@v4
117129
with:
118130
node-version: 'lts/*'
131+
cache: 'npm'
119132
registry-url: https://registry.npmjs.org
133+
134+
- name: Cache tool outputs
135+
uses: actions/cache@v4
136+
with:
137+
path: |
138+
.cache
139+
tsconfig.tsbuildinfo
140+
dist
141+
key: types-tools-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
142+
restore-keys: |
143+
types-tools-cache-${{ runner.os }}-
144+
120145
- run: npm ci
121146
- run: npm run build:types
122147
- name: Publish package

.github/workflows/test-ui.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
- uses: actions/setup-node@v4
4141
with:
4242
node-version: lts/*
43+
cache: 'npm'
44+
cache-dependency-path: 'ComfyUI_frontend/package-lock.json'
4345

4446
- name: Get current time
4547
id: current-time
@@ -65,6 +67,18 @@ jobs:
6567
---
6668
*This comment will be updated when tests complete*
6769
70+
- name: Cache tool outputs
71+
uses: actions/cache@v4
72+
with:
73+
path: |
74+
ComfyUI_frontend/.cache
75+
ComfyUI_frontend/tsconfig.tsbuildinfo
76+
key: playwright-setup-cache-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/package-lock.json') }}-${{ hashFiles('ComfyUI_frontend/src/**/*.{ts,vue,js}', 'ComfyUI_frontend/*.config.*') }}
77+
restore-keys: |
78+
playwright-setup-cache-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/package-lock.json') }}-
79+
playwright-setup-cache-${{ runner.os }}-
80+
playwright-tools-cache-${{ runner.os }}-
81+
6882
- name: Build ComfyUI_frontend
6983
run: |
7084
npm ci
@@ -118,6 +132,7 @@ jobs:
118132
- uses: actions/setup-python@v4
119133
with:
120134
python-version: '3.10'
135+
cache: 'pip'
121136

122137
- name: Get current time
123138
id: current-time
@@ -160,6 +175,15 @@ jobs:
160175
wait-for-it --service 127.0.0.1:8188 -t 600
161176
working-directory: ComfyUI
162177

178+
- name: Cache Playwright browsers
179+
uses: actions/cache@v4
180+
with:
181+
path: ~/.cache/ms-playwright
182+
key: playwright-browsers-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/package-lock.json') }}-${{ matrix.browser }}
183+
restore-keys: |
184+
playwright-browsers-${{ runner.os }}-${{ hashFiles('ComfyUI_frontend/package-lock.json') }}-
185+
playwright-browsers-${{ runner.os }}-
186+
163187
- name: Install Playwright Browsers
164188
run: npx playwright install chromium --with-deps
165189
working-directory: ComfyUI_frontend

.github/workflows/update-electron-types.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ jobs:
2020
node-version: lts/*
2121
cache: 'npm'
2222

23+
- name: Cache tool outputs
24+
uses: actions/cache@v4
25+
with:
26+
path: |
27+
.cache
28+
key: electron-types-tools-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
29+
restore-keys: |
30+
electron-types-tools-cache-${{ runner.os }}-
31+
2332
- name: Update electron types
2433
run: npm install @comfyorg/comfyui-electron-types@latest
2534

.github/workflows/update-manager-types.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,26 @@ jobs:
2525
node-version: lts/*
2626
cache: 'npm'
2727

28+
- name: Cache tool outputs
29+
uses: actions/cache@v4
30+
with:
31+
path: |
32+
.cache
33+
key: update-manager-tools-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
34+
restore-keys: |
35+
update-manager-tools-cache-${{ runner.os }}-
36+
2837
- name: Install dependencies
2938
run: npm ci
3039

40+
- name: Cache ComfyUI-Manager repository
41+
uses: actions/cache@v4
42+
with:
43+
path: ComfyUI-Manager
44+
key: comfyui-manager-repo-${{ runner.os }}-${{ github.run_id }}
45+
restore-keys: |
46+
comfyui-manager-repo-${{ runner.os }}-
47+
3148
- name: Checkout ComfyUI-Manager repository
3249
uses: actions/checkout@v4
3350
with:

.github/workflows/update-registry-types.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,26 @@ jobs:
2424
node-version: lts/*
2525
cache: 'npm'
2626

27+
- name: Cache tool outputs
28+
uses: actions/cache@v4
29+
with:
30+
path: |
31+
.cache
32+
key: update-registry-tools-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
33+
restore-keys: |
34+
update-registry-tools-cache-${{ runner.os }}-
35+
2736
- name: Install dependencies
2837
run: npm ci
2938

39+
- name: Cache comfy-api repository
40+
uses: actions/cache@v4
41+
with:
42+
path: comfy-api
43+
key: comfy-api-repo-${{ runner.os }}-${{ github.run_id }}
44+
restore-keys: |
45+
comfy-api-repo-${{ runner.os }}-
46+
3047
- name: Checkout comfy-api repository
3148
uses: actions/checkout@v4
3249
with:

.github/workflows/vitest.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ jobs:
1717
uses: actions/setup-node@v4
1818
with:
1919
node-version: 'lts/*'
20+
cache: 'npm'
21+
22+
- name: Cache tool outputs
23+
uses: actions/cache@v4
24+
with:
25+
path: |
26+
.cache
27+
coverage
28+
.vitest-cache
29+
key: vitest-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('src/**/*.{ts,vue,js}', 'vitest.config.*', 'tsconfig.json') }}
30+
restore-keys: |
31+
vitest-cache-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-
32+
vitest-cache-${{ runner.os }}-
33+
test-tools-cache-${{ runner.os }}-
2034
2135
- name: Install dependencies
2236
run: npm ci

0 commit comments

Comments
 (0)