name: ci-bun-transpiler
on:
  push:
    branches: [main]
    paths:
      - 'packages/bun-transpiler/**'
  pull_request:
    branches: ['*']
    paths:
      - 'packages/bun-transpiler/**'

jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: oven-sh/setup-bun@v1
        with:
          bun-version: 1.1.32
      - run: yarn workspaces focus hono-middleware @hono/bun-transpiler
      - run: yarn workspace @hono/bun-transpiler build
      - run: yarn workspace @hono/bun-transpiler publint
      - run: yarn workspace @hono/bun-transpiler typecheck
      - run: yarn eslint packages/bun-transpiler
      - run: yarn prettier --check  . !packages packages/bun-transpiler
      - run: yarn workspace @hono/bun-transpiler test --coverage --coverage-reporter lcov
      - uses: codecov/codecov-action@v5
        with:
          fail_ci_if_error: true
          directory: ./packages/bun-transpiler/coverage
          flags: bun-transpiler
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
