-
Notifications
You must be signed in to change notification settings - Fork 13
135 lines (116 loc) · 4.85 KB
/
build_and_test.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Build and Test
on:
push:
branches:
- '**'
paths-ignore:
- '**.md'
- 'SignNow.Net/SignNow.Net.Examples/**'
tags-ignore:
- '**'
pull_request:
branches:
- 'master'
- 'develop'
paths-ignore:
- '**.md'
tags-ignore:
- '**'
# Workflow
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Ubuntu
- { name: 'Linux .NET 5', os: ubuntu-22.04, framework: 'net5' }
# macOs
- { name: 'macOS .NET 5', os: macos-13, framework: 'net5' }
# Windows
- { name: 'Windows .NET Core 3', os: windows-latest, framework: 'netcoreapp3.1' }
- { name: 'Windows .NET 5', os: windows-latest, framework: 'net5' }
- { name: 'Windows .NET 4.5', os: windows-latest, framework: 'net45' }
env:
COREHOST_TRACE: false
DOTNET_CLI_TELEMETRY_OPTOUT: 1 # Disable sending usage data to Microsoft
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 # prevent the caching of the packages on the build machine
DOTNET_NOLOGO: true # removes logo and telemetry message from first run of dotnet cli
NUGET_XMLDOC_MODE: skip # prevent the download of the XML documentation for the packages
COVERAGE_PATH: SignNow.Net.Test/bin/Debug
# Do not generate summary otherwise it leads to duplicate errors in build log
DOTNET_BUILD_ARGS: SignNow.Net --configuration Debug /consoleloggerparameters:NoSummary /property:GenerateFullPaths=true
defaults:
run:
shell: pwsh
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup .NET SDK Version for Target Framework
run: |
If ("${{ matrix.framework }}" -eq "netcoreapp3.1") {
Write-Output "DOTNET_SDK_VERSION=3.1.x" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} ElseIf ("${{ matrix.framework }}" -eq "net5") {
Write-Output "DOTNET_SDK_VERSION=5.0.x" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
- name: Setup Nuget Cache
uses: actions/cache@v4
id: nuget-cache
with:
path: ~/.nuget
key: ${{ runner.os }}-nuget-${{ matrix.framework }}-${{ hashFiles('**/*.csproj') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Setup dotnet tools
env:
DOTNET_ROOT: ${{ runner.tool_cache }}/dncs/${{ env.DOTNET_SDK_VERSION }}/x64
run: |
dotnet tool install --global InheritDocTool
echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
- name: Restore Nuget packages
run: dotnet restore -v:n
- name: Configure signNow API
run: echo '${{ secrets.TEST_CREDITS_JSON }}' >> ${{ github.workspace }}/api-eval.signnow.com.json
- name: Build and Pack Solution
run: |
dotnet build ${{ env.DOTNET_BUILD_ARGS }}
dotnet pack --configuration Release --output ./SignNow.Net/bin/Publish SignNow.Net
- name: Run Tests on ${{ matrix.framework }} with Coverage
run: |
dotnet test SignNow.Net.Test `
--configuration Debug --framework ${{ matrix.framework }} `
/p:CollectCoverage=true
- name: Save Code Coverage Results
uses: actions/upload-artifact@v4
with:
name: CoverageReports-${{ runner.os }}-${{ matrix.framework }}.zip
path: SignNow.Net.Test/bin/Debug/**/coverage*
- name: Setup Code Coverage report flags
run: |
If ("${{ matrix.framework }}" -eq "netcoreapp3.1") {
Write-Output "TARGET_FRAMEWORK=netstandard12" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} ElseIf ("${{ matrix.framework }}" -eq "net5") {
Write-Output "TARGET_FRAMEWORK=netstandard20" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
} Else {
Write-Output "TARGET_FRAMEWORK=net45" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
}
- name: Test Release Notes parser
if: (runner.os == 'macOS' || runner.os == 'Linux')
shell: bash
run: |
.github/release-notes.sh CHANGELOG.md
- name: Upload Code Coverage Report (Codecov.io)
continue-on-error: true
uses: codecov/codecov-action@v4
with:
name: ${{ runner.os }}-codecov-${{ matrix.framework }}
flags: ${{ runner.os }},${{ env.TARGET_FRAMEWORK }}
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ env.COVERAGE_PATH }}/${{ matrix.framework }}/coverage.${{ matrix.framework }}.opencover.xml
fail_ci_if_error: false