Skip to content

Commit 78037a5

Browse files
authored
init ci pipeline (#1)
* init ci pipeline
1 parent b31aa2f commit 78037a5

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

.github/workflows/ci-pipeline.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: CI - Pipeline
5+
permissions:
6+
contents: read
7+
issues: read
8+
checks: write
9+
pull-requests: write
10+
on:
11+
push:
12+
branches: [ "main","release/**/*" ]
13+
pull_request:
14+
branches: [ "main","release/*" ]
15+
env:
16+
solutionPath: '${{ github.workspace }}/src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.sln'
17+
solutionFolder: '${{ github.workspace }}/src/Dataverse.ConfigurationMigrationTool'
18+
jobs:
19+
build:
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Setup .NET
26+
uses: actions/setup-dotnet@v3
27+
with:
28+
dotnet-version: 8.0.x
29+
- name: Restore dependencies
30+
run: dotnet restore ${{ env.solutionPath }}
31+
- name: Build
32+
run: dotnet build ${{ env.solutionPath }} --configuration Release --no-restore
33+
- name: Execute unit tests
34+
run: dotnet test ${{ env.solutionPath }} --configuration Release --settings ${{ env.solutionFolder }}/Console.Tests/CodeCoverage.runsettings --no-build --logger trx --no-restore --results-directory "TestResults" --collect:"XPlat code coverage"
35+
- name: Publish Test Report
36+
uses: phoenix-actions/test-reporting@v8
37+
id: test-report # Set ID reference for step
38+
if: ${{ (success() || failure()) && (github.event_name == 'pull_request') }} # run this step even if previous step failed
39+
with:
40+
name: unit tests # Name of the check run which will be created
41+
path: TestResults/*.trx # Path to test results
42+
reporter: dotnet-trx # Format of test results
43+
- name: Code Coverage Report
44+
uses: irongut/[email protected]
45+
if: github.event_name == 'pull_request'
46+
with:
47+
filename: TestResults/*/coverage.cobertura.xml
48+
badge: true
49+
fail_below_min: true
50+
format: markdown
51+
hide_branch_rate: false
52+
hide_complexity: true
53+
indicators: true
54+
output: both
55+
thresholds: '60 60'
56+
- name: Add Coverage PR Comment
57+
uses: marocchino/sticky-pull-request-comment@v2
58+
if: github.event_name == 'pull_request'
59+
with:
60+
recreate: true
61+
path: code-coverage-results.md
62+
63+
- name: ReportGenerator
64+
uses: danielpalme/[email protected]
65+
if: github.event_name == 'pull_request'
66+
with:
67+
reports: TestResults/*/coverage.cobertura.xml # REQUIRED # The coverage reports that should be parsed (separated by semicolon). Globbing is supported.
68+
targetdir: 'coveragereport' # REQUIRED # The directory where the generated report should be saved.
69+
reporttypes: 'HtmlInline;Cobertura' # The output formats and scope (separated by semicolon) Values: Badges, Clover, Cobertura, OpenCover, CsvSummary, Html, Html_Dark, Html_Light, Html_BlueRed, HtmlChart, HtmlInline, HtmlInline_AzurePipelines, HtmlInline_AzurePipelines_Dark, HtmlInline_AzurePipelines_Light, HtmlSummary, Html_BlueRed_Summary, JsonSummary, Latex, LatexSummary, lcov, MarkdownSummary, MarkdownSummaryGithub, MarkdownDeltaSummary, MHtml, SvgChart, SonarQube, TeamCitySummary, TextSummary, TextDeltaSummary, Xml, XmlSummary
70+
tag: '${{ github.run_number }}_${{ github.run_id }}' # Optional tag or build version.
71+
toolpath: 'reportgeneratortool' # Default directory for installing the dotnet tool.
72+
73+
- name: Upload coverage report artifact
74+
uses: actions/upload-artifact@v4
75+
if: github.event_name == 'pull_request'
76+
with:
77+
name: CoverageReport # Artifact name
78+
path: coveragereport # Directory containing files to upload
79+
80+
81+
82+
83+
84+
85+
86+
87+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<RunSettings>
3+
<DataCollectionRunSettings>
4+
<DataCollectors>
5+
<DataCollector friendlyName="XPlat code coverage">
6+
<Configuration>
7+
<Format>cobertura</Format>
8+
<Exclude>[*]Dataverse.ConfigurationMigrationTool.Console.Services.Dataverse*</Exclude>
9+
<ExcludeByFile>**/Program.cs,</ExcludeByFile>
10+
<SkipAutoProps>true</SkipAutoProps>
11+
</Configuration>
12+
</DataCollector>
13+
</DataCollectors>
14+
</DataCollectionRunSettings>
15+
</RunSettings>

0 commit comments

Comments
 (0)