-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (109 loc) · 3.94 KB
/
Copy pathComponent.BuildTest.yml
File metadata and controls
124 lines (109 loc) · 3.94 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Called by ci.yml to build & test project files
name: Build Component
on:
workflow_call:
inputs:
project-name:
required: true
type: string
project-build-commands:
default: ''
required: false
type: string
code-cov-name:
required: true
type: string
code-cov-prefix:
default: 'unittests'
required: false
type: string
os-list:
default: '[ "windows-2025", "ubuntu-24.04" ]'
required: false
type: string
tfm-list:
default: '[ "net8.0" ]'
required: false
type: string
trigger:
required: true
type: string
permissions:
contents: read
jobs:
build-test:
name: build-test
strategy:
fail-fast: ${{ inputs.trigger == 'merge_group' }}
matrix:
os: ${{ fromJSON(inputs.os-list) }}
version: ${{ fromJSON(inputs.tfm-list) }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
env:
DISABLE_APP_DOMAIN: ${{ matrix.version == 'net462' && 'false' || 'true' }}
PROJECT_NAME: ${{ inputs.project-name }}
PROJECT_BUILD_COMMANDS: ${{ inputs.project-build-commands }}
TARGET_FRAMEWORK: ${{ matrix.version }}
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
show-progress: false
- name: Setup .NET
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
- name: dotnet restore ${{ inputs.project-name }}
shell: pwsh
run: dotnet restore ${env:PROJECT_NAME} ${env:PROJECT_BUILD_COMMANDS}
- name: dotnet build ${{ inputs.project-name }}
shell: pwsh
run: dotnet build ${env:PROJECT_NAME} --configuration Release --no-restore ${env:PROJECT_BUILD_COMMANDS}
- name: dotnet test ${{ inputs.project-name }}
shell: pwsh
run: >
dotnet test ${env:PROJECT_NAME}
--collect:"Code Coverage"
--results-directory:TestResults
--framework ${env:TARGET_FRAMEWORK}
--configuration Release
--no-restore
--no-build
-- RunConfiguration.DisableAppDomain=${env:DISABLE_APP_DOMAIN}
- name: Install coverage tool
shell: pwsh
env:
DOTNET_COVERAGE_VERSION: '18.7.0'
run: dotnet tool install -g dotnet-coverage --version ${env:DOTNET_COVERAGE_VERSION}
- name: Merging test results
run: dotnet-coverage merge -f cobertura -o ./TestResults/Cobertura.xml ./TestResults/**/*.coverage
- name: Upload code coverage ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
continue-on-error: true
timeout-minutes: 5
env:
OS: ${{ matrix.os }}
TFM: ${{ matrix.version }}
with:
disable_search: true
disable_telem: true
env_vars: OS,TFM
files: TestResults/Cobertura.xml
flags: ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
name: Code Coverage for ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }} on [${{ matrix.os }}.${{ matrix.version }}]
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
if: ${{ !cancelled() && hashFiles('./TestResults/junit.xml') != '' }}
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
continue-on-error: true
timeout-minutes: 5
with:
disable_search: true
disable_telem: true
env_vars: OS,TFM
files: TestResults/junit.xml
flags: ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }}
name: Test results for ${{ inputs.code-cov-prefix }}-${{ inputs.code-cov-name }} on [${{ matrix.os }}.${{ matrix.version }}]
report_type: test_results
token: ${{ secrets.CODECOV_TOKEN }}