name: CI
run-name: CI (${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }})

permissions: {}

on:
  pull_request:
  push:
    branches:
      - main

jobs:
  test:
    timeout-minutes: 10
    permissions:
      contents: read
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
        with:
          persist-credentials: false
      - uses: ./.github/actions/setup
      - run: go test ./...

  build:
    timeout-minutes: 10
    permissions:
      contents: read
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
        with:
          persist-credentials: false
      - uses: ./.github/actions/setup
      - run: goreleaser check
      - run: goreleaser release --snapshot --clean

  lint:
    timeout-minutes: 10
    permissions:
      contents: read
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
        with:
          persist-credentials: false
      - uses: ./.github/actions/setup
      - name: lint
        run: golangci-lint run --verbose ./...
