webamp/.github/workflows/ci.yml
Jordan Eldredge 0d53884fde Migrate from yarn to pnpm
This comprehensive migration includes:

### Configuration Updates
- Updated root package.json with pnpm workspace configuration
- Added packageManager field and pnpm overrides for graphql version
- Updated GitHub Actions workflows (.github/workflows/ci.yml, code-size.yml)
- Updated Netlify configuration (netlify.toml)
- Updated deployment script (deploy.sh)

### Documentation Updates
- Updated all README files to use pnpm instead of yarn
- Updated installation and build instructions across packages:
  - packages/webamp/README.md
  - packages/webamp-modern/README.md
  - packages/webamp-docs/README.md
  - packages/ani-cursor/README.md
  - packages/webamp/demo/readme.md

### Lock File Migration
- Removed yarn.lock
- Generated pnpm-lock.yaml preserving exact dependency versions
- Moved resolutions from skin-database package.json to root pnpm overrides
- Created pnpm-workspace.yaml for optimized workspace configuration

### CI/CD Updates
- Updated all yarn commands to use pnpm equivalents
- Changed yarn workspace commands to pnpm --filter syntax
- Updated cache keys to use pnpm-lock.yaml instead of yarn.lock
- Added pnpm/action-setup for GitHub Actions

### Validation
- Tested builds for webamp, webamp-modern, ani-cursor, webamp-docs
- Tested installation and linting for skin-database
- Verified dependency resolution consistency
- Confirmed all scripts work with pnpm

All package versions remain identical to yarn.lock, ensuring no breaking changes.
2025-07-06 13:20:28 -07:00

226 lines
6.8 KiB
YAML

name: CI
on:
push:
pull_request:
# Only run on pull requests that change relevant files
paths-ignore:
- "**.md"
- "docs/**"
- ".gitignore"
- "LICENSE.txt"
jobs:
# Fast job to install dependencies and cache them for other jobs
setup:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-key.outputs.key }}
steps:
- uses: actions/checkout@v4
- 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 pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- 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: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Vite Demo
run: |
# Set CI environment variable for optimized builds
export CI=true
pnpm --filter ani-cursor build
pnpm --filter webamp build
env:
NODE_ENV: production
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: |
packages/*/built
packages/*/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: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Library Bundles
run: |
# Set CI environment variable for optimized builds
export CI=true
pnpm --filter ani-cursor build
pnpm --filter webamp build-library
env:
NODE_ENV: production
- name: Cache library artifacts
uses: actions/cache@v4
with:
path: |
packages/webamp/built/*.js
packages/webamp/built/*.mjs
packages/webamp/built/*.map
packages/webamp/built/*.html
key: library-artifacts-${{ github.sha }}
# Lint job - runs in parallel
lint:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Lint
run: |
pnpm lint
pnpm --filter webamp type-check
# Test job - runs in parallel
test:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Run Unit 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
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: Publish to NPM
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.repository == 'captbaritone/webamp'
needs: [build, build-library, lint, test]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: https://registry.npmjs.org/
cache: "pnpm"
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Restore build artifacts
uses: actions/cache@v4
with:
path: |
packages/*/built
packages/*/dist
key: build-artifacts-${{ github.sha }}
fail-on-cache-miss: true
- name: Restore library artifacts
uses: actions/cache@v4
with:
path: |
packages/webamp/built/*.js
packages/webamp/built/*.mjs
packages/webamp/built/*.map
packages/webamp/built/*.html
key: library-artifacts-${{ github.sha }}
fail-on-cache-miss: true
- name: Set version
if: github.ref == 'refs/heads/master'
run: |
echo "Setting version to 0.0.0-next-${RELEASE_COMMIT_SHA::7}"
pnpm --filter webamp version --new-version 0.0.0-next-${RELEASE_COMMIT_SHA::7} --no-git-tag-version
env:
RELEASE_COMMIT_SHA: ${{ github.sha }}
- name: Build release version
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
run: exit 1 # TODO: Script to update version number in webampLazy.tsx
- name: Publish to npm
working-directory: ./packages/webamp
if: github.ref == 'refs/heads/master' || github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
# Use pre-built artifacts instead of rebuilding
run: |
npm publish ${TAG} --ignore-scripts
env:
TAG: ${{ github.ref == 'refs/heads/master' && '--tag=next' || ''}}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}