Action for generating HTML files with Go coverage info using htmlcov.
Create file .github/workflows/htmlcov.yml
.
Add next code to it:
name: CI
on:
push:
branches: [master, develop]
pull_request:
branches: [master]
jobs:
HTMLCov:
name: HTMLCov
runs-on: ubuntu-latest
env:
SRC_DIR: src/github.com/${{ github.repository }}
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.18.x'
- name: Code checkout
uses: actions/checkout@v3
- name: Run tests
working-directory: ${{env.SRC_DIR}}
run: go test -coverprofile=covprofile ./...
- name: Check scripts with Shellcheck
uses: essentialkaos/htmlcov-action@v1
with:
path: ${{env.SRC_DIR}}
profile: covprofile
Option | Description | Value |
---|---|---|
profile |
Path to coverage profile | Path |
path |
Path to directory with sources | Path |
output |
Output artifact name (default: Coverage ) |
String |
version |
Version of HTMLCov | Version in semver notation |
retention |
Retention in days (default: 3 ) |
Number |