Skip to content

Commit 5d096cb

Browse files
authored
chore(nx): Debug nx caching (#465)
1 parent 6db44fd commit 5d096cb

15 files changed

Lines changed: 4391 additions & 132 deletions

.github/workflows/build-lint-test.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,13 @@ jobs:
3737

3838
- name: 🧪 Test
3939
run: yarn test-ci --minWorkers=1 --maxWorkers=${{ steps.cpu-cores.outputs.count }}
40+
41+
- name: 📁 Upload Cache Investigation Reports
42+
if: always()
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: cache-investigation-reports-${{ inputs.os }}-${{ github.run_id }}
46+
path: |
47+
packages/testing/.cache-investigation/*.json
48+
retention-days: 30
49+
continue-on-error: true
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Cache Investigation
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
investigation_type:
6+
description: 'Type of investigation to run'
7+
required: true
8+
default: 'quick'
9+
type: choice
10+
options:
11+
- quick
12+
- full
13+
- cache-only
14+
- env-only
15+
16+
jobs:
17+
investigate:
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 30
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
cache: 'yarn'
28+
29+
- name: ⬢ Enable Corepack
30+
run: npm install --global --force corepack
31+
32+
- name: Install dependencies
33+
env:
34+
GITHUB_TOKEN: ${{ github.token }}
35+
run: |
36+
yarn install --frozen-lockfile --inline-builds
37+
yarn --cwd packages/create-cedar-rsc-app install --inline-builds
38+
39+
- name: Run Cache Investigation
40+
env:
41+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
42+
YARN_ENABLE_HARDENED_MODE: 0
43+
run: |
44+
echo "🔍 Starting cache investigation: ${{ inputs.investigation_type }}"
45+
case "${{ inputs.investigation_type }}" in
46+
"quick")
47+
yarn tsx tasks/framework-tools/tarsync/debug-master.mts quick
48+
;;
49+
"full")
50+
yarn tsx tasks/framework-tools/tarsync/debug-master.mts all
51+
;;
52+
"cache-only")
53+
yarn tsx tasks/framework-tools/tarsync/debug-cache-investigation.mts
54+
;;
55+
"env-only")
56+
yarn tsx tasks/framework-tools/tarsync/debug-env-differences.mts
57+
;;
58+
esac
59+
60+
- name: Upload Investigation Reports
61+
uses: actions/upload-artifact@v4
62+
if: always()
63+
with:
64+
name: cache-investigation-reports
65+
path: |
66+
cache-investigation-report.json
67+
environment-analysis-report.json
68+
task-scheduling-report.json
69+
retention-days: 30
70+
71+
- name: Debug Investigation Failure
72+
if: failure()
73+
run: |
74+
echo "=== Investigation Debug Info ==="
75+
ls -la *-report.json || echo "No reports generated"
76+
df -h
77+
free -h
78+
echo "=== Nx Cache Status ==="
79+
ls -la .nx/cache || echo "No cache directory"
80+
echo "=== Directory structure ==="
81+
ls -la

.github/workflows/ci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,67 @@ jobs:
214214
with:
215215
os: ${{ matrix.os }}
216216

217+
cache-investigation:
218+
needs:
219+
- check
220+
- build-lint-test
221+
- tutorial-e2e
222+
- smoke-tests
223+
- smoke-tests-react-18
224+
- cli-smoke-tests
225+
- telemetry-check
226+
- rsc-smoke-tests
227+
- ssr-smoke-tests
228+
- fragments-smoke-tests
229+
- create-cedar-app
230+
- server-tests
231+
- background-jobs-e2e
232+
if: failure() && contains(github.event.head_commit.message, '[investigate]')
233+
234+
name: 🔍 Cache Investigation (on failure)
235+
runs-on: ubuntu-latest
236+
timeout-minutes: 30
237+
238+
steps:
239+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
240+
241+
- name: ⬢ Enable Corepack
242+
run: npm install --global --force corepack
243+
244+
- name: ⬢ Set up Node.js
245+
uses: actions/setup-node@v4
246+
with:
247+
node-version: 20
248+
cache: 'yarn'
249+
250+
- name: 🐈 Install dependencies
251+
env:
252+
GITHUB_TOKEN: ${{ github.token }}
253+
YARN_ENABLE_HARDENED_MODE: 0
254+
run: |
255+
yarn install --frozen-lockfile --inline-builds
256+
yarn --cwd packages/create-cedar-rsc-app install --inline-builds
257+
258+
- name: 🔍 Run Cache Investigation
259+
env:
260+
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
261+
YARN_ENABLE_HARDENED_MODE: 0
262+
run: |
263+
echo "🔍 Build failed, running cache investigation..."
264+
yarn tsx tasks/framework-tools/tarsync/debug-master.mts quick
265+
continue-on-error: true
266+
267+
- name: 📁 Upload Debug Reports
268+
if: always()
269+
uses: actions/upload-artifact@v4
270+
with:
271+
name: debug-reports-${{ github.run_id }}
272+
path: |
273+
cache-investigation-report.json
274+
environment-analysis-report.json
275+
task-scheduling-report.json
276+
retention-days: 30
277+
217278
ci-status-check:
218279
needs:
219280
- check

0 commit comments

Comments
 (0)