Skip to content

Java Functional Tests #1552

Java Functional Tests

Java Functional Tests #1552

name: Java Functional Tests
on:
# Allows you to run this workflow manually from the Actions tab
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:
java-functional-tests:
name: Java ${{ matrix.java-version }}
timeout-minutes: 150
runs-on: ubuntu-24.04
env:
default-branch: "main"
strategy:
##max-parallel: 1 ## used to force sequential
fail-fast: false
matrix:
java-version: [ 8, 11, 17, 21, 23 ]
steps:
- name: Checkout Java agent
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # pin@v4
with:
ref: ${{ inputs.agent-ref || github.ref || 'main' }}
- name: Configure AWS Credentials
if: ${{ env.AWS_KEY != '' }}
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # pin@v4
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
- name: Build newrelicJar
run: ./gradlew $GRADLE_OPTIONS clean jar
- name: Run functional tests on ${{ matrix.java-version }} (attempt 1)
id: run_tests_1
continue-on-error: true
timeout-minutes: 50
run: ./gradlew $GRADLE_OPTIONS :functional_test:test -Ptest${{ matrix.java-version }} --continue
- name: Run functional tests on ${{ matrix.java-version }} (attempt 2)
id: run_tests_2
continue-on-error: true
timeout-minutes: 50
if: steps.run_tests_1.outcome == 'failure'
run: ./gradlew $GRADLE_OPTIONS :functional_test:test -Ptest${{ matrix.java-version }} --continue
- name: Run functional tests on ${{ matrix.java-version }} (attempt 3)
timeout-minutes: 50
if: steps.run_tests_2.outcome == 'failure'
run: ./gradlew $GRADLE_OPTIONS :functional_test:test -Ptest${{ matrix.java-version }} --continue
- name: Capture build reports
if: ${{ failure() }}
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # pin@v4
with:
name: functional-tests-results-java-${{ matrix.java-version }}
# The regex for the path below will capture functional test HTML reports generated by gradle for all
# related modules: (functional_test, newrelic-scala-api, newrelic-scala-cats-api, :newrelic-cats-effect3-api, newrelic-scala-zio-api, newrelic-scala-zio2-api).
# However, it's critical that the previous build step does a ./gradlew clean or the regex will capture test reports
# that were leftover in unrelated modules for unit and instrumentation tests.
path: |
**/build/reports/tests/*