Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
106 lines (106 loc) · 4.7 KB
/
Copy pathaction.yml
File metadata and controls
106 lines (106 loc) · 4.7 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
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
101
102
103
104
105
106
name: Analyze with SonarCloud
description: An opinionated action that downloads SonarCloud quality profiles and prepares your project for SonarScanner for .NET.
inputs:
token:
description: The SonarCloud generated token.
required: true
projectKey:
description: The key of your project in SonarCloud.
required: true
organization:
description: The name of your organization in SonarCloud.
required: true
version:
description: The version of your project, e.g. 1.0.0.
required: true
host:
description: The host URL of your SonarCloud instance, e.g. https://sonarcloud.io.
required: true
default: 'https://sonarcloud.io'
parameters:
description: Additional properties to be passed to the scanner. Default is to use properties tailored for C# and the coding conventions followed by Codebelt.
required: false
default: >-
-d:sonar.exclusions='**/obj/**,**/bin/**'
coverage-mode:
description: Controls how coverage is supplied to SonarQube Cloud. Allowed values are opencover and normalized.
required: false
default: opencover
coverage-source-root:
description: Repository-relative source directory used to normalize workspace paths in normalized mode.
required: false
default: src
coverage-partition-regex:
description: Regex over artifact-relative report paths; capture groups identify build variant and target framework in normalized mode. Every report must match.
required: false
default: '^([^/]+?)(?:-[0-9a-f]{16,})?/([^/]+)/'
coverage-max-identity-spread:
description: Optional caller acceptance guard for cross-partition branch source-line spread. Empty means no threshold.
required: false
default: ''
runs:
using: composite
steps:
- name: Validate coverage contract
shell: bash
run: bash "${GITHUB_ACTION_PATH//\\//}/scripts/OpenCover.sh" Validate
env:
INPUT_COVERAGE_MODE: ${{ inputs.coverage-mode }}
INPUT_PARAMETERS: ${{ inputs.parameters }}
- name: Validate normalization prerequisites
if: ${{ inputs.coverage-mode == 'normalized' }}
shell: pwsh
run: '& (Join-Path $env:GITHUB_ACTION_PATH "scripts/Scanner.ps1") -Phase Validate'
env:
INPUT_COVERAGE_MODE: ${{ inputs.coverage-mode }}
INPUT_COVERAGE_SOURCE_ROOT: ${{ inputs.coverage-source-root }}
INPUT_COVERAGE_PARTITION_REGEX: ${{ inputs.coverage-partition-regex }}
INPUT_COVERAGE_MAX_IDENTITY_SPREAD: ${{ inputs.coverage-max-identity-spread }}
INPUT_PARAMETERS: ${{ inputs.parameters }}
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: ${{ github.workspace }}/artifacts
pattern: TestResults*
- name: Normalize Sonar coverage
if: ${{ inputs.coverage-mode == 'normalized' }}
shell: pwsh
run: '& (Join-Path $env:GITHUB_ACTION_PATH "scripts/Scanner.ps1") -Phase Normalize'
env:
INPUT_COVERAGE_MODE: ${{ inputs.coverage-mode }}
INPUT_COVERAGE_SOURCE_ROOT: ${{ inputs.coverage-source-root }}
INPUT_COVERAGE_PARTITION_REGEX: ${{ inputs.coverage-partition-regex }}
INPUT_COVERAGE_MAX_IDENTITY_SPREAD: ${{ inputs.coverage-max-identity-spread }}
INPUT_PARAMETERS: ${{ inputs.parameters }}
- name: SonarScanner for .NET - OpenCover
if: ${{ inputs.coverage-mode == 'opencover' }}
shell: bash
run: bash "${GITHUB_ACTION_PATH//\\//}/scripts/OpenCover.sh" Begin
env:
GITHUB_TOKEN: ${{ github.token }}
SONAR_TOKEN: ${{ inputs.token }}
INPUT_PROJECT_KEY: ${{ inputs.projectKey }}
INPUT_ORGANIZATION: ${{ inputs.organization }}
INPUT_VERSION: ${{ inputs.version }}
INPUT_HOST: ${{ inputs.host }}
INPUT_PARAMETERS: ${{ inputs.parameters }}
INPUT_COVERAGE_MODE: ${{ inputs.coverage-mode }}
- name: SonarScanner for .NET - Normalized
if: ${{ inputs.coverage-mode == 'normalized' }}
shell: pwsh
run: '& (Join-Path $env:GITHUB_ACTION_PATH "scripts/Scanner.ps1") -Phase Begin'
env:
GITHUB_TOKEN: ${{ github.token }}
SONAR_TOKEN: ${{ inputs.token }}
INPUT_PROJECT_KEY: ${{ inputs.projectKey }}
INPUT_ORGANIZATION: ${{ inputs.organization }}
INPUT_VERSION: ${{ inputs.version }}
INPUT_HOST: ${{ inputs.host }}
INPUT_PARAMETERS: ${{ inputs.parameters }}
INPUT_COVERAGE_MODE: ${{ inputs.coverage-mode }}
INPUT_COVERAGE_SOURCE_ROOT: ${{ inputs.coverage-source-root }}
INPUT_COVERAGE_PARTITION_REGEX: ${{ inputs.coverage-partition-regex }}
INPUT_COVERAGE_MAX_IDENTITY_SPREAD: ${{ inputs.coverage-max-identity-spread }}
branding:
icon: 'umbrella'
color: 'blue'