Don't let your test coverage drop
This action uses limgo to enforce test coverage thresholds.
You can use limgo-action
with the following configuration:
jobs:
build:
name: Test
runs-on: ubuntu-latest
steps:
# Checkout your project with git
- name: Checkout
uses: actions/checkout@v2
# Install Go on the VM running the action.
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
# Run your tests with -coverprofile
- name: Run tests
run: |
go test ./... -coverprofile=test.cov
# Option 1:
# Run the test coverage check using the limgo-action
- name: Run test coverage check
uses: GoTestTools/limgo-action@v1.0.0
with:
version: "v0.0.0-beta"
args: "-coverfile=test.cov -outfile=covcheck.tmp -config=.limgo.json -v=3"
# Option 2:
# Only install limgo and use it later
- name: Run test coverage check
uses: GoTestTools/limgo-action@v1.0.0
with:
version: "v0.0.0-beta"
install-only: true
# Optional:
# Upload the coverage check results as artifact
- name: Upload test coverage results
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: test-coverage-results
path: covcheck.tmp
if-no-files-found: error
For more information about limgo
please see the limgo repository.