-
Notifications
You must be signed in to change notification settings - Fork 8
47 lines (41 loc) · 1.51 KB
/
java.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
name: Java CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
paths:
- '.github/workflows/java.yml'
- 'java-example/**'
- 'java-metric-example/**'
jobs:
build_and_run_java_app:
runs-on: ubuntu-latest
strategy:
matrix:
distribution: [ 'temurin' ]
java-version: [ '8', '11', '17' ]
name: Java ${{ matrix.java-version }}
steps:
- uses: actions/checkout@v2
- name: Set up JAVA
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java-version }}
distribution: ${{ matrix.distribution }}
cache: maven
- name: Build java-metric-example with Maven
run: mvn --batch-mode --update-snapshots verify --file java-example/otel-collector/pom.xml
- name: Build java-example with Maven
run: mvn --batch-mode --update-snapshots verify --file java-example/otel-collector/pom.xml
- name: Compile and Run java-example
run: |
mvn clean compile exec:java -Dexec.mainClass="com.vmware.App" -Dexec.cleanupDaemonThreads=false --file java-example/otel-collector/pom.xml | tee mvn.log
- name: Check java-example Output
run: |
# Get count of unique Trace IDs from output; 'xargs' trims whitespace
count=$(grep 'TraceID : ' mvn.log | rev | cut -f1 -d' ' | uniq | wc -l | xargs)
if [[ $count -ne 3 ]]; then
echo "[ERROR] Wrong TraceID count. Expected: 3. Actual: ${count}."
exit 1
fi