-
Notifications
You must be signed in to change notification settings - Fork 5
119 lines (110 loc) · 4.51 KB
/
Copy pathdotnet.yml
File metadata and controls
119 lines (110 loc) · 4.51 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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
run: dotnet test -c Release --framework net8.0 --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v7
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Pack main NuGet Package
run: dotnet pack HarpoS7/HarpoS7.csproj -c Release --output ./nupkg_output
- name: Pack PublicKeys NuGet Package
run: dotnet pack HarpoS7.PublicKeys/HarpoS7.PublicKeys.csproj -c Release --output ./nupkg_output
- name: Pack HarpoS7.PoC (linux)
run: dotnet publish HarpoS7.PoC/HarpoS7.PoC.csproj --sc -c Release -r linux-x64 -o linux -p:PublishSingleFile=true
- name: Pack HarpoS7.PoC (windows)
run: dotnet publish HarpoS7.PoC/HarpoS7.PoC.csproj --sc -c Release -r win-x64 -o windows -p:PublishSingleFile=true
- name: Upload NuGet Package as Artifact
uses: actions/upload-artifact@v7
with:
name: HarpoS7-NuGet-Packages
path: ./nupkg_output/*.nupkg
- name: Upload HarpoS7.Poc (linux)
uses: actions/upload-artifact@v7
with:
name: HarpoS7.PoC_Linux_x64_SelfContained
path: ./linux/*
- name: Upload HarpoS7.Poc (windows)
uses: actions/upload-artifact@v7
with:
name: HarpoS7.PoC_Windows_x64_SelfContained
path: ./windows/*
net48-compatibility:
runs-on: windows-latest
needs: [build]
steps:
- uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
- name: Run library tests on .NET Framework 4.8
shell: pwsh
run: |
$testProjects = @(
'HarpoS7.Tests/HarpoS7.Tests.csproj',
'HarpoS7.Family0.Tests/HarpoS7.Family0.Tests.csproj',
'HarpoS7.Utilities.Tests/HarpoS7.Utilities.Tests.csproj',
'HarpoS7.PublicKeys.Tests/HarpoS7.PublicKeys.Tests.csproj'
)
$resultsDirectory = Join-Path $env:RUNNER_TEMP 'harpos7-net48-results'
foreach ($testProject in $testProjects) {
$testName = [IO.Path]::GetFileNameWithoutExtension($testProject)
$resultFile = "$testName.trx"
dotnet test $testProject -c Release --framework net48 `
--logger "trx;LogFileName=$resultFile" `
--results-directory $resultsDirectory
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
[xml]$testResult = Get-Content (Join-Path $resultsDirectory $resultFile)
if ([int]$testResult.TestRun.ResultSummary.Counters.total -eq 0) {
throw "No .NET Framework 4.8 tests were discovered for $testProject"
}
}
- uses: actions/download-artifact@v7
with:
name: HarpoS7-NuGet-Packages
path: ./artifacts
- name: Validate .NET Framework 4.8 NuGet packages
shell: pwsh
run: |
$packageSource = (Resolve-Path ./artifacts).Path
dotnet restore HarpoS7.NetFramework48.SmokeTest/HarpoS7.NetFramework48.SmokeTest.csproj -p:RestoreAdditionalProjectSources="$packageSource"
dotnet run --project HarpoS7.NetFramework48.SmokeTest/HarpoS7.NetFramework48.SmokeTest.csproj -c Release --no-restore
publish-nuget:
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment: nuget-release
needs: [build, net48-compatibility]
permissions:
id-token: write # enable GitHub OIDC token issuance for this job
steps:
- uses: actions/download-artifact@v7
with:
name: HarpoS7-NuGet-Packages
path: ./artifacts
- name: NuGet login
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }}
- name: Publish to NuGet
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate