forked from fgrosse/go-coverage-report
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
100 lines (87 loc) · 3.53 KB
/
action.yml
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: 'Go Unit Test Coverage Report'
description: 'Post Go code coverage reports to pull requests.'
author: "Friedrich Große"
branding:
icon: 'umbrella'
color: 'blue'
inputs:
version:
description: 'The exact version tag of the go-coverage-report tool to use.'
required: true
default: "v1.2.0"
sha256sum:
description: 'Optional SHA256 checksum of the tarball when downloading the go-coverage-report binary.'
required: false
coverage-artifact-name:
description: 'The name of the artifact containing the code coverage results.'
required: true
default: "code-coverage"
coverage-file-name:
description: 'The name of the file containing the code coverage results.'
required: true
default: "coverage.txt"
root-package:
description: |
The Go import path of the tested repository to add as a prefix to all paths of the
changed files. This is useful to map the changed files (e.g., ["foo/my_file.go"]
to their coverage profile which uses the full package name to identify the files
(e.g., "github.com/fgrosse/example/foo/my_file.go"). Note that currently,
packages with a different name than their directory are not supported.
required: false
default: "github.com/${{ github.repository }}"
skip-comment:
description: |
Skip creating or updating the pull request comment. This may be useful when you want
to generate the coverage report and modify it in your own scripts.
required: false
default: 'false'
trim:
description: Trim a prefix in the "Impacted Packages" column of the markdown report.
required: false
github-baseline-workflow-ref:
description: |
The ref of the GitHub actions Workflow that produces the baseline coverage.
By default, the GitHub Actions Workflow ref is used
(e.g. "octocat/hello-world/.github/workflows/my-workflow.yml@refs/heads/my_branch").
You can aso just pass the name of the Workflow file directly (e.g. "my-workflow.yml").
default: ${{ github.workflow_ref }}
required: false
outputs:
coverage_report:
description: 'The generated coverage report in Markdown format.'
value: ${{ steps.coverage.outputs.coverage_report }}
runs:
using: "composite"
steps:
- name: Download go-coverage-report
shell: bash
id: download
run: $GITHUB_ACTION_PATH/scripts/download-cli-tool.sh "${{ inputs.version }}" "${{ inputs.sha256sum }}"
env:
RUNNER_OS: ${{ runner.os }}
RUNNER_ARCH: ${{ runner.arch }}
- name: Determine changed files
id: changed-files
uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 # v42.1.0
with:
write_output_files: true
json: true
files: |
**.go
files_ignore: |
vendor/**
- name: Code coverage report
shell: bash
id: coverage
run: $GITHUB_ACTION_PATH/scripts/github-action.sh "${{ github.repository }}" "${{ github.event.pull_request.number }}" "${{ github.run_id }}"
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
GITHUB_BASELINE_WORKFLOW_REF: ${{ inputs.github-baseline-workflow-ref }}
TARGET_BRANCH: ${{ github.base_ref }}
CHANGED_FILES_PATH: .github/outputs/all_modified_files.json
COVERAGE_ARTIFACT_NAME: ${{ inputs.coverage-artifact-name }}
COVERAGE_FILE_NAME: ${{ inputs.coverage-file-name }}
ROOT_PACKAGE: ${{ inputs.root-package }}
SKIP_COMMENT: ${{ inputs.skip-comment }}
TRIM_PACKAGE: ${{ inputs.trim }}