krystal/go-katapult

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
---
name: CI
on: [push]

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: "go.mod"
      - name: golangci-lint
        uses: golangci/golangci-lint-action@v6
        with:
          version: v1.59

  tidy:
    name: Tidy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: "go.mod"
      - name: Check if mods are tidy
        run: make check-tidy

  generate:
    name: Generate
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: "go.mod"
      - name: Check if generate results are up to date
        run: make check-generate

  cov:
    name: Coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version-file: "go.mod"
      - name: Publish coverage
        uses: paambaati/codeclimate-action@v8.0.0
        env:
          VERBOSE: "true"
          GOMAXPROCS: 4
          CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
        with:
          coverageCommand: make cov
          prefix: github.com/${{ github.repository }}
          coverageLocations: |
            ${{ github.workspace }}/coverage.out:gocov

  test:
    name: Test
    strategy:
      fail-fast: false
      matrix:
        go_version:
          - "1.20"
          - "1.21"
          - "1.22"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: "${{ matrix.go_version }}"
      - name: Run tests
        run: make test
        env:
          VERBOSE: "true"

  release-please:
    needs: [lint, tidy, generate, test]
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'
    steps:
      - uses: krystal/release-please-manifest-action@v1
        id: release-please
        with:
          app-id: ${{ vars.RELEASE_PLEASE_GITHUB_APP_ID }}
          private-key: ${{ secrets.RELEASE_PLEASE_GITHUB_APP_PRIVATE_KEY }}