-
Notifications
You must be signed in to change notification settings - Fork 37
127 lines (112 loc) · 5.7 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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
env:
EMULATOR_OTHER_ARGS: /Consistency=Strong
# - name: Explore Cosmos DB Emulator
# run: docker exec $(docker ps --no-trunc -a | grep azure-cosmos-emulator | head -1 | awk '{print $1}') cat /usr/local/bin/cosmos/start.sh
- 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