Java Instrumentation Tests #865
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java Instrumentation Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
agent-ref: | |
description: 'The ref (branch, SHA, tag?) to run the tests on' | |
required: false | |
default: 'main' | |
type: string | |
workflow_call: | |
inputs: | |
agent-ref: | |
description: 'The ref (branch, SHA, tag?) to run the tests on' | |
required: false | |
default: 'main' | |
type: string | |
jobs: | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
java-version: [8, 11, 17, 21] | |
name: Java ${{ matrix.java-version }} | |
timeout-minutes: 120 | |
# needs: install-all-java | |
runs-on: ubuntu-20.04 | |
env: | |
# we use these in env vars for conditionals (secrets can't be used in conditionals) | |
AWS_KEY: ${{ secrets.aws-secret-access-key }} | |
steps: | |
- name: Checkout Java agent | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.agent-ref || github.ref || 'main' }} | |
- name: Configure AWS Credentials | |
if: ${{ env.AWS_KEY != '' }} | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-2 | |
- name: Setup environment | |
uses: ./.github/actions/setup-environment | |
# Is newrelicJar present in newrelic-agent/build | |
# TO DO: Below version number has to be dynamic | |
- name: Build newrelicJar | |
run: ./gradlew $GRADLE_OPTIONS clean jar | |
- name: Remove parallel from GRADLE_OPTIONS | |
run: echo "GRADLE_OPTIONS=$GRADLE_OPTIONS" | sed "s/--parallel//" >> $GITHUB_ENV | |
# GHA run instrumentation tests | |
- name: Run instrumentation tests for Java ${{ matrix.java-version }} (attempt 1) | |
id: run_tests_1 | |
continue-on-error: true | |
timeout-minutes: 35 | |
run: ./gradlew $GRADLE_OPTIONS :instrumentation:test -Ptest${{ matrix.java-version }} --continue | |
- name: Run instrumentation tests for Java ${{ matrix.java-version }} (attempt 2) | |
id: run_tests_2 | |
continue-on-error: true | |
timeout-minutes: 35 | |
if: steps.run_tests_1.outcome == 'failure' | |
run: ./gradlew $GRADLE_OPTIONS :instrumentation:test -Ptest${{ matrix.java-version }} --continue | |
- name: Run instrumentation tests for Java ${{ matrix.java-version }} (attempt 3) | |
timeout-minutes: 35 | |
if: steps.run_tests_2.outcome == 'failure' | |
run: ./gradlew $GRADLE_OPTIONS :instrumentation:test -Ptest${{ matrix.java-version }} --continue | |
# Capture HTML build result in artifacts | |
- name: Capture build reports | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: instrumentation-tests-results-java-${{ matrix.java-version }} | |
path: | | |
instrumentation/**/build/reports/tests/* |