-
Notifications
You must be signed in to change notification settings - Fork 4
139 lines (114 loc) · 5.56 KB
/
ci.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
136
137
138
139
name: Middleware CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-test:
runs-on: windows-latest
timeout-minutes: 60
strategy:
matrix:
solution: [ "queue" ]
# solution: [ "queue", "scu-at", "scu-de", "scu-it", "scu-es" ]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
filter: tree:0
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x'
- name: Install .NET Framework 4.6.1
run: choco install netfx-4.6.1-devpack -y
- name: Install NuGet
run: choco install nuget.commandline -y
- name: Install MinVer
run: dotnet tool install --global minver-cli --version 5.0.0
- name: Restore dependencies
run: dotnet restore (Get-ChildItem -Path ${{ matrix.solution }} -Filter *.sln).FullName
- name: Build
run: dotnet build (Get-ChildItem -Path ${{ matrix.solution }} -Filter *.sln).FullName --configuration Release --no-restore
- name: Find Unit Test Projects
id: unit_test_projects
run: |
"PROJECTS=$((Get-ChildItem -Path ./${{ matrix.solution }} -Recurse -Filter '*.UnitTest.csproj' | % { $_.FullName }) -join ';')" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Find Integration Test Projects
id: integration_test_projects
run: |
"PROJECTS=$((Get-ChildItem -Path ./${{ matrix.solution }} -Recurse -Filter '*.IntegrationTest.csproj' | % { $_.FullName }) -join ';')" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Find Acceptance Test Projects
id: acceptance_test_projects
run: |
"PROJECTS=$((Get-ChildItem -Path ./${{ matrix.solution }} -Recurse -Filter '*.AcceptanceTest.csproj' | % { $_.FullName }) -join ';')" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Run Unit Tests
env:
PROJECTS: ${{ steps.unit_test_projects.outputs.PROJECTS }}
if: steps.unit_test_projects.outputs.PROJECTS != ''
run: |
$projects = "${{ steps.unit_test_projects.outputs.PROJECTS }}".Split(";")
foreach ($project in $projects) {
dotnet test $project --no-build --verbosity normal
}
- name: Run Integration Tests
if: steps.integration_test_projects.outputs.PROJECTS != ''
run: |
$projects = "${{ steps.integration_test_projects.outputs.PROJECTS }}".Split(";")
foreach ($project in $projects) {
dotnet test $project --no-build --verbosity normal
}
- name: Run Acceptance Tests
if: steps.acceptance_test_projects.outputs.PROJECTS != ''
run: |
$projects = "${{ steps.acceptance_test_projects.outputs.PROJECTS }}".Split(";")
foreach ($project in $projects) {
dotnet test $project --no-build --verbosity normal
}
- name: Filter files for codesigning
id: filter_files_for_codesigning
run: |
$files = Get-ChildItem -Path .\\${{ matrix.solution }} -Filter "fiskaltrust.*.dll" -Recurse | Select-Object -ExpandProperty FullName
$filesList = $files -join "`n"
# Multiline outputs required a unique delimiter
$EOF = -join (1..15 | ForEach {[char]((48..57)+(65..90)+(97..122) | Get-Random)})
"FILES<<$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append
$filesList | Out-File -FilePath $env:GITHUB_OUTPUT -Append
"$EOF" | Out-File -FilePath $env:GITHUB_ENV -Append
Write-Output "::set-output name=filtered_files::$filesList"
- name: Sign binaries
uses: dlemstra/code-sign-action@v1
with:
certificate: '${{ secrets.SIGNING_CERTIFICATE }}'
password: '${{ secrets.SIGNING_CERT_PASSWORD }}'
files: ${{ steps.filter_files_for_codesigning.outputs.filtered_files }}
- name: Publish v1 Nuget packages
run: dotnet pack (Get-ChildItem -Path ${{ matrix.solution }} -Filter *.sln).FullName --no-restore --configuration Release --output ./publish/packages-v1
- name: Publish v2 zip packages
run: |
$version = minver --verbosity error
New-Item -ItemType Directory -Force -Path ./publish/packages-v2
# We're filtering the files to publish here based on the IsPackable attribute that's also used for v1 packages
$projectFiles = Get-ChildItem -Path ${{ matrix.solution }} -Recurse -Filter *.csproj
foreach ($file in $projectFiles) {
[xml]$xmlContent = Get-Content -Path $file.FullName
foreach ($propertyGroup in $xmlContent.Project.PropertyGroup) {
if ($propertyGroup.IsPackable -eq "true") {
$packageName = $file.BaseName
dotnet publish $file.FullName --configuration Release -f net6 --output ./publish/raw/packages-v2/$packageName --no-build /p:DebugType=None /p:DebugSymbols=false
Compress-Archive -Path ./publish/raw/packages-v2/$packageName/* -DestinationPath ./publish/packages-v2/$packageName.$version.zip
$hash = Get-FileHash ./publish/packages-v2/$packageName.$version.zip -Algorithm SHA256
$hashbytes = $hash.Hash -split '([A-F0-9]{2})' | foreach-object { if ($_) {[System.Convert]::ToByte($_,16)}}
$hashstring = [System.Convert]::ToBase64String($hashbytes)
$hashstring | Set-Content ./publish/packages-v2/$packageName.$version.zip.hash
break
}
}
}
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.solution }}-build-artifacts
path: ./publish