ci.yml•2.47 kB
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test-matrix:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 5
concurrency:
group: job-test-matrix-${{ matrix.os }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request'}}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Run lint
run: bun run lint
- name: Run tests
run: bun test
test:
name: Test
runs-on: ubuntu-latest
needs: test-matrix
if: always()
concurrency:
group: job-test-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request'}}
steps:
- name: Check test matrix status
run: |
if [ "${{ needs.test-matrix.result }}" != "success" ]; then
echo "Test matrix failed"
exit 1
fi
build-matrix:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 5
concurrency:
group: job-build-matrix-${{ matrix.os }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request'}}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
- name: Check build artifacts
run: bun run -e "import { existsSync } from 'fs'; if (!existsSync('dist/index.js')) { console.error('Build artifact not found'); process.exit(1); }"
build:
name: Build
runs-on: ubuntu-latest
needs: build-matrix
if: always()
concurrency:
group: job-build-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request'}}
steps:
- name: Check build matrix status
run: |
if [ "${{ needs.build-matrix.result }}" != "success" ]; then
echo "Build matrix failed"
exit 1
fi