forked from newrelic/newrelic-java-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
283 lines (250 loc) · 9.44 KB
/
AITs-Datastores.yml
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
name: AITs - Datastores (1 disabled)
# We need to set java home to JDK 8
# Also configure workflow_dispatch fr all workflows - add github ref
# Force build
on:
pull_request:
branches: [ main ] ## branches TBD
types: [opened, synchronize, reopened] ## Types TBD
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
BRANCH:
description: "Specify branch (main is default)"
required: false
default: 'main'
jobs:
tests:
name: Datastores
timeout-minutes: 120
runs-on: ubuntu-20.04
# Determine if easier to make the env strings below part of the matrix
env:
java_func_path: "tests/java/functionality"
java_func_type: "datastore"
default-branch: "main"
strategy:
##max-parallel: 1 ## used to force sequential
fail-fast: false
matrix:
# functional_path: [basic_features, datastore]
func_tests:
- datastore_base.py
# datastores requires PDX VPN access to DBs hosted in AWS
# - datastores.py
- jcache.py
- redis.py
- cassandra.py
steps:
- uses: actions/checkout@v3
## Ongoing tests with artifactory dependencies
- name: Checkout AIT repo test
uses: actions/checkout@v3
with:
repository: newrelic/java-agent-integration-tests
ref: main
token: ${{ secrets.AITPAT }}
path: agent-integration-tests
# Print Environmental variables
- name: Print Environmental variables
run: |
printenv | sort -f
# Apps repos/caches - this prpcess could be a candidate for custom action
- name: Checkout Cache 1
uses: actions/checkout@v3
with:
repository: newrelic/java-ait-cache-1
ref: main
token: ${{ secrets.AITPAT }}
path: appcache1
lfs: true
- name: Checkout Cache 2
uses: actions/checkout@v3
with:
repository: newrelic/java-ait-cache-2
ref: main
token: ${{ secrets.AITPAT }}
path: appcache2
lfs: true
- name: Checkout Cache 3
uses: actions/checkout@v3
with:
repository: newrelic/java-ait-cache-3
ref: main
token: ${{ secrets.AITPAT }}
path: appcache3
lfs: true
- name: Checkout Cache 4
uses: actions/checkout@v3
with:
repository: newrelic/java-ait-cache-4
ref: main
token: ${{ secrets.AITPAT }}
path: appcache4
lfs: true
# Consolidate caches into one directory
- name: Consolidate caches into Apps directory
run: |
ls -la
mkdir apps
mv appcache1/* apps/
mv appcache2/* apps/
mv appcache3/* apps/
mv appcache4/* apps/
cd apps
ls -la
ls -la java_test_webapp-master/
cd ../
## JDK Installs
# Install 11
- name: Set up Java 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
# Set the JDk variable
- name: Set the required JDK variable
run: |
echo "ORG_GRADLE_PROJECT_jdk11=${JAVA_HOME}" >> $GITHUB_ENV
# Install 17
- name: Set up Java 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
# Set the JDk variable
- name: Set the required JDK variable
run: |
echo "ORG_GRADLE_PROJECT_jdk17=${JAVA_HOME}" >> $GITHUB_ENV
# Install latest non-LTS Java version (we should only ever test one non-LTS version to keep test times reasonable)
- name: Set up Java 19
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 19
- name: Save JAVA_HOME as JDK19 for later usage
run: |
echo "ORG_GRADLE_PROJECT_jdk19=${JAVA_HOME}" >> $GITHUB_ENV
# Install 8, last to set JAVA_HOME to 8
- name: Set up Java 8
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
# Set the JDk variable
- name: Set the required JDK variable
run: |
echo "ORG_GRADLE_PROJECT_jdk8=${JAVA_HOME}" >> $GITHUB_ENV
# Needed for toolchains and GHA.
- name: setup gradle options
run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=ORG_GRADLE_PROJECT_jdk8,ORG_GRADLE_PROJECT_jdk11" >> $GITHUB_ENV
## End JDK Install
# Check ENV variables
- name: Check environmental variables
run: printenv | sort -f
# End Java restore section
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
## TESTING SECTION
- name: Check new Java home path
run: |
echo "Current JAVA_HOME is ${JAVA_HOME}"
# ls -la ${ORG_GRADLE_PROJECT_jdk8}
# Replication of steps from ait README
# Is newrelicJar present in newrelic-agent/build
# TO DO: Below version number has to be dynamic
- name: Build newrelicJar
if: ${{ failure() || success() }}
run: |
echo "JAVA_HOME=${ORG_GRADLE_PROJECT_jdk8}" >> $GITHUB_ENV
echo "REVIEW ANY NEW ITEMS IN WORKSPACE"
ls -la
./gradlew $GRADLE_OPTIONS clean jar --parallel
ls -la newrelic-agent/build/
- name: CD to agent-integration-tests dir.
run: |
cd agent-integration-tests/
ls -la
## WE LOSE THE VIRTUAL ENVIRONMENT ONCE WE LEAVE THE STEP
## TODO: This should really be a custom action, too many commands
- name: Create virtualenv and run AITs - ${{ matrix.func_tests }}
if: ${{ failure() || success() }}
run: |
cd agent-integration-tests
echo "conf/testenv complains of the path below - creating symlink for now"
ln -s ${GITHUB_WORKSPACE}/apps /home/runner/apps
ln -s ${GITHUB_WORKSPACE}/newrelic-agent/build/newrelicJar/newrelic.jar ${GITHUB_WORKSPACE}/newrelic.jar
echo "still complains of file not found"
ls -la ${GITHUB_WORKSPACE}
sudo apt-get install virtualenv
virtualenv -p /usr/bin/python3.8 .
echo "What version of maven are we using?"
mvn --version
echo "are the files created?"
ls -la bin/
echo "checking conf"
ls -la conf/
echo "runnig bin/activate"
. bin/activate
bin/pip3 install -r conf/requirements.txt
echo "run autoconfigure"
JAVA8JRE=${ORG_GRADLE_PROJECT_jdk8} \
JAVA11JRE=${ORG_GRADLE_PROJECT_jdk11} \
JAVA17JRE=${ORG_GRADLE_PROJECT_jdk17} \
JAVA19JRE=${ORG_GRADLE_PROJECT_jdk19} \
conf/autoconfigure
echo "running conf/testenv java"
. conf/testenv java
echo "check local java config"
cat conf/java_local_config.yml
echo "Changing java_agent_dev_root values"
sed -i 's|java_agent_dev_root: /home/runner/work/newrelic-java-agent/newrelic-java-agent|java_agent_dev_root: /home/runner/work/newrelic-java-agent/newrelic-java-agent/newrelic-agent/build/newrelicJar|' conf/java_local_config.yml
sed -i 's|app_root: /home/runner/apps|app_root: /home/runner/work/newrelic-java-agent/newrelic-java-agent/apps|' conf/java_local_config.yml
echo "verifying values have been changed"
cat conf/java_local_config.yml
echo "shell variables:"
set | sort -f
echo "GENERATE ARTIFACTS"
## artifacts section for testing
mkdir testing-artifacts
echo "was the dir created?"
ls -la
touch testing-artifacts/shell-variables.txt
touch testing-artifacts/env-variables.txt
set | sort -f > testing-artifacts/shell-variables.txt
printenv | sort -f > testing-artifacts/env-variables.txt
cp conf/java_local_config.yml testing-artifacts/
echo "check the contents of testing-artifacts"
ls -la testing-artifacts/
echo "are we still in agent-integration-tests?"
pwd
## End testing artifacts section
echo "Check the current Java Home for this step"
echo "The current JAVA_HOME is ${JAVA_HOME}"
echo "RUN THE TESTS"
echo "Running ${{ matrix.func_basic_features }}"
TEST_LOG_LEVEL=DEBUG TEST_SUPPRESS_METRIC_DEBUG=1 \
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python \
./bin/runtest.sh ${java_func_path}/${java_func_type}/${{ matrix.func_tests }}
# Rename matrix item to remove problem characers
- name: Rename Matrix item
if: ${{ failure() || success() }}
env:
MATRIX: ${{ matrix.func_tests}}
run: |
MATRIX_ITEM=$(echo ${MATRIX} | sed 's|/|-|g')
echo "MATRIX="${MATRIX_ITEM}"" >> $GITHUB_ENV
# Capture Testing Artifacts temp for development
- name: Capture testing artifacts
if: ${{ failure() || success() }}
uses: actions/upload-artifact@v3
with:
name: ${{ github.workflow }}-${{ github.job }}-${{ env.Matrix }}
path: |
agent-integration-tests/testing-artifacts/*
# Print Environmental variables
- name: Print Environmental variables (verify activate has been sourced)
run: |
printenv | sort -f