forked from aws/amazon-documentdb-odbc-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
707 lines (623 loc) · 24.6 KB
/
win-build.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
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
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
name: ODBC Driver for Windows
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
workflow_dispatch:
inputs:
sign:
description: Build and Sign Artifacts (for release only)
type: boolean
required: false
default: false
env:
SIGNING_ENABLED: ${{ github.event.inputs.sign }}
CI_OUTPUT_PATH: "ci-output"
ODBC_LIB_PATH: "${{github.workspace}}/build/odbc/lib"
ODBC_BIN_PATH: "${{github.workspace}}/build/odbc/bin/Release"
ODBC_DEBUG_PATH: "${{github.workspace}}/build/odbc/bin/Debug"
ODBC_BUILD_PATH: "${{github.workspace}}/build/odbc/cmake"
VCPKG_ROOT: "c:/vcpkg"
DOCUMENTDB_HOME: "${{github.workspace}}/build/odbc/bin/Release"
DOC_DB_KEYPAIR: ${{secrets.DOC_DB_KEYPAIR}}
DOC_DB_USER_NAME: ${{secrets.DOC_DB_USER_NAME}}
DOC_DB_PASSWORD: ${{secrets.DOC_DB_PASSWORD}}
DOC_DB_USER: ${{secrets.DOC_DB_USER}}
DOC_DB_HOST: ${{secrets.DOC_DB_HOST}}
DOC_DB_ODBC_INTEGRATION_TEST: 1
DOC_DB_LOCAL_PORT: 27019
DOC_DB_REMOTE_PORT: 27017
DOC_DB_PRIV_KEY_FILE: ~/certs/docdb-sshtunnel.pem
DOC_DB_LOG_PATH: "${{github.workspace}}/build/odbc/logs"
DOC_DB_LOG_LEVEL: "debug"
MONGO_IMPORT_COMMAND: "mongoimport.exe"
# Artifacts are created when pushing to develop branch on merge of pull requests.
SHOULD_CREATE_ARTIFACTS: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/develop') || github.event.inputs.sign == true || github.event.inputs.sign == 'true' }}
jobs:
trufflehog-git-secrets-scan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: TruffleHog OSS
uses: trufflesecurity/trufflehog@main
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
extra_args: --debug --only-verified
- name: git secrets
run: |
git clone https://github.com/awslabs/git-secrets.git
cd git-secrets
sudo make install
cd ..
git secrets --register-aws
git secrets --scan-history
build-windows32:
runs-on: windows-2022
needs: trufflehog-git-secrets-scan
steps:
- uses: actions/checkout@v2
# TODO Reactivate cppcheck
# https://github.com/aws/amazon-documentdb-odbc-driver/issues/171
# - name: setup-cppcheck
# id: setup_cppcheck
# run: |
# choco install cppcheck -y -d
# echo "C:\Program Files\Cppcheck" >> $env:GITHUB_PATH
# - name: run-cppcheck
# id: run-cppcheck
# run: |
# .\run_cppcheck.ps1
# - name: upload-cppcheck-results
# if: failure()
# uses: actions/upload-artifact@v3
# with:
# name: cppcheck-results
# path: cppcheck-results.log
- name: Update environment with ODBC_DRIVER_VERSION
shell: pwsh
run: |
Get-Content ./src/ODBC_DRIVER_VERSION.txt | ForEach-Object { echo "ODBC_DRIVER_VERSION=$_"; break; } >> $env:GITHUB_ENV
- name: Update environment with JDBC_DRIVER_VERSION
shell: pwsh
run: |
echo "JDBC_DRIVER_VERSION=$($(Get-Content -Path ./src/JDBC_DRIVER_VERSION.txt -Raw).ToString().Trim())" >> $env:GITHUB_ENV
# Get first JDK to provide access to jpackage
- name: Get Java distribution (JDK 17, 32-bit)
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
architecture: x86
# Get second JDK to provide access to jlink
- name: Get Java distribution (JDK 11, 32-bit)
shell: pwsh
run: |
. ./scripts/functions_win.ps1
Install-JavaJdk -InstallParentPath "jdks" -PlatformArchitecture "x86" -JdkVersion "11"
echo "JAVA_HOME=$env:JAVA_HOME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: "Update path for Java"
run: |
echo "${{env.JAVA_HOME}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "${{env.JAVA_HOME}}\bin\server" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Ensure jlink and jpackage have the expected versions
run: |
if ( -not ((jlink --version) -like "11*") ) { exit 1 }
if ( -not ((jpackage --version) -like "17*") ) { exit 1 }
- name: "Update path for WIX Toolset"
run: |
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Get latest version of CMake
uses: lukka/get-cmake@latest
- name: add-msbuild-to-path
uses: microsoft/[email protected]
- name: Extract key-pair into file
run: |
mkdir -p ~/certs
echo "${{env.DOC_DB_KEYPAIR}}" > ~/certs/docdb-sshtunnel.pem
chmod 400 ~/certs/docdb-sshtunnel.pem
mkdir -p ~/.ssh
copy ./src/odbc-test/config/ssh_config ~/.ssh/config
- name: Cache dependencies Windows 32
id: cache-dependencies-windows-32
uses: actions/cache@v3
with:
path: |
${{ env.VCPKG_ROOT }}
key: ${{ runner.os }}-cache-dependencies-windows-32-v1
- name: Cache DocumentDB JDBC JAR
id: cache-documentdb-jdbc-jar
uses: actions/cache@v3
with:
path: |
cache/jar
key: cache-documentdb-jdbc-jar-${{env.JDBC_DRIVER_VERSION}}
- name: Download DocumentDB JDBC JAR
if: steps.cache-documentdb-jdbc-jar.outputs.cache-hit != 'true'
run: |
mkdir -p cache/jar
cd cache/jar
Invoke-WebRequest https://github.com/aws/amazon-documentdb-jdbc-driver/releases/download/v${{env.JDBC_DRIVER_VERSION}}/documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar -o documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar
- name: Install DocumentDB JDBC JAR
run: |
mkdir -p ${{env.ODBC_BIN_PATH}}/libs
cp cache/jar/documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar ${{env.ODBC_BIN_PATH}}/libs
- name: Install dependencies Windows
shell: pwsh
run: |
. ./scripts/functions_win.ps1
Install-VcpkgPackages -Triplet x86-windows
env:
VCPKG_ROOT: ${{ env.VCPKG_ROOT }}
- name: configure-and-build-driver
run: |
.\build_win_release32.ps1
env:
OPENSSL_ROOT_DIR: '${{ env.VCPKG_ROOT }}/packages/openssl_x86-windows'
- name: "Configure AWS credentials"
if: ${{env.SIGNING_ENABLED == 'true'}}
uses: aws-actions/configure-aws-credentials@v1
with:
role-skip-session-tagging: true
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-external-id: ${{ secrets.AWS_ROLE_EXTERNAL_ID }}
role-duration-seconds: 3600
- name: Sign Executables
if: ${{env.SIGNING_ENABLED == 'true'}}
id: sign-executables-32
shell: pwsh
run: |
. ./scripts/sign_installer.ps1
Install-Jq
Invoke-SignInstaller "${{env.ODBC_BIN_PATH}}" x86 ${{env.ODBC_DRIVER_VERSION}} ${{ secrets.AWS_UNSIGNED_BUCKET }} ${{ secrets.AWS_SIGNED_BUCKET }} ${{ secrets.AWS_KEY }}
- name: Upload ODBC driver build at push to develop
if: ${{env.SHOULD_CREATE_ARTIFACTS == 'true'}}
uses: actions/upload-artifact@v3
with:
name: docdb-odbc-driver-win32-${{env.ODBC_DRIVER_VERSION}}
path: |
${{env.ODBC_BIN_PATH}}/*.dll
${{env.ODBC_BIN_PATH}}/*.msi
${{env.ODBC_BIN_PATH}}/*.exe
${{env.ODBC_BIN_PATH}}/*.pdb
!${{env.ODBC_BIN_PATH}}/images
!${{env.ODBC_BIN_PATH}}/jpackage-resources
!${{env.ODBC_BIN_PATH}}/runtime-image
- name: Upload performance test at push to develop
if: ${{env.SHOULD_CREATE_ARTIFACTS == 'true'}}
uses: actions/upload-artifact@v3
with:
name: performance-win32-${{env.ODBC_DRIVER_VERSION}}
path: build/odbc/bin/Release/performance.exe
- name: register-driver
run: |
.\src\odbc\install\install_amd64.cmd ${{env.ODBC_BIN_PATH}}\documentdb.odbc.dll ${{env.ODBC_BIN_PATH}}\documentdb.odbc.dll
- name: Setup MongoDB
run: |
./scripts/reinstall_mongodb.ps1
- name: Import test data
run: |
./src/odbc-test/scripts/import_test_data.ps1
- name: run-tests
id: runtests
run: |
mkdir -p "${{env.DOC_DB_LOG_PATH}}"
Start-Process -NoNewWindow ssh "-f -N -o UserKnownHostsFile=/temp -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}"
${{env.ODBC_BIN_PATH}}/documentdb-odbc-tests.exe
- name: upload-test-report
if: always()
uses: EnricoMi/publish-unit-test-result-action/[email protected]
with:
check_name: "Windows x32 Build Unit Test Results Check"
comment_title: "Windows 2022 (x32) Build Unit Test Results"
files: ./odbc_test_result.xml
- name: upload-test-file
if: always() && (steps.runtests.outcome == 'failure')
uses: actions/upload-artifact@v3
with:
name: odbc-test-results-win32
path: |
./odbc_test_result.xml
./build/odbc/logs/docdb_odbc_*.log
# - name: build-installer
# if: success()
# run: |
# .\scripts\build_installer.ps1 Release Win32 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
# - name: prepare-output
# if: success()
# run: |
# .\scripts\prepare_ci_output.ps1 $Env:ODBC_BIN_PATH $Env:ODBC_LIB_PATH $Env:ODBC_BUILD_PATH
# - name: upload-build
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: windows32-build
# path: ci-output/build
# - name: upload-installer
# if: success()
# uses: actions/upload-artifact@v3
# with:
# name: windows32-installer
# path: ci-output/installer
# - name: upload-test-results
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: windows-test-results
# path: $CI_OUTPUT_PATH/test
build-windows64:
runs-on: windows-2022
needs: trufflehog-git-secrets-scan
steps:
- uses: actions/checkout@v2
- uses: aws-actions/configure-aws-credentials@v1
with:
role-skip-session-tagging: true
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-external-id: ${{ secrets.AWS_ROLE_EXTERNAL_ID }}
role-duration-seconds: 3600
# TODO Reactivate cppcheck
# https://github.com/aws/amazon-documentdb-odbc-driver/issues/171
# - name: run-cppcheck
# id: setup_cppcheck
# run: |
# choco install cppcheck -y -d
# echo "C:\Program Files\Cppcheck" >> $env:GITHUB_PATH
# - name: run-cppcheck
# id: run-cppcheck
# run: |
# .\run_cppcheck.ps1
# - name: upload-cppcheck-results
# if: failure()
# uses: actions/upload-artifact@v3
# with:
# name: cppcheck-results
# path: cppcheck-results.log
- name: Update environment with ODBC_DRIVER_VERSION
shell: pwsh
run: |
Get-Content ./src/ODBC_DRIVER_VERSION.txt | ForEach-Object { echo "ODBC_DRIVER_VERSION=$_"; break; } >> $env:GITHUB_ENV
- name: Update environment with JDBC_DRIVER_VERSION
shell: pwsh
run: |
echo "JDBC_DRIVER_VERSION=$($(Get-Content -Path ./src/JDBC_DRIVER_VERSION.txt -Raw).ToString().Trim())" >> $env:GITHUB_ENV
- name: Get Java distribution
shell: pwsh
run: |
. ./scripts/functions_win.ps1
Install-JavaJdk -InstallParentPath "jdks" -PlatformArchitecture "x64"
echo "JAVA_HOME=$env:JAVA_HOME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: "Update path for Java"
run: |
echo "${{env.JAVA_HOME}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "${{env.JAVA_HOME}}\bin\server" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: "Update path for WIX Toolset"
run: |
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Get latest version of CMake
uses: lukka/get-cmake@latest
- name: add-msbuild-to-path
uses: microsoft/[email protected]
- name: Extract key-pair into file
run: |
mkdir -p ~/certs
echo "${{env.DOC_DB_KEYPAIR}}" > ~/certs/docdb-sshtunnel.pem
chmod 400 ~/certs/docdb-sshtunnel.pem
mkdir -p ~/.ssh
copy ./src/odbc-test/config/ssh_config ~/.ssh/config
- name: Cache dependencies Windows 64
id: cache-dependencies-windows-64
uses: actions/cache@v3
with:
path: |
${{ env.VCPKG_ROOT }}
key: ${{ runner.os }}-cache-dependencies-windows-64-v1
- name: Cache DocumentDB JDBC JAR
id: cache-documentdb-jdbc-jar
uses: actions/cache@v3
with:
path: |
cache/jar
key: cache-documentdb-jdbc-jar-${{env.JDBC_DRIVER_VERSION}}
- name: Download DocumentDB JDBC JAR
if: steps.cache-documentdb-jdbc-jar.outputs.cache-hit != 'true'
run: |
mkdir -p cache/jar
cd cache/jar
Invoke-WebRequest https://github.com/aws/amazon-documentdb-jdbc-driver/releases/download/v${{env.JDBC_DRIVER_VERSION}}/documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar -o documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar
- name: Install DocumentDB JDBC JAR
run: |
mkdir -p ${{env.ODBC_BIN_PATH}}/libs
cp cache/jar/documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar ${{env.ODBC_BIN_PATH}}/libs
- name: Install dependencies Windows
shell: pwsh
run: |
. ./scripts/functions_win.ps1
Install-VcpkgPackages -Triplet x64-windows
env:
VCPKG_ROOT: ${{env.VCPKG_ROOT}}
- name: configure-and-build-driver
run: |
.\build_win_release64.ps1
env:
OPENSSL_ROOT_DIR: '${{env.VCPKG_ROOT}}/packages/openssl_x64-windows'
- name: "Configure AWS credentials"
if: ${{env.SIGNING_ENABLED == 'true'}}
uses: aws-actions/configure-aws-credentials@v1
with:
role-skip-session-tagging: true
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-external-id: ${{ secrets.AWS_ROLE_EXTERNAL_ID }}
role-duration-seconds: 3600
- name: Sign Executables
if: ${{env.SIGNING_ENABLED == 'true'}}
id: sign-executables-64
shell: pwsh
run: |
. ./scripts/sign_installer.ps1
Install-Jq
Invoke-SignInstaller "${{env.ODBC_BIN_PATH}}" amd64 ${{env.ODBC_DRIVER_VERSION}} ${{ secrets.AWS_UNSIGNED_BUCKET }} ${{ secrets.AWS_SIGNED_BUCKET }} ${{ secrets.AWS_KEY }}
- name: Upload ODBC driver build at push to develop
if: ${{env.SHOULD_CREATE_ARTIFACTS == 'true'}}
uses: actions/upload-artifact@v3
with:
name: docdb-odbc-driver-amd64-${{env.ODBC_DRIVER_VERSION}}
path: |
${{env.ODBC_BIN_PATH}}/*.dll
${{env.ODBC_BIN_PATH}}/*.msi
${{env.ODBC_BIN_PATH}}/*.exe
${{env.ODBC_BIN_PATH}}/*.pdb
!${{env.ODBC_BIN_PATH}}/images
!${{env.ODBC_BIN_PATH}}/jpackage-resources
!${{env.ODBC_BIN_PATH}}/runtime-image
- name: Upload performance test at push to develop
if: ${{env.SHOULD_CREATE_ARTIFACTS == 'true'}}
uses: actions/upload-artifact@v3
with:
name: performance-amd64-${{env.ODBC_DRIVER_VERSION}}
path: build/odbc/bin/Release/performance.exe
- name: register-driver
run: |
.\src\odbc\install\install_amd64.cmd ${{env.ODBC_BIN_PATH}}\documentdb.odbc.dll
- name: Setup MongoDB
run: |
./scripts/reinstall_mongodb.ps1
- name: Import test data
run: |
./src/odbc-test/scripts/import_test_data.ps1
- name: run-tests
run: |
Start-Process -NoNewWindow ssh "-f -N -o UserKnownHostsFile=/temp -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}"
${{env.ODBC_BIN_PATH}}/documentdb-odbc-tests.exe
- name: upload-test-report
if: always()
uses: EnricoMi/publish-unit-test-result-action/[email protected]
with:
check_name: "Windows 2022 (x64) Build Unit Test Results Check"
comment_title: "Windows 2022 (x64) Build Unit Test Results"
files: ./odbc_test_result.xml
- name: upload-test-file
if: always()
uses: actions/upload-artifact@v3
with:
name: odbc-test-results-win64
path: |
./odbc_test_result.xml
./build/odbc/logs/docdb_odbc_*.log
# - name: build-installer
# if: success()
# run: |
# .\scripts\build_installer.ps1 Release x64 .\src $Env:ODBC_BUILD_PATH $Env:AWS_SDK_INSTALL_PATH
# - name: prepare-output
# if: success()
# run: |
# .\scripts\prepare_ci_output.ps1 $Env:ODBC_BIN_PATH $Env:ODBC_LIB_PATH $Env:ODBC_BUILD_PATH
# - name: upload-build
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: windows64-build
# path: ci-output/build
# - name: upload-installer
# if: success()
# uses: actions/upload-artifact@v3
# with:
# name: windows64-installer
# path: ci-output/installer
build-windows64_coverage:
runs-on: windows-2022
needs: trufflehog-git-secrets-scan
steps:
- uses: actions/checkout@v2
- name: Update environment with JDBC_DRIVER_VERSION
shell: pwsh
run: |
echo "JDBC_DRIVER_VERSION=$($(Get-Content -Path ./src/JDBC_DRIVER_VERSION.txt -Raw).ToString().Trim())" >> $env:GITHUB_ENV
- name: Get Java distribution
shell: pwsh
run: |
. ./scripts/functions_win.ps1
Install-JavaJdk -InstallParentPath "jdks" -PlatformArchitecture "x64"
echo "JAVA_HOME=$env:JAVA_HOME" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: "Update path for Java"
run: |
echo "${{env.JAVA_HOME}}\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "${{env.JAVA_HOME}}\bin\server" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: "Update path for WIX Toolset"
run: |
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Get latest version of CMake
uses: lukka/get-cmake@latest
- name: add-msbuild-to-path
uses: microsoft/[email protected]
- name: Extract key-pair into file
run: |
mkdir -p ~/certs
echo "${{env.DOC_DB_KEYPAIR}}" > ~/certs/docdb-sshtunnel.pem
chmod 400 ~/certs/docdb-sshtunnel.pem
mkdir -p ~/.ssh
copy ./src/odbc-test/config/ssh_config ~/.ssh/config
- name: setup-opencppcoverage-and-add-to-path
id: setup_opencppcoverage
run: |
choco install OpenCppCoverage -y
echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
- name: Cache dependencies Windows 64
id: cache-dependencies-windows-64
uses: actions/cache@v3
with:
path: |
${{ env.VCPKG_ROOT }}
key: ${{ runner.os }}-cache-dependencies-windows-64-v1
- name: Cache DocumentDB JDBC JAR
id: cache-documentdb-jdbc-jar
uses: actions/cache@v3
with:
path: |
cache/jar
key: cache-documentdb-jdbc-jar-${{env.JDBC_DRIVER_VERSION}}
- name: Download DocumentDB JDBC JAR
if: steps.cache-documentdb-jdbc-jar.outputs.cache-hit != 'true'
run: |
mkdir -p cache/jar
cd cache/jar
Invoke-WebRequest https://github.com/aws/amazon-documentdb-jdbc-driver/releases/download/v${{env.JDBC_DRIVER_VERSION}}/documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar -o documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar
- name: Install DocumentDB JDBC JAR
run: |
mkdir -p ${{env.ODBC_BIN_PATH}}/libs
cp cache/jar/documentdb-jdbc-${{env.JDBC_DRIVER_VERSION}}-all.jar ${{env.ODBC_BIN_PATH}}/libs
- name: Install dependencies Windows
shell: pwsh
run: |
. ./scripts/functions_win.ps1
Install-VcpkgPackages -Triplet x64-windows
env:
VCPKG_ROOT: ${{env.VCPKG_ROOT}}
- name: configure-and-build-driver
run: |
.\build_win_debug64.ps1
env:
OPENSSL_ROOT_DIR: '${{env.VCPKG_ROOT}}/packages/openssl_x64-windows'
- name: register-driver
run: |
.\src\odbc\install\install_amd64.cmd ${{env.ODBC_DEBUG_PATH}}\documentdb.odbc.dll
- name: Setup MongoDB
run: |
./scripts/reinstall_mongodb.ps1
- name: Import test data
run: |
./src/odbc-test/scripts/import_test_data.ps1
- name: run-tests
env:
DOCUMENTDB_HOME: "${{github.workspace}}/build/odbc/bin/Debug"
run: |
Start-Process -NoNewWindow ssh "-f -N -o UserKnownHostsFile=/temp -o StrictHostKeyChecking=no -i ${{env.DOC_DB_PRIV_KEY_FILE}} -L${{env.DOC_DB_LOCAL_PORT}}:${{secrets.DOC_DB_HOST}}:${{env.DOC_DB_REMOTE_PORT}} ${{secrets.DOC_DB_USER}}"
opencppcoverage --sources src --export_type cobertura:coverage.cobertura.xml --excluded_modules boost_unit_test_framework --excluded_modules documentdb-odbc-tests --excluded_modules mongoc --excluded_modules mongocxx --excluded_modules bson --excluded_modules bsoncxx --excluded_modules zlib -- ${{env.ODBC_DEBUG_PATH}}/documentdb-odbc-tests.exe
- name: upload-coverage
if: always()
uses: actions/upload-artifact@v3
with:
name: code-coverage
path: coverage.cobertura.xml
comment_PR_coverage:
runs-on: ubuntu-latest
needs: build-windows64_coverage
steps:
- uses: actions/checkout@v3
with:
ref: ''
- name: Retrieve coverage
uses: actions/download-artifact@v2
with:
name: code-coverage
- name: Code Coverage Summary Report
uses: irongut/[email protected]
with:
filename: coverage.cobertura.xml
badge: true
format: markdown
indicators: true
output: both
- name: Code Coverage Badge
uses: irongut/[email protected]
with:
filename: coverage.cobertura.xml
badge: true
format: text
indicators: true
output: both
- name: Extract Code Coverage Badge
run: |
COVERAGE_BADGE=$(head -1 code-coverage-results.txt )
COVERAGE_BADGE="${COVERAGE_BADGE/'Code%20Coverage'/'Windows%20Code%20Coverage'}"
curl $COVERAGE_BADGE > .github/badges/coverage_badge_windows.svg
- name: Commit Coverage Badge
if: github.event_name == 'pull_request'
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_options: '--allow-empty --no-verify'
commit_message: Commit Code Coverage Badge
file_pattern: '*.svg'
skip_fetch: false
skip_checkout: false
skip_dirty_check: false
- name: Add Header for Code Coverage Summary Report
run: |
echo "## Windows 2022 (x64) Debug Build Unit Test Results Check" > coverage-cobertura.md
cat code-coverage-results.md >> coverage-cobertura.md
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
header: windows
recreate: true
path: coverage-cobertura.md
# - name: upload-coverage
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: code-coverage
# path: coverage
#
# The step below should be uncommented after the codecov is setup
# - name: Upload Report to Codecov
# if: always()
# uses: codecov/[email protected]
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./coverage.xml
# fail_ci_if_error: true
build-power-bi-connector:
runs-on: windows-2022
needs: trufflehog-git-secrets-scan
steps:
- uses: actions/checkout@v2
- name: Build Power BI Connector
shell: pwsh
run: |
cd src\power-bi-connector\
.\AmazonDocumentDBConnector.ps1
- name: Upload Power BI Connector
if: always()
uses: actions/upload-artifact@v3
with:
name: AmazonDocumentDBConnector
path: src/power-bi-connector/AmazonDocumentDBConnector.mez