Try Turborepo (#1304)

* Try Turborepo

* Add webamp as explicit dependency of docs

* Update pnpm lock

* Generate types as part of webamp build-library

* To many dashes
This commit is contained in:
Jordan Eldredge 2025-07-06 22:50:04 -07:00 committed by GitHub
parent 28c36e5141
commit f45736c0b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 195 additions and 175 deletions

View file

@ -11,32 +11,9 @@ on:
- "LICENSE.txt"
jobs:
# Fast job to install dependencies and cache them for other jobs
setup:
# Main CI job - using Turborepo for dependency management
ci:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-key.outputs.key }}
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9.12.0
- name: Generate cache key
id: cache-key
run: echo "key=node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}" >> $GITHUB_OUTPUT
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
# Build job - Vite build for demo site
build:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Install pnpm
@ -50,150 +27,36 @@ jobs:
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Vite Demo
- name: Build all packages
run: |
# Set CI environment variable for optimized builds
export CI=true
pnpm --filter ani-cursor build
pnpm --filter winamp-eqf build
pnpm --filter webamp build
npx turbo build build-library
env:
NODE_ENV: production
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: |
packages/ani-cursor/dist
packages/winamp-eqf/built
packages/webamp/dist
key: build-artifacts-${{ github.sha }}
# Build Library job - Rollup build for library bundles
build-library:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9.12.0
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Library Bundles
- name: Lint and type-check
run: |
# Set CI environment variable for optimized builds
export CI=true
pnpm --filter ani-cursor build
pnpm --filter winamp-eqf build
pnpm --filter webamp build-library
env:
NODE_ENV: production
- name: Cache library artifacts
uses: actions/cache@v4
with:
path: |
packages/ani-cursor/dist
packages/winamp-eqf/built
packages/webamp/built
key: library-artifacts-${{ github.sha }}
# Lint job - depends on build-library for type declarations
lint:
runs-on: ubuntu-latest
needs: [setup, build-library]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9.12.0
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Restore library artifacts
uses: actions/cache@v4
with:
path: |
packages/ani-cursor/dist
packages/winamp-eqf/built
packages/webamp/built
key: library-artifacts-${{ github.sha }}
fail-on-cache-miss: true
- name: Lint
run: |
pnpm lint
pnpm type-check
# Test job - waits for build artifacts
test:
runs-on: ubuntu-latest
needs: [setup, build]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9.12.0
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Restore build artifacts
uses: actions/cache@v4
with:
path: |
packages/ani-cursor/dist
packages/winamp-eqf/built
packages/webamp/dist
key: build-artifacts-${{ github.sha }}
fail-on-cache-miss: true
- name: Run Unit Tests
npx turbo lint type-check
- name: Run tests
run: |
touch packages/skin-database/config.js
# Run tests with optimizations for CI
export CI=true
pnpm test -- --maxWorkers=2
pnpm --filter webamp test -- --maxWorkers=2
npx turbo test -- --maxWorkers=2
env:
NODE_ENV: test
# - name: Run Integration Tests
# run: yarn workspace webamp integration-tests
# env:
# CI: true
# - name: Upload Screenshot Diffs
# if: failure()
# uses: actions/upload-artifact@v4
# with:
# name: image_diffs
# path: packages/webamp/js/__tests__/__image_snapshots__/__diff_output__/
# - name: Generate New Screenshots
# if: failure()
# run: |
# yarn workspace webamp integration-tests -u
# - name: Upload New Screenshots
# if: failure()
# uses: actions/upload-artifact@v4
# with:
# name: new_images
# path: packages/webamp/js/__tests__/__image_snapshots__/
main-release:
- name: Cache build artifacts for release
uses: actions/cache@v4
with:
path: |
packages/ani-cursor/dist
packages/winamp-eqf/built
packages/webamp/dist
key: release-artifacts-${{ github.sha }}
# Release job - publish packages to NPM
release:
name: Publish packages to NPM
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.repository == 'captbaritone/webamp'
needs: [build, build-library, lint, test]
needs: [ci]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
@ -214,16 +77,8 @@ jobs:
packages/ani-cursor/dist
packages/winamp-eqf/built
packages/webamp/dist
key: build-artifacts-${{ github.sha }}
fail-on-cache-miss: true
- name: Restore library artifacts
uses: actions/cache@v4
with:
path: |
packages/ani-cursor/dist
packages/winamp-eqf/built
packages/webamp/built
key: library-artifacts-${{ github.sha }}
key: release-artifacts-${{ github.sha }}
fail-on-cache-miss: true
- name: Set version for all packages
if: github.ref == 'refs/heads/master'