Skip to content

Commit

Permalink
add jvm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aajtodd committed Feb 15, 2024
1 parent 360a136 commit 9889a55
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
49 changes: 48 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,34 @@ env:
OCI_EXE: docker

jobs:
jvm:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# we build with a specific JDK version but source/target compatibility should ensure the jar is usable by
# the target versions we want to support
java-version:
- 8
- 11
- 17
- 21
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Test with ${{ matrix.java-version }}
shell: bash
run: |
./gradlew -Ptest.java.version=${{ matrix.java-version }} -Paws.sdk.kotlin.crt.disableCrossCompile=true jvmTest --stacktrace
- name: Save Test Reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-reports-jvm-${{ matrix.java-version }}
path: '**/build/reports'

# macos-14 build and test for targets: jvm, macoArm64, iosSimulatorArm64, watchosSimulatorArm65, tvosSimulatorArm64
# macos-13 build and test for targets: jvm, macoX64, iosX64, tvosX64, watchosX64
macos:
Expand Down Expand Up @@ -103,6 +131,25 @@ jobs:
RUN_CONTAINER_TEST=./native-test-binaries/.github/scripts/run-container-test.py
$RUN_CONTAINER_TEST --distro ${{ matrix.distro }} --arch ${{ matrix.arch }} --test-bin-dir ./native-test-binaries/aws-crt-kotlin/build/bin
# windows JVM
windows:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Build and Test ${{ env.PACKAGE_NAME }}
run: |
./gradlew -Paws.sdk.kotlin.crt.disableCrossCompile=true build
- name: Save Test Reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-reports-windows
path: '**/build/reports'

# TODO - native test reports?
# TODO - windows jvm, windows native, jvm versions
# TODO - windows native

18 changes: 18 additions & 0 deletions aws-crt-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,21 @@ val disableCrossCompile = typedProp<Boolean>("aws.sdk.kotlin.crt.disableCrossCom
if (disableCrossCompile) {
disableCrossCompileTargets()
}

// run tests on specific JVM version
val testJavaVersion = typedProp<String>("test.java.version")?.let {
JavaLanguageVersion.of(it)
}?.also {
println("configuring tests to run with jdk $it")
}

if (testJavaVersion != null) {
tasks.withType<Test> {
val toolchains = project.extensions.getByType<JavaToolchainService>()
javaLauncher.set(
toolchains.launcherFor {
languageVersion.set(testJavaVersion)
},
)
}
}

0 comments on commit 9889a55

Please sign in to comment.