Dispatch : Run integration test with JDK 8 (temurin) #3975
Workflow file for this run
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
name: CI | |
run-name: "${{ github.event_name == 'workflow_dispatch' && format('Dispatch : Run integration test with JDK {0} ({1})', inputs.INT_TEST_JAVA_RUNTIME_VERSION, inputs.INT_TEST_JAVA_RUNTIME_VENDOR) || '' }}" | |
on: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
INT_TEST_JAVA_RUNTIME_VERSION: | |
description: JDK version used to run the integration test | |
type: choice | |
required: false | |
default: '8' | |
options: | |
- '8' | |
- '11' | |
- '17' | |
- '21' | |
INT_TEST_JAVA_RUNTIME_VENDOR: | |
description: Vendor of the JDK used to run the integration test | |
type: choice | |
required: false | |
default: 'temurin' | |
options: | |
- 'corretto' | |
- 'microsoft' | |
- 'oracle' | |
- 'temurin' | |
env: | |
TERM: dumb | |
JAVA_VERSION: '8' | |
JAVA_VENDOR: 'temurin' | |
INT_TEST_JAVA_RUNTIME_VERSION: "${{ github.event_name != 'workflow_dispatch' && '8' || inputs.INT_TEST_JAVA_RUNTIME_VERSION }}" | |
INT_TEST_JAVA_RUNTIME_VENDOR: "${{ github.event_name != 'workflow_dispatch' && 'temurin' || inputs.INT_TEST_JAVA_RUNTIME_VENDOR }}" | |
jobs: | |
integration-test-for-cosmos: | |
name: Cosmos DB integration test | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ env.JAVA_VERSION }} (${{ env.JAVA_VENDOR }}) | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: ${{ env.JAVA_VENDOR }} | |
- name: Set up JDK ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} (${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }}) to run integration test | |
uses: actions/setup-java@v4 | |
if: ${{ !(env.INT_TEST_JAVA_RUNTIME_VERSION == env.JAVA_VERSION && env.INT_TEST_JAVA_RUNTIME_VENDOR == env.JAVA_VENDOR) }} | |
with: | |
java-version: ${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} | |
distribution: ${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }} | |
- name: Debug0 | |
run: echo $env:JAVA_HOME | |
- name: Debug1 | |
run: ls -l $env:JAVA_HOME | |
- name: Debug2 | |
run: ls -l ${env:JAVA_HOME}/jre/lib/security | |
- name: Debug3 | |
run: ls -l ${env:JAVA_HOME}/bin | |
- name: Start Azure Cosmos DB emulator | |
run: | | |
Write-Host "Launching Cosmos DB Emulator" | |
Import-Module "$env:ProgramFiles\Azure Cosmos DB Emulator\PSModules\Microsoft.Azure.CosmosDB.Emulator" | |
Start-CosmosDbEmulator -Consistency Strong | |
- name: Install TLS/SSL certificate | |
run: | | |
$cert = Get-ChildItem Cert:\LocalMachine\My | where{$_.FriendlyName -eq 'DocumentDbEmulatorCertificate'} | |
$params = @{ | |
Cert = $cert | |
Type = "CERT" | |
FilePath = "$home/tmp-cert.cer" | |
NoClobber = $true | |
} | |
Export-Certificate @params | |
certutil -encode $home/tmp-cert.cer $home/cosmosdbcert.cer | |
Remove-Item $home/tmp-cert.cer | |
# & ${env:JAVA_HOME}/bin/keytool.exe -keystore ${env:JAVA_HOME}/jre/lib/security/cacerts -storepass 'changeit' -delete -alias cosmos_emulator | |
& ${env:JAVA_HOME}/bin/keytool.exe -keystore ${env:JAVA_HOME}/jre/lib/security/cacerts -storepass 'changeit' -importcert -noprompt -alias cosmos_emulator -file $home/cosmosdbcert.cer | |
& ${env:JAVA_HOME}/bin/keytool.exe -keystore ${env:JAVA_HOME}/jre/lib/security/cacerts -storepass 'changeit' -list -alias cosmos_emulator | |
# # These retries are needed since the downloaded file may be a JSON response. | |
# while ($true) { | |
# curl.exe -k --retry 20 --retry-delay 5 --retry-all-errors https://localhost:8081/_explorer/emulator.pem > ~/emulatorcert.crt | |
# $success = Select-String -Quiet -Path ~/emulatorcert.crt 'END CERTIFICATE' | |
# echo $success | |
# if ($success) { | |
# break | |
# } | |
# echo 'Retrying since the file is broken...' | |
# cat ~/emulatorcert.crt | |
# Start-Sleep -Seconds 5 | |
# } | |
- name: Generate unique prefix using the epoch | |
run: | | |
echo "db_prefix=$(date +%s%3N)" >> $GITHUB_ENV | |
- name: Setup and execute Gradle 'integrationTestCosmos' task | |
uses: gradle/gradle-build-action@v3 | |
with: | |
# arguments: integrationTestCosmos -PjavaVersion=${{ env.JAVA_VERSION }} -PjavaVendor=${{ env.JAVA_VENDOR }} -PintegrationTestJavaRuntimeVersion=${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} -PintegrationTestJavaRuntimeVendor=${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }} -Dscalardb.cosmos.uri=https://localhost:8081/ -Dscalardb.cosmos.password=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw== -Dscalardb.cosmos.database_prefix=${{ env.db_prefix }}_ --tests **.ConsensusCommitIntegrationTestWithCosmos.get_GetGivenForCommittedRecord_ShouldReturnRecord | |
arguments: integrationTestCosmos -PjavaVersion=${{ env.JAVA_VERSION }} -PjavaVendor=${{ env.JAVA_VENDOR }} -PintegrationTestJavaRuntimeVersion=${{ env.INT_TEST_JAVA_RUNTIME_VERSION }} -PintegrationTestJavaRuntimeVendor=${{ env.INT_TEST_JAVA_RUNTIME_VENDOR }} -Dscalardb.cosmos.uri=https://localhost:8081/ -Dscalardb.cosmos.password=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw== -Dscalardb.cosmos.database_prefix=${{ env.db_prefix }}_ | |
- name: Upload Gradle test reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cosmos_integration_test_reports | |
path: core/build/reports/tests/integrationTestCosmos |