-
-
Notifications
You must be signed in to change notification settings - Fork 3
469 lines (406 loc) · 19.8 KB
/
build.yaml
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
# This is a basic workflow to help you get started with Actions
name: CI_BUILD
# Controls when the action will run. Triggers the workflow on push
# events but only for the master branch
on:
push:
# only trigger on branches, not on tags
branches: '**'
# This workflow contains two jobs called "check_opendds", "build_opendds_windows", "check_changes", "build_ddm_windows"
jobs:
# Verify if a build is needed
check_opendds:
name: Check artifact files
outputs:
build_opendds: ${{ steps.check_existsOpenDDS.outputs.build_opendds }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/cache/restore@v3
id: cache
with:
lookup-only: true
enableCrossOsArchive: true
path: ./OutputOpenDDS/
key: OpenDDS_3.25
- name: If failed we need to rebuild artifact
id: check_existsOpenDDS
if: steps.cache.outputs.cache-hit != 'true'
# if: ${{ steps.existsOpenDDS.outcome == 'failure' }}
run: echo "build_opendds=true" >> $GITHUB_OUTPUT
build_opendds_windows:
needs: check_opendds
if: needs.check_opendds.outputs.build_opendds == 'true'
# The type of runner that the job will run on
runs-on: windows-2022
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a set of commands using the runners shell
# Support longpaths
- name: Support long paths
run: git config --system core.longpaths true
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: set up msvc env
uses: ilammy/[email protected]
- name: Configure OpenDDS
shell: cmd
run: |
cd third_party\OpenDDS
configure
- name: Build OpenDDS x64
shell: cmd
run: |
cd third_party\OpenDDS
call setenv.cmd
msbuild -p:Configuration=Release,Platform=x64 -m DDS_TAOv2.sln
- name: Move OpenDDS x64 binaries
shell: cmd
run: |
cd third_party\OpenDDS
xcopy .\lib\*.dll ..\..\Output\x64\
xcopy .\lib\*.lib ..\..\Output\lib64\
xcopy .\bin\*.exe ..\..\Output\bin64\
xcopy .\ACE_wrappers\lib\*.dll ..\..\Output\x64\
xcopy .\ACE_wrappers\lib\*.lib ..\..\Output\lib64\
xcopy .\ACE_wrappers\bin\*.exe ..\..\Output\bin64\
- name: Move OpenDDS x64 PDB
shell: cmd
run: |
cd third_party\OpenDDS
mkdir ..\..\OutputPdb
xcopy .\lib\*.pdb ..\..\OutputPdb\pdb64\
xcopy .\bin\*.pdb ..\..\OutputPdb\pdb64\
xcopy .\ACE_wrappers\lib\*.pdb ..\..\OutputPdb\pdb64\
xcopy .\ACE_wrappers\bin\*.pdb ..\..\OutputPdb\pdb64\
- name: Build OpenDDS x86
shell: cmd
run: |
cd third_party\OpenDDS
call setenv.cmd
msbuild -p:Configuration=Release,Platform=Win32 -m DDS_TAOv2.sln
- name: Move OpenDDS x86 binaries
shell: cmd
run: |
cd third_party\OpenDDS
xcopy .\lib\*.dll ..\..\Output\x86\
xcopy .\lib\*.lib ..\..\Output\lib32\
xcopy .\bin\*.exe ..\..\Output\bin32\
xcopy .\ACE_wrappers\lib\*.dll ..\..\Output\x86\
xcopy .\ACE_wrappers\lib\*.lib ..\..\Output\lib32\
xcopy .\ACE_wrappers\bin\*.exe ..\..\Output\bin32\
- name: Move OpenDDS x86 PDB
shell: cmd
run: |
cd third_party\OpenDDS
xcopy .\lib\*.pdb ..\..\OutputPdb\pdb32\
xcopy .\bin\*.pdb ..\..\OutputPdb\pdb32\
xcopy .\ACE_wrappers\lib\*.pdb ..\..\OutputPdb\pdb32\
xcopy .\ACE_wrappers\bin\*.pdb ..\..\OutputPdb\pdb32\
- name: Move setenv.cmd
shell: cmd
run: |
cd third_party\OpenDDS
xcopy setenv.cmd ..\..\Output\
- name: Prepare for packaging OpenDDS Binaries and PDB
run: |
New-Item -Path .\OutputOpenDDS -ItemType directory
Compress-Archive -Path .\Output\* -DestinationPath .\OutputOpenDDS\OpenDDS_Build_3.25.zip
Compress-Archive -Path .\OutputPdb\* -DestinationPath .\OutputOpenDDS\OpenDDS_PDB_Build_3.25.zip
- name: Prepare for packaging OpenDDS Headers
shell: cmd
run: |
7z a .\OutputOpenDDS\OpenDDS_Headers_3.25.zip .\third_party\OpenDDS\*.h -r
7z u .\OutputOpenDDS\OpenDDS_Headers_3.25.zip .\third_party\OpenDDS\*.inl -r
- name: Save OpenDDS in cache
uses: actions/cache/save@v3
with:
enableCrossOsArchive: true
path: ./OutputOpenDDS/
key: OpenDDS_3.25
- name: Upload OpenDDS
if: ${{ github.repository_owner == 'masesgroup'}} # do not upload any artifact outside main repo
continue-on-error: true
shell: cmd
run: |
python %GITHUB_WORKSPACE%\third_party\CommonTools\scripts\utilsftp.py -c upload -s ${{ secrets.FTP_STORE_SITE }} -u ${{ secrets.FTP_STORE_USER }} -p ${{ secrets.FTP_STORE_PASSWORD }} -r OpenDDS_Build_3.25.zip -l %GITHUB_WORKSPACE%\OutputOpenDDS\OpenDDS_Build_3.25.zip
python %GITHUB_WORKSPACE%\third_party\CommonTools\scripts\utilsftp.py -c upload -s ${{ secrets.FTP_STORE_SITE }} -u ${{ secrets.FTP_STORE_USER }} -p ${{ secrets.FTP_STORE_PASSWORD }} -r OpenDDS_PDB_Build_3.25.zip -l %GITHUB_WORKSPACE%\OutputOpenDDS\OpenDDS_PDB_Build_3.25.zip
python %GITHUB_WORKSPACE%\third_party\CommonTools\scripts\utilsftp.py -c upload -s ${{ secrets.FTP_STORE_SITE }} -u ${{ secrets.FTP_STORE_USER }} -p ${{ secrets.FTP_STORE_PASSWORD }} -r OpenDDS_Headers_3.25.zip -l %GITHUB_WORKSPACE%\OutputOpenDDS\OpenDDS_Headers_3.25.zip
env:
GITHUB_WORKSPACE: $GITHUB_WORKSPACE
# Verify if a build is needed
check_changes:
needs: [check_opendds, build_opendds_windows]
if: always()
name: Check changed files
outputs:
run_build_ddm_windows: ${{ steps.check_files.outputs.run_build_ddm_windows }}
runs-on: ubuntu-latest
steps:
- id: get_changed_files
uses: masesgroup/retrieve-changed-files@v2
with:
format: 'csv'
- id: check_files
run: |
mapfile -d ',' -t added_modified_files < <(printf '%s,' '${{ steps.get_changed_files.outputs.added_modified }}')
for added_modified_file in "${added_modified_files[@]}"; do
if [[ $added_modified_file == ".github/workflows/build.yaml"* ]]; then
echo "$added_modified_file is myself."
echo "run_build_ddm_windows=true" >> $GITHUB_OUTPUT
break
fi
if [[ $added_modified_file == "src/"* ]]; then
echo "$added_modified_file file is under the directory 'src/'."
echo "run_build_ddm_windows=true" >> $GITHUB_OUTPUT
break
fi
done
- name: Get run_build_ddm_windows
run: echo "The selected run_build_ddm_windows is ${{ steps.check_files.outputs.run_build_ddm_windows }}"
# Now run "build_ddm_windows"
build_ddm_windows:
needs: check_changes
if: "always() && needs.check_changes.outputs.run_build_ddm_windows == 'true'"
# The type of runner that the job will run on
runs-on: windows-2022
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a set of commands using the runners shell
# Support longpaths
- name: Support long paths
run: git config --system core.longpaths true
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Install gpg secret key
id: installGPGKeyForMaven
continue-on-error: true
run: |
cat <(echo -e "${{ secrets.MAVEN_GPG_PRIVATE_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
shell: bash
- name: set up msvc env
if: ${{ github.repository_owner != 'masesgroup' || (github.repository_owner == 'masesgroup' && steps.installGPGKeyForMaven.outcome == 'success') }}
uses: ilammy/[email protected]
- name: Build Common Tools
shell: cmd
run: |
cd third_party\CommonTools
msbuild -p:Configuration=Release,Platform="Any CPU" -m CommonTools.sln
- name: Extract commit SHA
run: |
echo "GITHUB_COMMIT_MESSAGE=$(echo $GITHUB_SHA)" >> $GITHUB_ENV
shell: bash
- name: Prepare version
shell: cmd
run: |
cd third_party\CommonTools\Output
VersionGenerator %GITHUB_WORKSPACE%\src\ProductInformation\Version.cs %GITHUB_WORKSPACE%\src\ProductInformation ${{ env.GITHUB_COMMIT_MESSAGE }}
env:
GITHUB_WORKSPACE: $GITHUB_WORKSPACE
- name: Prepare packaging versioning
shell: cmd
run: |
third_party\CommonTools\Output\PlaceHolderReplacer.exe .\src\ProductInformation\Version.cs .\packaging\nuget\datadistributionmanager.nuspec >> .\nuget_version.txt
third_party\CommonTools\Output\PlaceHolderReplacer.exe .\src\ProductInformation\Version.cs .\packaging\maven\pom.xml "-SNAPSHOT"
- name: Store version
run: |
echo "NUGET_PACKAGE_VERSION=$(cat nuget_version.txt)" >> $GITHUB_ENV
shell: bash
- name: Verify Nuget version in file
run: |
type .\packaging\nuget\datadistributionmanager.nuspec
echo ${{ env.NUGET_PACKAGE_VERSION }}
shell: cmd
- name: Configure OpenDDS to download ACE/TAO
shell: cmd
run: |
cd third_party\OpenDDS
configure
- name: Restore OpenDDS from cache
uses: actions/cache/restore@v3
with:
fail-on-cache-miss: true
enableCrossOsArchive: true
path: ./OutputOpenDDS/
key: OpenDDS_3.25
- name: Prepare OpenDDS Binaries
run: |
Expand-Archive -LiteralPath '.\OutputOpenDDS\OpenDDS_Build_3.25.zip' -DestinationPath .\Output -Force
- name: Prepare OpenDDS Headers
run: |
Expand-Archive -LiteralPath '.\OutputOpenDDS\OpenDDS_Headers_3.25.zip' -DestinationPath .\third_party\OpenDDS -Force
- name: Move OpenDDS x64
shell: cmd
run: |
xcopy .\Output\bin32\*.* .\third_party\OpenDDS\bin\
xcopy .\Output\x86\*.dll .\third_party\OpenDDS\lib\
xcopy .\Output\bin32\*.* .\third_party\OpenDDS\ACE_wrappers\bin\
xcopy .\Output\x86\*.dll .\third_party\OpenDDS\ACE_wrappers\lib\
- name: Generate OpenDDS projects
shell: cmd
run: |
call .\third_party\OpenDDS\setenv.cmd
cd src\DataDistributionManagerOpenDDS
perl %ACE_ROOT%\bin\generate_export_file.pl DataDistributionSchemaCommon > DataDistributionSchemaCommon_Export.h
perl %ACE_ROOT%\bin\mwc.pl -type vs2022 DataDistributionManagerOpenDDS.mwc
cd ..\..
- uses: nuget/[email protected]
with:
nuget-version: '5.x'
- run: nuget restore src\DataDistributionManager.sln
- name: Build DataDistributionManager x64
shell: cmd
run: |
call .\third_party\OpenDDS\setenv.cmd
set JDK_ROOT_FOLDER=%JAVA_HOME_11_X64%
cd src
msbuild /m -p:Configuration=Release,Platform=x64 DataDistributionManager.sln
- name: Build DataDistributionManager x86
shell: cmd
run: |
call .\third_party\OpenDDS\setenv.cmd
set JDK_ROOT_FOLDER=%JAVA_HOME_11_X64%
cd src
msbuild /m -p:Configuration=Release,Platform=Win32 DataDistributionManager.sln
- name: Build DataDistributionManager net462, net6.0 and net7.0
run: |
dotnet build --no-incremental --configuration Release --framework net462 -o Output src\DataDistributionManagerNet\DataDistributionManagerNet.csproj
dotnet build --no-incremental --configuration Release --framework net6.0 -o Outputnet6.0 src\DataDistributionManagerNet\DataDistributionManagerNet.csproj
dotnet build --no-incremental --configuration Release --framework net7.0 -o Outputnet7.0 src\DataDistributionManagerNet\DataDistributionManagerNet.csproj
- name: Prepare for packaging
run: |
New-Item -Path .\OutputPackage -ItemType directory
New-Item -Path .\OutputPackage\lib -ItemType directory
New-Item -Path .\OutputPackage\lib\x86 -ItemType directory
New-Item -Path .\OutputPackage\lib\x64 -ItemType directory
New-Item -Path .\OutputPackage\runtime -ItemType directory
New-Item -Path .\OutputPackage\runtime\x86 -ItemType directory
New-Item -Path .\OutputPackage\runtime\x64 -ItemType directory
New-Item -Path .\OutputPackage\pdb -ItemType directory
New-Item -Path .\OutputPackage\pdb\x86 -ItemType directory
New-Item -Path .\OutputPackage\pdb\x64 -ItemType directory
New-Item -Path .\OutputPackage\include -ItemType directory
New-Item -Path .\OutputPackage\licenses -ItemType directory
Copy-Item .\src\DataDistributionManager\DataDistributionManagerEnums.h .\OutputPackage\include\DataDistributionManagerEnums.h
Copy-Item .\src\DataDistributionManager\DataDistributionManagerTypes.h .\OutputPackage\include\DataDistributionManagerTypes.h
Copy-Item .\src\DataDistributionManager\DataDistributionManager.h .\OutputPackage\include\DataDistributionManager.h
Copy-Item .\src\DataDistributionManager\SmartDataDistributionManager.h .\OutputPackage\include\SmartDataDistributionManager.h
Copy-Item .\Output\x86\DataDistributionManager.lib .\OutputPackage\lib\x86\DataDistributionManager.lib -Force
Copy-Item .\Output\x64\DataDistributionManager.lib .\OutputPackage\lib\x64\DataDistributionManager.lib -Force
Copy-Item .\Output\*.dll .\OutputPackage\runtime\ -Force
Copy-Item .\Output\x86\*.dll .\OutputPackage\runtime\x86\ -Force
Copy-Item .\Output\bin32\dcpsinfo_dump.exe .\OutputPackage\runtime\x86\ -Force
Copy-Item .\Output\bin32\DCPSInfoRepo.exe .\OutputPackage\runtime\x86\ -Force
Copy-Item .\Output\bin32\repoctl.exe .\OutputPackage\runtime\x86\ -Force
Copy-Item .\Output\x64\*.dll .\OutputPackage\runtime\x64\ -Force
Copy-Item .\Output\bin64\dcpsinfo_dump.exe .\OutputPackage\runtime\x64\ -Force
Copy-Item .\Output\bin64\DCPSInfoRepo.exe .\OutputPackage\runtime\x64\ -Force
Copy-Item .\Output\bin64\repoctl.exe .\OutputPackage\runtime\x64\ -Force
Copy-Item .\Output\x86\*.pdb .\OutputPackage\pdb\x86\ -Force
Copy-Item .\Output\pdb32\*.pdb .\OutputPackage\pdb\x86\ -Force
Copy-Item .\Output\x64\*.pdb .\OutputPackage\pdb\x64\ -Force
Copy-Item .\Output\pdb64\*.pdb .\OutputPackage\pdb\x64\ -Force
Copy-Item .\LICENSE .\OutputPackage\licenses\LICENSE.datadistributionmanager -Force
Copy-Item .\src\packages\librdkafka.redist.2.2.0\LICENSES.txt .\OutputPackage\licenses\LICENSE.librdkafka -Force
Copy-Item .\third_party\OpenDDS\LICENSE .\OutputPackage\licenses\LICENSE.opendds -Force
Compress-Archive -Path .\OutputPackage\* -DestinationPath .\OutputPackage\DataDistributionManager.zip
- name: Prepare for Java packaging
run: |
New-Item -Path .\OutputJava -ItemType directory
New-Item -Path .\OutputJava\windows_x64 -ItemType directory
New-Item -Path .\OutputJava\windows_x86 -ItemType directory
Compress-Archive -Path .\OutputPackage\runtime\x64\* -DestinationPath .\OutputJava\windows_x64\nativepackage.zip
Compress-Archive -Path .\OutputPackage\runtime\x86\* -DestinationPath .\OutputJava\windows_x86\nativepackage.zip
- name: Set up Apache Maven Central
uses: actions/setup-java@v3
with: # running setup-java again overwrites the settings.xml
java-version: 11
distribution: temurin
cache: 'maven'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Publish to Apache Maven Central
id: publishOnMaven
continue-on-error: true
shell: bash
run: mvn --file ./packaging/maven/pom.xml --no-transfer-progress --batch-mode -Dgpg.passphrase=${{ secrets.MAVEN_GPG_PASSPHRASE }} deploy
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Build Java Binder
if: ${{ github.repository_owner != 'masesgroup' || (github.repository_owner == 'masesgroup' && steps.publishOnMaven.outcome == 'success') }}
shell: cmd
run: |
cd src\DataDistributionManagerJava
set JDK_ROOT_FOLDER=%JAVA_HOME_11_X64%
CreateJar.bat
cd ..\..
- name: Clear documentation folder
run: Remove-Item .\docs\* -Recurse -Force -Exclude _config.yml,CNAME
- name: Download Doxygen tool
run: C:\msys64\usr\bin\wget.exe https://www.doxygen.nl/files/doxygen-1.9.7.windows.x64.bin.zip
- name: Expand Doxygen package
run: Expand-Archive -LiteralPath '.\doxygen-1.9.7.windows.x64.bin.zip' -DestinationPath .\src\Documentation -Force
- name: Create C/C++ documentation
shell: cmd
run: |
cd src\Documentation
doxygen Doxyfile
- run: dotnet tool update -g docfx
- name: Build documentation
run: |
cd src\Documentation
docfx
- uses: nuget/[email protected]
with:
nuget-version: '5.x'
- run: nuget pack packaging\nuget\datadistributionmanager.nuspec
- uses: actions/upload-artifact@v3
with:
name: MASES.DataDistributionManager.${{ env.NUGET_PACKAGE_VERSION }}.nupkg
path: .\MASES.DataDistributionManager.${{ env.NUGET_PACKAGE_VERSION }}.nupkg
- uses: actions/upload-artifact@v3
with:
name: MavenDeploy
path: .\packaging\maven\target\*.jar
- uses: actions/upload-artifact@v3
with:
name: DataDistributionManager.jar
path: .\Output\datadistributionmanager.jar
- uses: actions/upload-artifact@v3
with:
name: DataDistributionManager.zip
path: .\OutputPackage\DataDistributionManager.zip
- name: Extract commit SHA
run: |
echo "GITHUB_COMMIT_MESSAGE=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV
shell: bash
- name: Request a PR to commit changes
if: ${{ github.repository_owner == 'masesgroup'}} #do not push any changes outside main repo
uses: peter-evans/create-pull-request@v5
with:
branch-suffix: short-commit-hash
add-paths: docs/*.*
commit-message: Update documentation after commit ${{ env.GITHUB_COMMIT_MESSAGE }}
title: Changes by GitHub action
body: Automated changes by GitHub action
reviewers: masesdevelopers
assignees: masesdevelopers
labels: documentation, enhancement