mirror of https://github.com/buster-so/buster.git
163 lines
4.6 KiB
YAML
163 lines
4.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
|
|
# Cancel in-progress runs when a new commit is pushed to the same PR
|
|
concurrency:
|
|
group: ci-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CI: true
|
|
|
|
jobs:
|
|
# Build job - runs in parallel
|
|
build:
|
|
name: Build
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
timeout-minutes: 10
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 9.15.0
|
|
|
|
- name: Setup Node.js
|
|
uses: useblacksmith/setup-node@v5
|
|
with:
|
|
node-version: 22
|
|
cache: 'pnpm'
|
|
|
|
- name: Fix pnpm store permissions
|
|
run: |
|
|
STORE_PATH=$(pnpm store path --silent)
|
|
if [ -d "$STORE_PATH" ]; then
|
|
# Clear corrupted cache entries
|
|
find "$STORE_PATH" -type f ! -perm -u+r -delete 2>/dev/null || true
|
|
find "$STORE_PATH" -type d ! -perm -u+rx -delete 2>/dev/null || true
|
|
# Fix permissions on remaining files
|
|
sudo chown -R $(whoami):$(whoami) "$STORE_PATH" || true
|
|
chmod -R u+rw "$STORE_PATH" || true
|
|
fi
|
|
|
|
- name: Mount Turbo cache sticky disk
|
|
uses: useblacksmith/stickydisk@v1
|
|
with:
|
|
key: ${{ github.repository }}-turbo-cache
|
|
path: ./.turbo
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile --prefer-offline
|
|
|
|
- name: Build all packages (excluding web)
|
|
run: pnpm build --filter='!@buster-app/web'
|
|
env:
|
|
NODE_ENV: production
|
|
|
|
# Lint job - runs in parallel
|
|
lint:
|
|
name: Lint
|
|
runs-on: blacksmith-2vcpu-ubuntu-2404
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 9.15.0
|
|
|
|
- name: Setup Node.js
|
|
uses: useblacksmith/setup-node@v5
|
|
with:
|
|
node-version: 22
|
|
cache: 'pnpm'
|
|
|
|
- name: Fix pnpm store permissions
|
|
run: |
|
|
STORE_PATH=$(pnpm store path --silent)
|
|
if [ -d "$STORE_PATH" ]; then
|
|
# Clear corrupted cache entries
|
|
find "$STORE_PATH" -type f ! -perm -u+r -delete 2>/dev/null || true
|
|
find "$STORE_PATH" -type d ! -perm -u+rx -delete 2>/dev/null || true
|
|
# Fix permissions on remaining files
|
|
sudo chown -R $(whoami):$(whoami) "$STORE_PATH" || true
|
|
chmod -R u+rw "$STORE_PATH" || true
|
|
fi
|
|
|
|
- name: Mount Turbo cache sticky disk
|
|
uses: useblacksmith/stickydisk@v1
|
|
with:
|
|
key: ${{ github.repository }}-turbo-cache
|
|
path: ./.turbo
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile --prefer-offline
|
|
|
|
- name: Lint all packages (excluding web)
|
|
run: pnpm lint --filter='!@buster-app/web'
|
|
|
|
# Test job - runs after build completes
|
|
test:
|
|
name: Test
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
timeout-minutes: 15
|
|
needs: build
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: 9.15.0
|
|
|
|
- name: Setup Node.js
|
|
uses: useblacksmith/setup-node@v5
|
|
with:
|
|
node-version: 22
|
|
cache: 'pnpm'
|
|
|
|
- name: Fix pnpm store permissions
|
|
run: |
|
|
STORE_PATH=$(pnpm store path --silent)
|
|
if [ -d "$STORE_PATH" ]; then
|
|
# Clear corrupted cache entries
|
|
find "$STORE_PATH" -type f ! -perm -u+r -delete 2>/dev/null || true
|
|
find "$STORE_PATH" -type d ! -perm -u+rx -delete 2>/dev/null || true
|
|
# Fix permissions on remaining files
|
|
sudo chown -R $(whoami):$(whoami) "$STORE_PATH" || true
|
|
chmod -R u+rw "$STORE_PATH" || true
|
|
fi
|
|
|
|
- name: Mount Turbo cache sticky disk
|
|
uses: useblacksmith/stickydisk@v1
|
|
with:
|
|
key: ${{ github.repository }}-turbo-cache
|
|
path: ./.turbo
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile --prefer-offline
|
|
|
|
- name: Build required packages
|
|
run: pnpm build --filter='!@buster-app/web'
|
|
env:
|
|
NODE_ENV: production
|
|
|
|
- name: Run all unit tests (excluding web)
|
|
run: pnpm test:unit --filter='!@buster-app/web'
|
|
|
|
- name: Upload test coverage
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: coverage
|
|
path: |
|
|
**/coverage/**
|
|
!**/coverage/tmp/**
|
|
retention-days: 7 |