Skip to content

Dispatch : Run integration test with JDK 8 (temurin) #3929

Dispatch : Run integration test with JDK 8 (temurin)

Dispatch : Run integration test with JDK 8 (temurin) #3929

Workflow file for this run

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: ubuntu-latest
# services:
# dynamodb:
# image: mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest
# ports:
# - 8081:8081
# - 10250-10255:10250-10255
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: Install 'ca-certificates-java'
run: sudo apt-get install ca-certificates-java
- name: Run Cosmos DB Emulator
run: docker run -p 8081:8081 -p 10250-10255:10250-10255 -d mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:latest /usr/local/bin/cosmos/start.sh Consistency=Strong
- name: Install TLS/SSL certificate
run: |
# These retries are needed since the downloaded file may be a JSON response.
while true;
do
curl -k --retry 20 --retry-delay 5 --retry-all-errors https://localhost:8081/_explorer/emulator.pem > ~/emulatorcert.crt
if grep 'END CERTIFICATE' ~/emulatorcert.crt > /dev/null
then
break
fi
echo 'Retrying since the file is broken...'
sleep 5
done
sudo cp ~/emulatorcert.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates -f
# echo '$$$$ ls -l $JAVA_HOME/jre/lib/security/'
# ls -l $JAVA_HOME/jre/lib/security/
# echo '$$$$ ls -l /etc/ssl/certs/adoptium/'
# ls -l /etc/ssl/certs/adoptium/
# echo '$$$$ ls -l /etc/ssl/certs/java/'
# ls -l /etc/ssl/certs/java/
# sudo rm $JAVA_HOME/jre/lib/security/cacerts
# sudo ln -s /etc/ssl/certs/adoptium/cacerts $JAVA_HOME/jre/lib/security/cacerts
# sudo rm /etc/ssl/certs/java/cacerts
# sudo ln -s /etc/ssl/certs/adoptium/cacerts /etc/ssl/certs/java/cacerts
# echo '$$$$$$$$$$$$$$$$$$$$$ /etc/ssl/certs/adoptium/cacerts $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'
# sudo keytool -v -list -keystore /etc/ssl/certs/adoptium/cacerts # This doesn't contain `emulatorcert`
# echo '$$$$$$$$$$$$$$$$$$$$$ /etc/ssl/certs/java/cacerts $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'
# sudo keytool -v -list -keystore /etc/ssl/certs/java/cacerts # This contains `emulatorcert`
sudo rm $JAVA_HOME/jre/lib/security/cacerts
sudo ln -s /etc/ssl/certs/java/cacerts $JAVA_HOME/jre/lib/security/cacerts
- 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 }}_
- name : Delete gradle daemon log files
if: always()
# Delete all files modified more than 3 days ago with the ".out.log" file extension located in the "/home/azureuser/.gradle/daemon"
# folder hierarchy. These files accumulate over time and can end up using a lot of disk space
run : find /home/azureuser/.gradle/daemon -name "*.out.log" -type f -mtime +3 -exec rm -vf {} +
- name: Upload Gradle test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: cosmos_integration_test_reports
path: core/build/reports/tests/integrationTestCosmos