Optimize CI workflows for faster execution
Some checks failed
CI / test (push) Failing after 29s
CI / test (pull_request) Has been cancelled

Performance improvements:
- Cache node_modules in addition to ~/.npm to skip dependency installation
- Add TypeScript incremental compilation caching with tsBuildInfoFile
- Parallelize lint and typecheck steps to run concurrently
- Add performance flags: --prefer-offline, --no-audit, --no-fund for npm ci
- Increase Node.js memory limit to 4GB and thread pool size
- Cache build output directory for faster rebuilds
- Upgrade TypeScript target to ES2020 for faster compilation
- Disable Next.js telemetry to reduce overhead

Expected reduction: 5+ minutes → 2-3 minutes

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Derek Slenk 2025-07-18 00:09:25 -04:00
parent 01eb5c9712
commit 6465be819a
3 changed files with 56 additions and 13 deletions

View file

@ -20,7 +20,9 @@ jobs:
- name: Cache dependencies - name: Cache dependencies
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ~/.npm path: |
~/.npm
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: | restore-keys: |
${{ runner.os }}-node- ${{ runner.os }}-node-
@ -28,22 +30,42 @@ jobs:
- name: Cache Next.js build - name: Cache Next.js build
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ${{ github.workspace }}/.next/cache path: |
${{ github.workspace }}/.next/cache
${{ github.workspace }}/out
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.[jt]s', '**/*.[jt]sx') }} key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.[jt]s', '**/*.[jt]sx') }}
restore-keys: | restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
${{ runner.os }}-nextjs-
- name: Cache TypeScript
uses: actions/cache@v3
with:
path: |
tsconfig.tsbuildinfo
.next/types
key: ${{ runner.os }}-tsc-${{ hashFiles('tsconfig.json', 'src/**/*.ts', 'src/**/*.tsx') }}
restore-keys: |
${{ runner.os }}-tsc-
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci --prefer-offline --no-audit --no-fund
env:
NODE_OPTIONS: '--max-old-space-size=4096'
UV_THREADPOOL_SIZE: 16
- name: Run linting - name: Run linting and type checking in parallel
run: npm run lint run: |
npm run lint &
- name: Run type checking npm run typecheck &
run: npm run typecheck wait
env:
NODE_OPTIONS: '--max-old-space-size=4096'
- name: Build application - name: Build application
run: npm run build run: npm run build
env: env:
# Use empty string for YOUTUBE_API_KEY during CI build # Use empty string for YOUTUBE_API_KEY during CI build
YOUTUBE_API_KEY: "" YOUTUBE_API_KEY: ""
NODE_OPTIONS: '--max-old-space-size=4096'
NEXT_TELEMETRY_DISABLED: 1

View file

@ -19,7 +19,9 @@ jobs:
- name: Cache dependencies - name: Cache dependencies
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ~/.npm path: |
~/.npm
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: | restore-keys: |
${{ runner.os }}-node- ${{ runner.os }}-node-
@ -27,19 +29,37 @@ jobs:
- name: Cache Next.js build - name: Cache Next.js build
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ${{ github.workspace }}/.next/cache path: |
${{ github.workspace }}/.next/cache
${{ github.workspace }}/out
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.[jt]s', '**/*.[jt]sx') }} key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.[jt]s', '**/*.[jt]sx') }}
restore-keys: | restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
${{ runner.os }}-nextjs-
- name: Cache TypeScript
uses: actions/cache@v3
with:
path: |
tsconfig.tsbuildinfo
.next/types
key: ${{ runner.os }}-tsc-${{ hashFiles('tsconfig.json', 'src/**/*.ts', 'src/**/*.tsx') }}
restore-keys: |
${{ runner.os }}-tsc-
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci --prefer-offline --no-audit --no-fund
env:
NODE_OPTIONS: '--max-old-space-size=4096'
UV_THREADPOOL_SIZE: 16
- name: Build application - name: Build application
run: npm run build run: npm run build
env: env:
# Access YouTube API key from repository secrets # Access YouTube API key from repository secrets
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }} YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }}
NODE_OPTIONS: '--max-old-space-size=4096'
NEXT_TELEMETRY_DISABLED: 1
- name: Deploy to S3 (if configured) - name: Deploy to S3 (if configured)
run: | run: |

View file

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2017", "target": "ES2020",
"lib": ["dom", "dom.iterable", "esnext"], "lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true, "allowJs": true,
"skipLibCheck": true, "skipLibCheck": true,
@ -13,6 +13,7 @@
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "preserve",
"incremental": true, "incremental": true,
"tsBuildInfoFile": ".next/types/tsbuildinfo",
"plugins": [ "plugins": [
{ {
"name": "next" "name": "next"