Repository navigation
114 lines (96 loc) · 3.55 KB
/
Copy pathcode-coverage.yml
File metadata and controls
114 lines (96 loc) · 3.55 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
name: Code Coverage (generate data and trigger analysis)
on:
schedule:
- cron: "0 4 * * 1-5"
workflow_dispatch:
permissions:
contents: read # This is required for actions/checkout
jobs:
code-coverage-data:
runs-on: windows-2025-vs2026
env:
FEATURE_ACE: true # ACE feature enabled
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download latest cs-webview release (private repo)
shell: pwsh
run: powershell.exe -File .github/cwf.ps1
env:
CODESCENE_IDE_DOCS_AND_WEBVIEW_TOKEN: ${{ secrets.CODESCENE_IDE_DOCS_AND_WEBVIEW_TOKEN }}
- name: Get latest Codescene CLI version
shell: pwsh
run: powershell.exe -File .github/cli.ps1
- name: Copy web assets into project
shell: pwsh
run: powershell.exe -File .github/copy-assets.ps1
- name: Install ReportGenerator
shell: pwsh
run: dotnet tool install -g dotnet-reportgenerator-globaltool
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup VSTest
uses: darenm/Setup-VSTest@v1
- name: Restore NuGet packages
shell: pwsh
run: dotnet restore Codescene.VSExtension.VS2022/Codescene.VSExtension.sln
- name: Build solution
shell: pwsh
run: msbuild Codescene.VSExtension.VS2022/Codescene.VSExtension.sln /p:Configuration=Release /p:Platform="Any CPU"
- name: Run unit tests
shell: pwsh
run: |
dotnet test `
Codescene.VSExtension.VS2022/Codescene.VSExtension.sln `
--configuration Release `
--no-build `
--results-directory ./Codescene.VSExtension.VS2022/TestResults/ `
--logger trx `
--collect "XPlat Code Coverage" `
-- `
DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=lcov
- name: Merge coverage
shell: pwsh
run: |
reportgenerator `
-reports:"**/TestResults/**/coverage.info" `
-targetdir:./Codescene.VSExtension.VS2022/TestResults/coverage-report/ `
-reporttypes:lcov
- name: Upload line coverage data
uses: ./.github/actions/upload-coverage
if: always()
with:
cs-token: ${{ secrets.CODESCENE_CODE_COVERAGE_API_TOKEN }}
format: lcov
metric: line-coverage
file: ./Codescene.VSExtension.VS2022/TestResults/coverage-report/lcov.info
- name: Upload statement coverage data
uses: ./.github/actions/upload-coverage
if: always()
with:
cs-token: ${{ secrets.CODESCENE_CODE_COVERAGE_API_TOKEN }}
format: lcov
metric: function-coverage
file: ./Codescene.VSExtension.VS2022/TestResults/coverage-report/lcov.info
- name: Upload branch coverage data
uses: ./.github/actions/upload-coverage
if: always()
with:
cs-token: ${{ secrets.CODESCENE_CODE_COVERAGE_API_TOKEN }}
format: lcov
metric: branch-coverage
file: ./Codescene.VSExtension.VS2022/TestResults/coverage-report/lcov.info
trigger-analysis:
runs-on: ubuntu-24.04 # 24.04 needed to support `curl --retry-all-errors`
needs: [ code-coverage-data ]
if: always()
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Trigger codescene-vscode project analysis
env:
CS_TOKEN: ${{ secrets.CODESCENE_CODE_COVERAGE_API_TOKEN }}
CS_PROJECT_ID: 66574
run: |
curl --fail -X POST -H "Authorization: Bearer $CS_TOKEN" https://api.codescene.io/v2/projects/${CS_PROJECT_ID}/run-analysis