-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
64 lines (57 loc) · 2 KB
/
action.yml
File metadata and controls
64 lines (57 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# https://docs.github.com/actions/reference/workflows-and-actions/metadata-syntax
# reusable composite action which does the following:
#
# 1. uses gwatts/go-coverage-action@v2 to create a Go test coverage
# profile file
#
# 2. runs `go run github.com/jbunds/coverage@latest` to generate a Go
# test coverage HTML report from the generated coverage profile
name: Go test coverage HTML report
description: Go test coverage HTML report generator
author: jbunds
branding:
icon: layout
color: blue
inputs:
go-version:
description: 'Go version to use'
required: false
default: '1.26.1'
go-mod:
description: 'path to the root go.mod file'
required: false
default: 'go.mod'
coverage-threshold:
description: 'coverage threshold percentage (gwatts/go-coverage-action)'
required: false
default: '0'
coverage-report-path:
description: 'path to the root of the Go coverage report'
required: false
default: 'coverage_report'
outputs:
all: # accessed downstream via ${{ fromJson(steps.coverage_report.outputs.all).report-pathname }} for example
description: JSON string containing all outputs from gwatts/go-coverage-action
value: ${{ toJson(steps.coverage_profile.outputs) }}
runs:
using: composite
steps:
- name: setup-go
id: setup_go
uses: actions/setup-go@v6
with:
cache: false # workaround https://github.com/actions/setup-go/issues/722
go-version: ${{ inputs.go-version }}
- name: coverage profile
id: coverage_profile
uses: gwatts/go-coverage-action@v2
with:
coverage-threshold: ${{ inputs.coverage-threshold }}
- name: coverage report
id: coverage_report
shell: bash
run: |
go run github.com/jbunds/coverage@latest \
-gomod="${{ inputs.go-mod }}" \
-coverprofile="${{ steps.coverage_profile.outputs.gocov-pathname }}" \
-path="${{ inputs.coverage-report-path }}"