name: CI

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  coverage:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: .ruby-version
          bundler-cache: true

      - name: Bootstrap
        run: bin/bootstrap

      - name: Coverage
        run: bundle exec bake coverage

  lint:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: .ruby-version
          bundler-cache: true

      - name: Bootstrap
        run: bin/bootstrap

      - name: Lint
        run: bundle exec bake lint

  debug:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: .ruby-version
          bundler-cache: true

      - name: Bootstrap
        run: bin/bootstrap

      - name: Debug Build
        run: bundle exec bake debug
