-
Notifications
You must be signed in to change notification settings - Fork 23
236 lines (226 loc) · 7.8 KB
/
main.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: CI Build
on:
push:
branches:
- master
paths-ignore:
- README.md
jobs:
version:
runs-on: windows-latest
outputs:
release-version: ${{ steps.get-version.outputs.RELEASE_VERSION }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Version extraction
id: get-version
run: |
$xml1 = [xml](Get-Content -Path Platform/fo-dicom/fo-dicom.Codecs.csproj)
$version1 = $xml1.Project.PropertyGroup.Version;
echo "RELEASE_VERSION=$version1" >> $env:GITHUB_OUTPUT
shell: pwsh
build_win_x64:
runs-on: windows-2019
needs: version
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup msbuild
uses: microsoft/setup-msbuild@v2
- name: Compile libijg8 libraries
run: msbuild Native/Windows64/build_ALL/libijg8.x64.vcxproj /p:Configuration=Release /p:Platform=x64
- name: Compile libijg12 libraries
run: msbuild Native/Windows64/build_ALL/libijg12.x64.vcxproj /p:Configuration=Release /p:Platform=x64
- name: Compile libijg16 libraries
run: msbuild Native/Windows64/build_ALL/libijg16.x64.vcxproj /p:Configuration=Release /p:Platform=x64
- name: Compile windows x64 library
run: msbuild Native/Windows64/build_ALL/Dicom.Native.vcxproj /p:Configuration=Release /p:Platform=x64
- name: Publish windows x64 artifacts
uses: actions/upload-artifact@v4
with:
name: lib-win-x64
path: Native/Windows64/build_ALL/bin/x64/Release/Dicom.Native
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Prepare SN Key
run: |
echo "${{ secrets.STRONG_NAME_KEY }}" >Platform/fo-dicom/fo-dicom.Codecs.snk.base64
certutil -decode Platform/fo-dicom/fo-dicom.Codecs.snk.base64 Platform/fo-dicom/fo-dicom.Codecs.snk
- name: Run unit tests
run: dotnet test Tests/Unit/UnitTests.csproj --logger:trx
build_linux_x64:
runs-on: ubuntu-20.04
needs: build_win_x64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Compile linux x64 library
run: |
cd Native/POSIX64/
cmake ./CMakeLists.txt
make
- name: Publish linux x64 artifacts
uses: actions/upload-artifact@v4
with:
name: lib-linux-x64
path: Native/POSIX64/lib-linux-x64
- name: Prepare SN key
run: echo ${{ secrets.STRONG_NAME_KEY }} | base64 --decode >Platform/fo-dicom/fo-dicom.Codecs.snk
- name: Publish managed library
run: dotnet publish Platform/fo-dicom/fo-dicom.Codecs.csproj --configuration Release
- name: Publish managed artifacts
uses: actions/upload-artifact@v4
with:
name: lib-managed
path: Platform/fo-dicom/bin/Release/netstandard2.0
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Run unit tests
run: dotnet test Tests/Unit/*.csproj --logger:trx
build_linux_arm64:
runs-on: ubuntu-20.04
needs: build_win_x64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Compile linux arm64 library
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
cd Native/POSIX64/
cmake -DARCH_FLAG:STRING=arm64 ./CMakeLists.txt
make
- name: Publish linux arm64 artifacts
uses: actions/upload-artifact@v4
with:
name: lib-linux-arm64
path: Native/POSIX64/lib-linux-arm64
build_osx_x64:
runs-on: macos-12
needs: build_win_x64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Compile osx x64 library
run: |
cd Native/POSIX64/
cmake ./CMakeLists.txt
make
- name: Publish osx x64 artifacts
uses: actions/upload-artifact@v4
with:
name: lib-osx-x64
path: Native/POSIX64/lib-osx-x64
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Prepare SN key
run: echo ${{ secrets.STRONG_NAME_KEY }} | base64 --decode >Platform/fo-dicom/fo-dicom.Codecs.snk
- name: Run unit tests
run: dotnet test Tests/Unit/*.csproj --logger:trx
build_osx_arm64:
runs-on: macos-12
needs: build_win_x64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Compile osx arm64 library
run: |
cd Native/POSIX64/
cmake -DARCH_FLAG:STRING=arm64 ./CMakeLists.txt
make
- name: Publish osx arm64 artifacts
uses: actions/upload-artifact@v4
with:
name: lib-osx-arm64
path: Native/POSIX64/lib-osx-arm64
acceptance:
runs-on: windows-latest
needs:
- version
- build_win_x64
- build_linux_x64
- build_linux_arm64
- build_osx_x64
- build_osx_arm64
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: bin
pattern: lib-win-x64
- name: Prepare SN Key
run: |
echo "${{ secrets.STRONG_NAME_KEY }}" >Platform/fo-dicom/fo-dicom.Codecs.snk.base64
certutil -decode Platform/fo-dicom/fo-dicom.Codecs.snk.base64 Platform/fo-dicom/fo-dicom.Codecs.snk
- name: Run acceptance tests
run: |
echo "Running Acceptance Test for version ${{ needs.version.outputs.release-version }}..."
dotnet test Tests/Acceptance/AcceptanceTests.csproj --logger:trx
- name: Compress results
run: Compress-Archive Tests/Acceptance/bin/debug/net8.0/out ./AcceptanceTestResults.zip
shell: pwsh
- name: Archive files
uses: actions/upload-artifact@v4
with:
name: test
path: ./AcceptanceTestResults.zip
nuget:
runs-on: windows-latest
needs:
- version
- acceptance
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: bin
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Prepare NuGet package
run: nuget pack Setup/fo-dicom.Codecs.nuspec -Version ${{ needs.version.outputs.release-version }}
- name: Publish NuGet package
run: nuget push "fo-dicom.Codecs.*.nupkg" -Source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_API_KEY }}
release:
runs-on: ubuntu-latest
needs:
- version
- acceptance
- nuget
if: (!contains(needs.version.outputs.release-version, '-'))
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: bin
pattern: test
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.version.outputs.release-version }}
release_name: Release ${{ needs.version.outputs.release-version }}
draft: false
prerelease: false
- name: Upload Release Asset
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload ${{ needs.version.outputs.release-version }} bin/test/AcceptanceTestResults.zip