name: golangci-lint
on:
  push:
  pull_request:

permissions:
  contents: read
  # Optional: allow read access to pull requests. Use with `only-new-issues` option.
  # pull-requests: read

jobs:
  golangci:
    name: lint
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v4
      with:
        fetch-depth: 0 # all history for all branches and tags

    - uses: actions/setup-go@v6
      with:
        go-version-file: go.mod
        check-latest: true
        cache: false
        version: 1.24
    - name: golangci-lint
      uses: golangci/golangci-lint-action@v8
      with:
        version: v2.8.0

    - name: Build
      run: |
        cd pkg/ginserver
        go build -v ./...

    - name: Build
      run: |
        cd pkg/injector
        go build -v ./...

    - name: Build
      run: |
        cd pkg/logger
        go build -v ./...

    - name: Build
      run: |
        cd pkg/responses
        go build -v ./...

    - name: Build
      run: |
        cd pkg/validator
        go build -v ./...

    - name: Build
      run: |
        cd pkg/postgres
        go build -v ./...

    - name: Build
      run: |
        cd pkg/godog
        go build -v ./...