name: codecov
on: [push, pull_request]

permissions:
  contents: read

jobs:
  upload:
    runs-on: ubuntu-latest
    steps:
      - name: Install checkout
        uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

      - name: Install checkout
        uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
        with:
          go-version: "stable"

      - name: Run coverage
        run: go test -coverprofile=coverage.out -coverpkg=./... ./...

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6
