buster/.github/workflows/ci.yml

87 lines
2.3 KiB
YAML

name: CI
on:
pull_request:
env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_REMOTE_ONLY: true
jobs:
ci:
name: Build, Lint & Test
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- 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
# Remove cache here since we're using stickydisk for pnpm store
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Mount pnpm store sticky disk
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-pnpm-store
path: ${{ env.STORE_PATH }}
- name: Mount Turbo cache sticky disk
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-turbo-cache
path: ./.turbo
- name: Check if lockfile changed
id: lockfile-check
run: |
if git diff HEAD~1 HEAD --name-only | grep -q "pnpm-lock.yaml"; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Fetch dependencies (if lockfile changed)
if: steps.lockfile-check.outputs.changed == 'true'
run: pnpm fetch --frozen-lockfile
- 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
- name: Lint all packages (excluding web)
run: pnpm lint --filter='!@buster-app/web'
- 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