forked from godaddy/asherah
-
Notifications
You must be signed in to change notification settings - Fork 0
818 lines (794 loc) · 28.4 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
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
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
name: Continuous Integration
on:
push:
branches:
# Push events on master branch
- master
# Push events to branches matching refs/heads/release-
- 'release-*'
pull_request:
branches: [ master ]
#### Global environment variables
env:
DYNAMODB_HOSTNAME: dynamodb
MYSQL_HOSTNAME: mysql
MYSQL_DATABASE: testdb
MYSQL_USERNAME: root
MYSQL_PASSWORD: Password123
DISABLE_TESTCONTAINERS: true
AWS_ACCESS_KEY_ID: dummy_key
AWS_SECRET_ACCESS_KEY: dummy_secret
AWS_DEFAULT_REGION: us-west-2
AWS_REGION: us-west-2
GO111MODULE: "on"
jobs:
#### Java
java-secure-memory:
name: Build Java Secure Memory
runs-on: ubuntu-latest
container:
image: adoptopenjdk/maven-openjdk11
options: --ulimit core=-1 --ulimit memlock=-1:-1
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache Java packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}-v1
restore-keys: ${{ runner.os }}-m2-
- name: Build
run: |
cd java/secure-memory
./scripts/clean.sh
./scripts/build.sh
- name: Test
run: |
cd java/secure-memory
./scripts/test.sh
release-java-secure-memory:
if: startsWith( github.ref, 'refs/heads/release-' ) && github.repository == 'godaddy/asherah'
name: Release Java Secure Memory
needs: java-secure-memory
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
token: ${{ secrets.MERGE_TOKEN }}
- name: Fetch all tags
run: git fetch --prune --unshallow --tags
- name: Set up Maven Central Repository
uses: actions/setup-java@8764a52df183aa0ccea74521dfd9d506ffc7a19a
with:
java-version: '11'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
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: Cache Java packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}-v1
restore-keys: ${{ runner.os }}-m2-
- name: Publish Java SecureMemory
run: |
cd java/secure-memory
BASE_VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)
VERSION_SUFFIX=`echo ${BASE_VERSION} | cut -f2 -d'-'`
BRANCH=`echo ${GITHUB_REF#refs/heads/}`
if [[ "${BRANCH}" =~ release-.* && "${VERSION_SUFFIX}" != "alpha" ]]; then
./scripts/release_prod.sh
fi
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
java-app-encryption:
name: Build Java Application Encryption
needs: java-secure-memory
runs-on: ubuntu-latest
container:
image: adoptopenjdk/maven-openjdk11
options: --ulimit core=-1 --ulimit memlock=-1:-1
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache Java packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}-v1
restore-keys: ${{ runner.os }}-m2-
- name: Build
run: |
cd java/app-encryption
./scripts/clean.sh
./scripts/build.sh
- name: Unit tests
run: |
cd java/app-encryption
./scripts/test.sh
- name: Integration tests
run: |
cd java/app-encryption
./scripts/integration_test.sh
release-java-app-Encryption:
if: startsWith( github.ref, 'refs/heads/release-' ) && github.repository == 'godaddy/asherah'
name: Release Java App Encryption
needs: java-app-encryption
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
token: ${{ secrets.MERGE_TOKEN }}
- name: Fetch all tags
run: git fetch --prune --unshallow --tags
- name: Set up Maven Central Repository
uses: actions/setup-java@8764a52df183aa0ccea74521dfd9d506ffc7a19a
with:
java-version: '11'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
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: Cache Java packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}-v1
restore-keys: ${{ runner.os }}-m2-
- name: Publish Java AppEncryption
run: |
cd java/app-encryption
BASE_VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)
VERSION_SUFFIX=`echo ${BASE_VERSION} | cut -f2 -d'-'`
BRANCH=`echo ${GITHUB_REF#refs/heads/}`
if [[ "${BRANCH}" =~ release-.* && "${VERSION_SUFFIX}" != "alpha" ]]; then
./scripts/release_prod.sh
fi
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
java-reference-app:
name: Java Reference Application
needs: java-app-encryption
runs-on: ubuntu-latest
container:
image: adoptopenjdk/maven-openjdk11
options: --ulimit core=-1 --ulimit memlock=-1:-1
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache Java packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}-v1
restore-keys: ${{ runner.os }}-m2-
- name: Build
run: |
cd samples/java/reference-app
./scripts/clean.sh
./scripts/build.sh
java-server:
name: Java Server Implementation
needs: java-app-encryption
runs-on: ubuntu-latest
container:
image: adoptopenjdk/maven-openjdk11
options: --ulimit core=-1 --ulimit memlock=-1:-1
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache Java packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}-v1
restore-keys: ${{ runner.os }}-m2-
- name: Build
run: |
cd server/java
./scripts/clean.sh
./scripts/build.sh
- name: Unit tests
run: |
cd server/java
./scripts/test.sh
#### C#
csharp-logging:
name: Build C# Logging
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:3.1
options: --ulimit core=-1 --ulimit memlock=-1:-1
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache dotnet packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}-v1
restore-keys: |
${{ runner.os }}-nuget-
- name: Build
run: |
cd csharp/Logging
./scripts/clean.sh
./scripts/build.sh
- name: Test
run: |
cd csharp/Logging
./scripts/test.sh
- name: Upload artifact
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700
with:
name: csharp-logging
path: |
csharp/Logging/Logging/bin/**
csharp/Logging/Logging/obj/**
release-csharp-logging:
if: startsWith( github.ref, 'refs/heads/release-' ) && github.repository == 'godaddy/asherah'
name: Release C# Logging
needs: csharp-logging
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
token: ${{ secrets.MERGE_TOKEN }}
- name: Fetch all tags
run: git fetch --prune --unshallow --tags
- name: Cache dotnet packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}-v1
restore-keys: |
${{ runner.os }}-nuget-
- name: Download artifact
uses: actions/download-artifact@158ca71f7c614ae705e79f25522ef4658df18253
with:
name: csharp-logging
path: ${{ github.workspace }}/csharp/Logging/Logging
- name: Publish C# Logging
run: |
sudo apt-get install -y libxml2-utils
cd csharp/Logging
BASE_VERSION=$(xmllint --xpath "//Project/PropertyGroup/Version/text()" Directory.Build.props)
VERSION_SUFFIX=`echo ${BASE_VERSION} | cut -f2 -d'-'`
BRANCH=`echo ${GITHUB_REF#refs/heads/}`
if [[ "${BRANCH}" =~ release-.* && "${VERSION_SUFFIX}" != "alpha" ]]; then
./scripts/release_prod.sh
fi
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }}
csharp-secure-memory:
name: Build C# Secure Memory
needs: csharp-logging
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:3.1
options: --ulimit core=-1 --ulimit memlock=-1:-1
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache dotnet packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}-v1
restore-keys: |
${{ runner.os }}-nuget-
- name: Build
run: |
cd csharp/SecureMemory
./scripts/clean.sh
./scripts/build.sh
- name: Test
run: |
cd csharp/SecureMemory
./scripts/test.sh
- name: Upload artifact
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700
with:
name: csharp-secure-memory
path: |
csharp/SecureMemory/SecureMemory/bin/**
csharp/SecureMemory/SecureMemory/obj/**
csharp/SecureMemory/PlatformNative/bin/**
csharp/SecureMemory/PlatformNative/obj/**
release-csharp-secure-memory:
if: startsWith( github.ref, 'refs/heads/release-' ) && github.repository == 'godaddy/asherah'
name: Release C# Secure Memory
needs: csharp-secure-memory
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
token: ${{ secrets.MERGE_TOKEN }}
- name: Fetch all tags
run: git fetch --prune --unshallow --tags
- name: Cache dotnet packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}-v1
restore-keys: |
${{ runner.os }}-nuget-
- name: Download artifact
uses: actions/download-artifact@158ca71f7c614ae705e79f25522ef4658df18253
with:
name: csharp-secure-memory
path: |
${{ github.workspace }}/csharp/SecureMemory/SecureMemory
${{ github.workspace }}/csharp/SecureMemory/PlatformNative
- name: Publish C# Secure Memory
run: |
sudo apt-get install -y libxml2-utils
cd csharp/SecureMemory
BASE_VERSION=$(xmllint --xpath "//Project/PropertyGroup/Version/text()" Directory.Build.props)
VERSION_SUFFIX=`echo ${BASE_VERSION} | cut -f2 -d'-'`
BRANCH=`echo ${GITHUB_REF#refs/heads/}`
if [[ "${BRANCH}" =~ release-.* && "${VERSION_SUFFIX}" != "alpha" ]]; then
./scripts/release_prod.sh
fi
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }}
csharp-app-encryption:
name: Build C# Application Encryption
needs: csharp-secure-memory
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:3.1
options: --ulimit core=-1 --ulimit memlock=-1:-1
services:
dynamodb:
image: amazon/dynamodb-local
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_PASSWORD }}
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache dotnet packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}-v1
restore-keys: |
${{ runner.os }}-nuget-
- name: Build
run: |
cd csharp/AppEncryption
./scripts/clean.sh
./scripts/build.sh
- name: Unit tests
run: |
cd csharp/AppEncryption
./scripts/test.sh
- name: Integration tests
run: |
cd csharp/AppEncryption
./scripts/integration_test.sh
- name: Upload artifact
uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700
with:
name: csharp-app-encryption
path: |
csharp/AppEncryption/AppEncryption/bin/**
csharp/AppEncryption/AppEncryption/obj/**
csharp/AppEncryption/Crypto/bin/**
csharp/AppEncryption/Crypto/obj/**
release-csharp-app-encryption:
if: startsWith( github.ref, 'refs/heads/release-' ) && github.repository == 'godaddy/asherah'
name: Release C# App Encryption
needs: csharp-app-encryption
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
token: ${{ secrets.MERGE_TOKEN }}
- name: Fetch all tags
run: git fetch --prune --unshallow --tags
- name: Cache dotnet packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}-v1
restore-keys: |
${{ runner.os }}-nuget-
- name: Download artifact
uses: actions/download-artifact@158ca71f7c614ae705e79f25522ef4658df18253
with:
name: csharp-app-encryption
path: ${{ github.workspace }}/csharp/AppEncryption/AppEncryption
- name: Publish App Encryption
run: |
sudo apt-get install -y libxml2-utils
cd csharp/AppEncryption
BASE_VERSION=$(xmllint --xpath "//Project/PropertyGroup/Version/text()" Directory.Build.props)
VERSION_SUFFIX=`echo ${BASE_VERSION} | cut -f2 -d'-'`
BRANCH=`echo ${GITHUB_REF#refs/heads/}`
if [[ "${BRANCH}" =~ release-.* && "${VERSION_SUFFIX}" != "alpha" ]]; then
./scripts/release_prod.sh
fi
env:
NUGET_KEY: ${{ secrets.NUGET_KEY }}
NUGET_SOURCE: ${{ secrets.NUGET_SOURCE }}
csharp-reference-app:
name: C# Reference Application
needs: csharp-app-encryption
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/dotnet/sdk:3.1
options: --ulimit core=-1 --ulimit memlock=-1:-1
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache dotnet packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}-v1
restore-keys: |
${{ runner.os }}-nuget-
- name: Build
run: |
cd samples/csharp/ReferenceApp
./scripts/clean.sh
./scripts/build.sh
#### Go
go-secure-memory:
name: Build Go Secure Memory
runs-on: ubuntu-latest
container:
image: golang:1.15
options: --ulimit core=-1 --ulimit memlock=-1:-1
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache Go packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: /go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-v1
restore-keys: ${{ runner.os }}-go-
- name: Install gotestsum
run: go get gotest.tools/gotestsum
- name: Build
run: |
cd go/securememory
./scripts/build.sh
- name: Unit tests
run: |
cd go/securememory
./scripts/test.sh
- name: Benchmark tests
run: |
cd go/securememory
./scripts/benchmark_test.sh
- name: Static analysis
run: |
cd go/securememory
./scripts/lint.sh
release-go-secure-memory:
if: startsWith( github.ref, 'refs/heads/release-' ) && github.repository == 'godaddy/asherah'
name: Release Go Secure Memory
needs: go-secure-memory
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
token: ${{ secrets.MERGE_TOKEN }}
- name: Fetch all tags
run: git fetch --prune --unshallow --tags
- name: Cache Go packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: /go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-v1
restore-keys: ${{ runner.os }}-go-
- name: Publish Go Secure Memory
run: |
cd go/securememory
BASE_VERSION=$(cat .versionfile)
VERSION_SUFFIX=`echo ${BASE_VERSION} | cut -f2 -d'-'`
BRANCH=`echo ${GITHUB_REF#refs/heads/}`
if [[ "${BRANCH}" =~ release-.* && "${VERSION_SUFFIX}" != "alpha" ]]; then
./scripts/release_prod.sh
fi
go-app-encryption:
name: Build Go Application Encryption
needs: go-secure-memory
runs-on: ubuntu-latest
container:
image: golang:1.15
options: --ulimit core=-1 --ulimit memlock=-1:-1
services:
dynamodb:
image: amazon/dynamodb-local
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: Password123
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache Go packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: /go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-v1
restore-keys: ${{ runner.os }}-go-
- name: Install gotestsum
run: go get gotest.tools/gotestsum
- name: Build
run: |
cd go/appencryption
./scripts/build.sh
- name: Unit tests
run: |
cd go/appencryption
./scripts/test.sh
- name: Benchmark tests
run: |
cd go/appencryption
./scripts/benchmark_test.sh
- name: Static analysis
run: |
cd go/appencryption
./scripts/lint.sh
release-go-app-encryption:
if: startsWith( github.ref, 'refs/heads/release-' ) && github.repository == 'godaddy/asherah'
name: Release Go App Encryption
needs: go-app-encryption
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
token: ${{ secrets.MERGE_TOKEN }}
- name: Fetch all tags
run: git fetch --prune --unshallow --tags
- name: Cache Go packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: /go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-v1
restore-keys: ${{ runner.os }}-go-
- name: Publish Go App Encryption
run: |
cd go/appencryption
BASE_VERSION=$(cat .versionfile)
VERSION_SUFFIX=`echo ${BASE_VERSION} | cut -f2 -d'-'`
BRANCH=`echo ${GITHUB_REF#refs/heads/}`
if [[ "${BRANCH}" =~ release-.* && "${VERSION_SUFFIX}" != "alpha" ]]; then
./scripts/release_prod.sh
fi
go-reference-app:
name: Go Reference Application
needs: go-app-encryption
runs-on: ubuntu-latest
container:
image: golang:1.15
options: --ulimit core=-1 --ulimit memlock=-1:-1
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache Go packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: /go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-v1
restore-keys: ${{ runner.os }}-go-
- name: Install gotestsum
run: go get gotest.tools/gotestsum
- name: Build
run: |
cd samples/go/referenceapp
./scripts/build.sh
- name: Static analysis
run: |
cd samples/go/referenceapp
./scripts/lint.sh
go-server:
name: Go Server Implementation
needs: go-app-encryption
runs-on: ubuntu-latest
container:
image: golang:1.15
options: --ulimit core=-1 --ulimit memlock=-1:-1
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Cache Go packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: /go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-v1
restore-keys: ${{ runner.os }}-go-
- name: Install gotestsum
run: go get gotest.tools/gotestsum
- name: Build
run: |
cd server/go
./scripts/build.sh
- name: Unit tests
run: |
cd server/go
./scripts/test.sh
- name: Static analysis
run: |
cd server/go
./scripts/lint.sh
#### Cross-Language
server-samples:
name: Server Samples
needs: [ java-server, go-server ]
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get -y upgrade --fix-missing
sudo apt-get install -y build-essential
- name: Set up JDK 11
uses: actions/setup-java@8764a52df183aa0ccea74521dfd9d506ffc7a19a
with:
distribution: 'adopt'
java-version: '11'
- name: Set up Go 1.15
uses: actions/setup-go@37335c7bb261b353407cff977110895fa0b4f7d8
with:
go-version: '1.15'
- name: Set up Python 3.7
uses: actions/setup-python@3105fb18c05ddd93efea5f9e0bef7a03a6e9e7df
with:
python-version: 3.7
- name: Set up NodeJS 13
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea
with:
node-version: 13.x
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Cache client packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: |
~/.cache
~/.m2
~/go/pkg/mod
key: ${{ runner.os }}-v5-clients-${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}-v1
restore-keys: |
${{ runner.os }}-v5-clients-${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}
${{ runner.os }}-v5-clients-${{ steps.extract_branch.outputs.branch }}-
${{ runner.os }}-v5-clients-
- name: Build the Java project
run: |
# Delete previous builds and rebuild from the current branch
rm -rf ~/.m2/repository/com/godaddy/asherah/grpc-server ~/.m2/repository/com/godaddy/asherah/appencryption
mvn clean install -f java/app-encryption/pom.xml -DskipTests
mvn clean install -f server/java/pom.xml -DskipTests
- name: Test clients
run: |
cd server/samples/clients
./test_clients.sh
tests-cross-language:
name: Cross-Language Tests
needs: [ java-app-encryption, csharp-app-encryption, go-app-encryption, java-server, go-server ]
runs-on: ubuntu-latest
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }}
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_PASSWORD }}
ports:
- 3306
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
steps:
- name: Checkout the repository
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Initialize RDBMS based metastore
run: |
mysql -h 127.0.0.1 -P${{ job.services.mysql.ports[3306] }} -u ${{ env.MYSQL_USERNAME }} -p${{ env.MYSQL_PASSWORD }} -e "CREATE TABLE ${{ env.MYSQL_DATABASE }}.encryption_key (
id VARCHAR(255) NOT NULL,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
key_record TEXT NOT NULL,
PRIMARY KEY (id, created),
INDEX (created)
);"
- name: Set up JDK 11
uses: actions/setup-java@8764a52df183aa0ccea74521dfd9d506ffc7a19a
with:
distribution: 'adopt'
java-version: '11.0.4'
- name: Set up C#
uses: actions/setup-dotnet@51f68377c181a79065c61bd492bd49be4575c439
with:
dotnet-version: '3.1.x'
- name: Set up Go 1.15
uses: actions/setup-go@37335c7bb261b353407cff977110895fa0b4f7d8
with:
go-version: '1.15'
- name: Set up Python 3.8
uses: actions/setup-python@3105fb18c05ddd93efea5f9e0bef7a03a6e9e7df
with:
python-version: 3.8
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Cache client packages
uses: actions/cache@1a9e2138d905efd099035b49d8b7a3888c653ca8
with:
path: |
~/.cache
~/.m2
~/.nuget
~/go/pkg/mod
key: ${{ runner.os }}-v5-cltf-${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}-v1
restore-keys: |
${{ runner.os }}-v5-cltf-${{ steps.extract_branch.outputs.branch }}-${{ github.run_number }}
${{ runner.os }}-v5-cltf-${{ steps.extract_branch.outputs.branch }}-
${{ runner.os }}-v5-cltf-
- name: Build the Java project
run: |
# Delete previous builds and rebuild from the current branch
rm -rf ~/.m2/repository/com/godaddy/asherah/grpc-server ~/.m2/repository/com/godaddy/asherah/appencryption
mvn clean install -f java/app-encryption/pom.xml -DskipTests
mvn clean install -f server/java/pom.xml -DskipTests
cd tests/cross-language/java
./scripts/build.sh
- name: Build the C# project
run: |
cd tests/cross-language/csharp
./scripts/clean.sh
# Workaround for https://github.com/SpecFlowOSS/SpecFlow/issues/1912#issue-583000545
export MSBUILDSINGLELOADCONTEXT=1
./scripts/build.sh
- name: Lint & Build the Go project
run: |
cd tests/cross-language/go
./scripts/lint.sh
go mod edit -replace github.com/godaddy/asherah/go/appencryption=../../../go/appencryption
go get github.com/cucumber/godog/cmd/[email protected]
echo "GOPATH: ${GOPATH}"
echo "PATH: ${PATH}"
echo "GOBIN: ${GOBIN}"
./scripts/build.sh
- name: Test
env:
TEST_DB_NAME: ${{ env.MYSQL_DATABASE }}
TEST_DB_PASSWORD: ${{ env.MYSQL_PASSWORD }}
TEST_DB_USER: ${{ env.MYSQL_USERNAME }}
TEST_DB_PORT: ${{ job.services.mysql.ports[3306] }}
ASHERAH_SERVICE_NAME: service
ASHERAH_PRODUCT_NAME: product
ASHERAH_KMS_MODE: static
run: |
export JAVA_AE_VERSION=$(mvn -f java/app-encryption/pom.xml -q -DforceStdout help:evaluate -Dexpression=project.version)
cd tests/cross-language/
./scripts/encrypt_all.sh
./scripts/decrypt_all.sh