chore: sync public with staging #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: [ | ||
Check failure on line 23 in .github/workflows/library_java_tests.yml GitHub Actions / Library Java testsInvalid workflow file
|
||
#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 |