diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index fb29c1a..54235eb 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,32 +1,25 @@ name: coverage -on: [push, pull_request] + +on: + push: + branches: + - "main" + pull_request: jobs: coverage: - strategy: - matrix: - go-version: [^1] - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} - env: - GO111MODULE: "on" + runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v4 - + - uses: actions/checkout@v4 - name: Install Go uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go-version }} - - - run: | - git config --global url."https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/charmbracelet".insteadOf "https://github.com/charmbracelet" - git config --global url."https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/charmcli".insteadOf "https://github.com/charmcli" - - - name: Coverage - env: - COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - go test -race -covermode atomic -coverprofile=profile.cov ./... - go install github.com/mattn/goveralls@latest - goveralls -coverprofile=profile.cov -service=github + go-version: "stable" + - name: Gather dependencies + run: go mod download + - name: Run coverage + run: go test -race -coverprofile=coverage.txt -covermode=atomic ./... + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_ORG_TOKEN }}