-
Notifications
You must be signed in to change notification settings - Fork 19
169 lines (149 loc) · 5.62 KB
/
library_java_tests.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
# This workflow performs tests in Java.
name: Library Java tests
on:
pull_request:
push:
branches:
- main
schedule:
# Nightly build against Dafny's nightly prereleases,
# for early warning of verification issues or regressions.
# Timing chosen to be adequately after Dafny's own nightly build,
# but this might need to be tweaked:
# https://github.com/dafny-lang/dafny/blob/master/.github/workflows/deep-tests.yml#L16
- cron: "30 16 * * *"
jobs:
testJava:
# Don't run the nightly build on forks
if: github.event_name != 'schedule' || github.repository_owner == 'aws'
strategy:
matrix:
library: [
#AwsEncryptionSDK
]
os: [
# TODO just test on mac for now
#windows-latest,
#ubuntu-latest,
macos-latest
]
runs-on: ${{ matrix.os }}
environment: "MPL_DAFNY"
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v2
- name: Init Submodules
env:
# This secret is in the configured environment
# Token created on # 09/26/2023
# expires in ~30 days 10/26/2023
MPL_PAT: ${{ secrets.MPL_DAFNY }}
run: |
AUTH="$(echo -n "pat:${MPL_PAT}" | base64 | tr -d '\n')"
git config --global http.https://github.com/.extraheader "AUTHORIZATION: basic $AUTH"
git config --global --add url.https://github.com/.insteadOf [email protected]:
git submodule update --init libraries
git submodule update --init --recursive mpl
- name: Support longpaths
run: |
git config --global core.longpaths true
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-west-2
# TODO: This role was manually created.
role-to-assume: arn:aws:iam::370957321024:role/ESDK-Dafny-Private-CA-Read
role-session-name: JavaPrivateESDKDafnyTests
- name: Setup Dafny
uses: dafny-lang/[email protected]
with:
# A && B || C is the closest thing to an if .. then ... else ... or ?: expression the GitHub Actions syntax supports.
dafny-version: ${{ (github.event_name == 'schedule' || inputs.nightly) && 'nightly-latest' || '4.2.0' }}
- name: Setup Java 8
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 8
- name: Build ${{ matrix.library }} implementation
shell: bash
working-directory: ./${{ matrix.library }}
run: |
# This works because `node` is installed by default on GHA runners
CORES=$(node -e 'console.log(os.cpus().length)')
make build_java CORES=$CORES
# KMS and MPL tests need to use credentials which can call KMS
- name: Configure AWS Credentials for Tests
uses: aws-actions/configure-aws-credentials@v1
if: matrix.library == 'ComAmazonawsKms' || matrix.library == 'AwsCryptographicMaterialProviders' || matrix.library == 'TestVectorsAwsCryptographicMaterialProviders'
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::370957321024:role/GitHub-CI-ESDK-Dafny-Role-us-west-2
role-session-name: JavaTests
- name: Test ${{ matrix.library }}
working-directory: ./${{ matrix.library }}
# TODO: DDB currently has no tests
if: matrix.library != 'ComAmazonawsDynamodb'
run: |
make test_java
- name: Setup Java 11
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 11
- name: Clean for next Java
uses: gradle/gradle-build-action@v2
with:
arguments: clean
build-root-directory: ./${{ matrix.library }}/runtimes/java
- name: Compile Java 11
uses: gradle/gradle-build-action@v2
with:
arguments: build
build-root-directory: ./${{ matrix.library }}/runtimes/java
- name: Test Java 11
uses: gradle/gradle-build-action@v2
with:
arguments: runTests
build-root-directory: ./${{ matrix.library }}/runtimes/java
- name: Setup Java 16
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 16
- name: Clean for next Java
uses: gradle/gradle-build-action@v2
with:
arguments: clean
build-root-directory: ./${{ matrix.library }}/runtimes/java
- name: Compile Java 16
uses: gradle/gradle-build-action@v2
with:
arguments: build
build-root-directory: ./${{ matrix.library }}/runtimes/java
- name: Test Java 16
uses: gradle/gradle-build-action@v2
with:
arguments: runTests
build-root-directory: ./${{ matrix.library }}/runtimes/java
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 17
- name: Clean for next Java
uses: gradle/gradle-build-action@v2
with:
arguments: clean
build-root-directory: ./${{ matrix.library }}/runtimes/java
- name: Compile Java 17
uses: gradle/gradle-build-action@v2
with:
arguments: build
build-root-directory: ./${{ matrix.library }}/runtimes/java
- name: Test Java 17
uses: gradle/gradle-build-action@v2
with:
arguments: runTests
build-root-directory: ./${{ matrix.library }}/runtimes/java