Skip to content

Commit

Permalink
Add Code Coverage to CI (#5)
Browse files Browse the repository at this point in the history
Add Code Coverage Tracker
  • Loading branch information
jordan-rash authored Aug 20, 2024
2 parents b5e8042 + 8354166 commit 53c96b6
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions .github/workflows/ltb.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Lint | Test
name: Lint | Test

on:
pull_request:
branches: [ "main" ]
branches:
- "main"
push:
branches:
- 'main'

env:
GO_VER: '1.22.4'

permissions:
# Required: allow read access to the content for analysis.
contents: read
# Optional: allow write access to checks to allow the action to annotate code in the PR.
checks: write

contents: read # allow read access to the content for analysis.
checks: write # allow write access to checks to allow the action to annotate code in the PR.
actions: read # to download code coverage results from "test" job
pull-requests: write # write permission needed to comment on PR

jobs:
lint:
Expand Down Expand Up @@ -54,3 +59,27 @@ jobs:
name: Run test suite
run: |
go test $(go list ./...)
-
name: Run Cover Profile
if: runner.os == 'Linux'
run: |
go test -cover -coverprofile=coverage.txt $(go list ./...)
-
name: Archive code coverage results
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage.txt

code_coverage:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'pull_request'
steps:
-
name: Go Code Coverage
uses: fgrosse/[email protected]
with:
coverage-artifact-name: "code-coverage"
coverage-file-name: "coverage.txt"

0 comments on commit 53c96b6

Please sign in to comment.