Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 17 additions & 162 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,189 +11,52 @@ 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
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 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: |
npx turbo lint type-check
- name: Run tests
run: |
# Set CI environment variable for optimized builds
touch packages/skin-database/config.js
export CI=true
pnpm --filter ani-cursor build
pnpm --filter winamp-eqf build
pnpm --filter webamp build-library
npx turbo test -- --maxWorkers=2
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
NODE_ENV: test
- name: Cache build artifacts for release
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
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:
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
Expand All @@ -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'
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules
.vscode
dist
dist

# Turborepo cache
.turbo
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,52 @@ Nullsoft, the code within this project is released under the [MIT
License](LICENSE.txt). That being said, if you do anything interesting with
this code, please let me know. I'd love to see it.

## Development

This repository uses [Turborepo](https://turbo.build/) for efficient monorepo management. Turborepo provides intelligent caching and parallel execution of tasks across all packages.

### Quick Start

```bash
# Install dependencies
pnpm install

# Build all packages (automatically handles dependencies)
npx turbo build

# Build library bundles for packages that need them
npx turbo build-library

# Run all tests
npx turbo test

# Lint and type-check all packages
npx turbo lint type-check

# Work on a specific package and its dependencies
npx turbo dev --filter="webamp"
```

### Package Dependencies

The monorepo dependency graph is automatically managed by Turborepo:

- `ani-cursor` and `winamp-eqf` are standalone packages built with TypeScript
- `webamp` depends on both `ani-cursor` and `winamp-eqf` for workspace linking
- All packages are built in the correct topological order
- Builds are cached and only rebuild what has changed

### Available Tasks

- `build` - Main build output (Vite for demos, TypeScript compilation for libraries)
- `build-library` - Library bundles for NPM publishing (only applies to `webamp`)
- `test` - Run unit tests with Jest
- `type-check` - TypeScript type checking without emitting files
- `lint` - ESLint code quality checks
- `dev` - Development server (for packages that support it)

For more details on individual packages, see their respective README files.

[techcrunch]: https://techcrunch.com/2018/02/09/whip-the-llamas-ass-with-this-javascript-winamp-emulator/
[motherboard]: https://motherboard.vice.com/en_us/article/qvebbv/winamp-2-mp3-music-player-emulator
[gizmodo]: https://gizmodo.com/winamp-2-has-been-immortalized-in-html5-for-your-pleasu-1655373653
Expand Down
9 changes: 1 addition & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,11 @@
"jest-environment-jsdom": "^29.7.0",
"prettier": "^2.3.2",
"stream-browserify": "^3.0.0",
"turbo": "^2.5.4",
"typescript": "^5.3.3"
},
"prettier": {
"trailingComma": "es5"
},
"jest": {
"projects": [
"config/jest.*.js",
"packages/ani-cursor",
"packages/winamp-eqf"
]
},
"dependencies": {},
"version": "0.0.0-next-87012d8d"
}
3 changes: 2 additions & 1 deletion packages/webamp-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"clsx": "^2.0.0",
"prism-react-renderer": "^2.3.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
"react-dom": "^19.0.0",
"webamp": "workspace:*"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.8.1",
Expand Down
Loading
Loading