forked from apache/rocketmq-clients
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (77 loc) · 2.93 KB
/
java_build.yml
File metadata and controls
78 lines (77 loc) · 2.93 KB
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
name: Java Build
on:
workflow_call:
jobs:
build:
name: "${{ matrix.os }}, jdk-${{ matrix.jdk }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04, macos-latest, windows-2022 ]
jdk: [11, 17]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.jdk }}
distribution: "adopt"
cache: maven
- name: Build with Maven
working-directory: ./java
run: mvn -B package --file pom.xml
opentelemetry-instrumentation-compatibility:
runs-on: ubuntu-latest
steps:
- name: Checkout Current Repository
uses: actions/checkout@v3
# Use JDK 21.
- name: Use JDK 21
uses: actions/setup-java@v3
with:
java-version: 21
distribution: "adopt"
# Build the code of the current repository, skipping tests and code style checks.
- name: Build Current Repository
working-directory: ./java
run: mvn clean install -DskipTests -Dcheckstyle.skip -Dspotbugs.skip=true
# Get the version of the current repository.
- name: Get Current Version
id: get_version
working-directory: ./java
run: echo "::set-output name=version::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
# Check the latest release tag of opentelemetry.
- name: Check Latest Release Tag
id: get_release_tag
run: |
curl --silent "https://api.github.com/repos/open-telemetry/opentelemetry-java-instrumentation/releases/latest" \
| grep '"tag_name":' \
| sed -E 's/.*"([^"]+)".*/\1/' \
| xargs echo "::set-output name=tag_name::"
# Clone the opentelemetry-java-instrumentation repository.
- name: Checkout Latest Release
uses: actions/checkout@v3
with:
repository: open-telemetry/opentelemetry-java-instrumentation
ref: ${{ steps.get_release_tag.outputs.tag_name }}
# Print the current version.
- name: Print Current Version
run: |
echo "Current Version: ${{ steps.get_version.outputs.version }}"
# Replace the RocketMQ client version.
- name: Replace RocketMQ Client Version
run: |
sed -i 's/org\.apache\.rocketmq:rocketmq-client-java:[^"]*/org.apache.rocketmq:rocketmq-client-java:${{ steps.get_version.outputs.version }}/' instrumentation/rocketmq/rocketmq-client-5.0/testing/build.gradle.kts
# Use JDK 17.
- name: Use JDK 21
uses: actions/setup-java@v3
with:
java-version: 21
distribution: "adopt"
cache: gradle
# Build the rocketmq opentelemetry test.
- name: Build OpenTelemetry Instrumentation Test
run: |
./gradlew :instrumentation:rocketmq:rocketmq-client-5.0:javaagent:test -i