Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions .github/workflows/library-ci-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# This workflow performs tests in Java.
name: Library Java Build

on:
workflow_call:
inputs:
dafny:
description: "The Dafny version to run"
required: true
type: string
regenerate-code:
description: "Regenerate code using smithy-dafny"
required: false
default: false
type: boolean

jobs:
buildJava:
strategy:
fail-fast: false
matrix:
library: [TestVectorsAwsCryptographicMaterialProviders]
os: [macos-latest]
java-versions: [8]
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
defaults:
run:
shell: bash
steps:
- name: Support longpaths on Git checkout
run: |
git config --global core.longpaths true

- uses: actions/checkout@v6
# The specification submodule is private so we don't have access, but we don't need
# it to verify the Dafny code. Instead we manually pull the submodules we DO need.
- run: git submodule update --init libraries
- run: git submodule update --init --recursive smithy-dafny

- name: Setup Dafny
uses: ./.github/actions/setup_dafny
with:
dafny-version: ${{ inputs.dafny }}

- name: Install Smithy-Dafny codegen dependencies
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies

- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
with:
dafny: ${{ env.DAFNY_VERSION }}
library: ${{ matrix.library }}
diff-generated-code: false

- name: Setup Java 8, for complex reasons
if: ${{matrix.java-versions != 8 }}
uses: actions/setup-java@v5
with:
distribution: "corretto"
java-version: 8

- name: Setup Java ${{matrix.java-versions}}
uses: actions/setup-java@v5
with:
distribution: "corretto"
java-version: ${{matrix.java-versions}}

- name: Build ${{ matrix.library }} implementation
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

- name: Upload TestVector Build Artifacts
uses: actions/upload-artifact@v6
with:
name: TestVectorsAwsCryptographicMaterialProviders-generated-code-java-${{github.sha}}
path: TestVectorsAwsCryptographicMaterialProviders/runtimes/java/

- name: Upload MPL Build Artifacts
uses: actions/upload-artifact@v6
with:
name: AwsCryptographicMaterialProviders-generated-code-java-${{github.sha}}
path: AwsCryptographicMaterialProviders/runtimes/java/

- name: Upload Primitives Build Artifacts
uses: actions/upload-artifact@v6
with:
name: AwsCryptographyPrimitives-generated-code-java-${{github.sha}}
path: AwsCryptographyPrimitives/runtimes/java/

- name: Upload KMS Build Artifacts
uses: actions/upload-artifact@v6
with:
name: ComAmazonawsKms-generated-code-java-${{github.sha}}
path: ComAmazonawsKms/runtimes/java/

- name: Upload DDB Build Artifacts
uses: actions/upload-artifact@v6
with:
name: ComAmazonawsDynamodb-generated-code-java-${{github.sha}}
path: ComAmazonawsDynamodb/runtimes/java/

- name: Upload STD Build Artifacts
uses: actions/upload-artifact@v6
with:
name: StandardLibrary-generated-code-java-${{github.sha}}
path: StandardLibrary/runtimes/java/
139 changes: 116 additions & 23 deletions .github/workflows/library_java_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,105 @@ on:
type: boolean

jobs:
buildJava:
strategy:
fail-fast: false
matrix:
library: [TestVectorsAwsCryptographicMaterialProviders]
os: [macos-latest]
java-versions: [8]
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
defaults:
run:
shell: bash
steps:
- name: Support longpaths on Git checkout
run: |
git config --global core.longpaths true

- uses: actions/checkout@v6
# The specification submodule is private so we don't have access, but we don't need
# it to verify the Dafny code. Instead we manually pull the submodules we DO need.
- run: git submodule update --init libraries
- run: git submodule update --init --recursive smithy-dafny

- name: Setup Dafny
uses: ./.github/actions/setup_dafny
with:
dafny-version: ${{ inputs.dafny }}

- name: Cache local Maven repository
uses: actions/cache@v5
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-

- name: Install Smithy-Dafny codegen dependencies
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies

- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen
with:
dafny: ${{ env.DAFNY_VERSION }}
library: ${{ matrix.library }}
diff-generated-code: false

- name: Setup Java ${{matrix.java-versions}}
uses: actions/setup-java@v5
with:
distribution: "corretto"
java-version: ${{matrix.java-versions}}

- name: Build ${{ matrix.library }} implementation
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

- name: Upload TestVector Build Artifacts
uses: actions/upload-artifact@v6
with:
name: TestVectorsAwsCryptographicMaterialProviders-generated-code-java-${{github.sha}}
path: TestVectorsAwsCryptographicMaterialProviders/runtimes/java/

- name: Upload MPL Build Artifacts
uses: actions/upload-artifact@v6
with:
name: AwsCryptographicMaterialProviders-generated-code-java-${{github.sha}}
path: AwsCryptographicMaterialProviders/runtimes/java/

