mirror of https://github.com/buster-so/buster.git
193 lines
4.9 KiB
YAML
193 lines
4.9 KiB
YAML
name: Build, Lint, and Unit Tests
|
|
|
|
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@v4
|
|
with:
|
|
version: 10.15.1
|
|
|
|
- name: Setup Node.js
|
|
uses: useblacksmith/setup-node@v5
|
|
with:
|
|
node-version: 22
|
|
cache: 'pnpm'
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
node_modules
|
|
apps/*/node_modules
|
|
packages/*/node_modules
|
|
key: pnpm-workspace-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
pnpm-workspace-
|
|
|
|
- name: Cache Turbo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: .turbo
|
|
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
|
|
restore-keys: |
|
|
turbo-${{ github.job }}-${{ github.ref_name }}-
|
|
turbo-${{ github.job }}-
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build all packages (excluding web)
|
|
run: |
|
|
pnpm turbo build --filter="!@buster-app/web"
|
|
pnpm turbo typecheck --filter=@buster-app/web
|
|
env:
|
|
NODE_ENV: production
|
|
SKIP_ENV_CHECK: true
|
|
TURBO_CACHE_DIR: .turbo
|
|
TURBO_TELEMETRY_DISABLED: 1
|
|
|
|
# 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@v4
|
|
with:
|
|
version: 10.15.1
|
|
|
|
- name: Setup Node.js
|
|
uses: useblacksmith/setup-node@v5
|
|
with:
|
|
node-version: 22
|
|
cache: 'pnpm'
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
node_modules
|
|
apps/*/node_modules
|
|
packages/*/node_modules
|
|
key: pnpm-workspace-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
pnpm-workspace-
|
|
|
|
- name: Cache Turbo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: .turbo
|
|
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
|
|
restore-keys: |
|
|
turbo-${{ github.job }}-${{ github.ref_name }}-
|
|
turbo-${{ github.job }}-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Lint all packages (excluding web)
|
|
run: pnpm turbo lint
|
|
env:
|
|
TURBO_CACHE_DIR: .turbo
|
|
TURBO_TELEMETRY_DISABLED: 1
|
|
|
|
# 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@v4
|
|
with:
|
|
version: 10.15.1
|
|
|
|
- name: Setup Node.js
|
|
uses: useblacksmith/setup-node@v5
|
|
with:
|
|
node-version: 22
|
|
cache: 'pnpm'
|
|
|
|
- name: Cache node_modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
node_modules
|
|
apps/*/node_modules
|
|
packages/*/node_modules
|
|
key: pnpm-workspace-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
pnpm-workspace-
|
|
|
|
- name: Cache Turbo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: .turbo
|
|
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
|
|
restore-keys: |
|
|
turbo-${{ github.job }}-${{ github.ref_name }}-
|
|
turbo-${{ github.job }}-
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build required packages
|
|
run: pnpm turbo build --filter="!@buster-app/web"
|
|
env:
|
|
NODE_ENV: production
|
|
SKIP_ENV_CHECK: true
|
|
TURBO_CACHE_DIR: .turbo
|
|
TURBO_TELEMETRY_DISABLED: 1
|
|
|
|
- name: Run all unit tests (excluding web)
|
|
run: pnpm turbo test:unit
|
|
env:
|
|
TURBO_CACHE_DIR: .turbo
|
|
TURBO_TELEMETRY_DISABLED: 1
|
|
|
|
- name: Upload test coverage
|
|
uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: coverage
|
|
path: |
|
|
**/coverage/**
|
|
!**/coverage/tmp/**
|
|
retention-days: 7 |