| 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-20.04, macos-11, windows-2022] |
| jdk: [11, 17] |
| steps: |
| - name: Checkout |
| uses: actions/checkout@v2 |
| - name: Set up JDK ${{ matrix.jdk }} |
| uses: actions/setup-java@v2 |
| 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@v2 |
| # Use JDK 17. |
| - name: Use JDK 17 |
| uses: actions/setup-java@v2 |
| with: |
| java-version: 17 |
| 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@v2 |
| 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/rocketmq-client-5.0/testing/build.gradle.kts |
| # Use JDK 17. |
| - name: Use JDK 17 |
| uses: actions/setup-java@v2 |
| with: |
| java-version: 17 |
| distribution: "adopt" |
| cache: gradle |
| # Build the rocketmq opentelemetry test. |
| - name: Build OpenTelemetry Instrumentation Test |
| run: | |
| ./gradlew :instrumentation:rocketmq:rocketmq-client:rocketmq-client-5.0:javaagent:test -i |