- name: Upload Primitives Build Artifacts
uses: actions/upload-artifact@v6
with:
name: AwsCryptographyPrimitives-generated-code-java-${{github.sha}}
path: AwsCryptographyPrimitives/runtimes/java/

- name: Upload KMS Build Artifacts
uses: actions/upload-artifact@v6
with:
name: ComAmazonawsKms-generated-code-java-${{github.sha}}
path: ComAmazonawsKms/runtimes/java/

- name: Upload DDB Build Artifacts
uses: actions/upload-artifact@v6
with:
name: ComAmazonawsDynamodb-generated-code-java-${{github.sha}}
path: ComAmazonawsDynamodb/runtimes/java/

- name: Upload STD Build Artifacts
uses: actions/upload-artifact@v6
with:
name: StandardLibrary-generated-code-java-${{github.sha}}
path: StandardLibrary/runtimes/java/

testJava:
needs: buildJava
strategy:
fail-fast: false
matrix:
Expand All @@ -24,11 +122,10 @@ jobs:
ComAmazonawsKms,
ComAmazonawsDynamodb,
AwsCryptographicMaterialProviders,
# TestVectorsAwsCryptographicMaterialProviders,
StandardLibrary,
]
os: [
# TODO just test on mac for now
# TODO just test on mac and ubuntu for now
# windows-latest,
ubuntu-22.04,
macos-14,
Expand Down Expand Up @@ -64,26 +161,16 @@ jobs:
uses: ./.github/actions/setup_dafny
with:
dafny-version: ${{ inputs.dafny }}

- name: Install Smithy-Dafny codegen dependencies
uses: ./.github/actions/install_smithy_dafny_codegen_dependencies

- name: Regenerate code using smithy-dafny if necessary
if: ${{ inputs.regenerate-code }}
uses: ./.github/actions/polymorph_codegen

- name: Cache local Maven repository
uses: actions/cache@v5
with:
dafny: ${{ env.DAFNY_VERSION }}
library: ${{ matrix.library }}
diff-generated-code: false

# - name: Copy over keys.json so that it is discoverable by the tests
# uses: gradle/gradle-build-action@v2
# with:
# arguments: copyKeysJSON
# build-root-directory: ./TestVectorsAwsCryptographicMaterialProviders/runtimes/java
path: ~/.m2/repository
key: maven-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-

- name: Setup Java 8, for complex reasons
if: ${{matrix.java-versions}} != 8
if: ${{matrix.java-versions != 8 }}
uses: actions/setup-java@v5
with:
distribution: "corretto"
Expand All @@ -95,12 +182,18 @@ jobs:
distribution: "corretto"
java-version: ${{matrix.java-versions}}

- name: Build ${{ matrix.library }} implementation
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5

- uses: actions/download-artifact@v7
with:
name: ${{matrix.library}}-generated-code-java-${{github.sha}}
path: ${{matrix.library}}/runtimes/java/

- name: Build ${{ matrix.library }} Test implementation
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
make transpile_test_java

- name: Test ${{ matrix.library }} on ${{matrix.java-versions}}
working-directory: ./${{ matrix.library }}
Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,45 +27,53 @@ jobs:
with:
dafny: ${{needs.getVersions.outputs.verifyVersion}}
pr-ci-java:
needs: getVersions
needs:
- getVersions
uses: ./.github/workflows/library_java_tests.yml
with:
dafny: ${{needs.getVersions.outputs.version}}
pr-ci-net:
needs: getVersions
needs:
- getVersions
uses: ./.github/workflows/library_net_tests.yml
with:
dafny: ${{needs.getVersions.outputs.version}}
pr-ci-rust:
needs: getVersions
needs:
- getVersions
uses: ./.github/workflows/library_rust_tests.yml
with:
dafny: ${{needs.getVersions.outputs.rustVersion}}
pr-ci-python:
needs: getVersions
needs:
- getVersions
uses: ./.github/workflows/library_python_tests.yml
with:
dafny: ${{needs.getVersions.outputs.version}}
pr-ci-go:
needs: getVersions
needs:
- getVersions
uses: ./.github/workflows/library_go_tests.yml
with:
dafny: ${{needs.getVersions.outputs.version}}
pr-interop-test:
needs: getVersions
needs:
- getVersions
uses: ./.github/workflows/library_interop_tests.yml
with:
dafny: ${{needs.getVersions.outputs.version}}
secrets: inherit
pr-fuzz-interop-test:
needs: getVersions
needs:
- getVersions
uses: ./.github/workflows/library_interop_tests.yml
with:
dafny: ${{needs.getVersions.outputs.version}}
fuzz-testing: true
secrets: inherit
pr-ci-db-esdk-java-examples-test:
needs: getVersions
needs:
- getVersions
uses: ./.github/workflows/test_dbesdk_examples.yml
with:
dafny: ${{needs.getVersions.outputs.version}}
Expand Down
Loading