Repository navigation
91 lines (80 loc) · 3.4 KB
/
Copy pathJava-Instrumentation-Tests.yml
File metadata and controls
91 lines (80 loc) · 3.4 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
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Java Instrumentation Tests
# Permissions granted to all jobs in the workflow.
# Permissions that aren't explicitly defined here will default to a value of none.
permissions: {}
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, 25, 27 ]
name: Java ${{ matrix.java-version }}
timeout-minutes: 120
# needs: install-all-java
runs-on: ubuntu-22.04
env:
# we use these in env vars for conditionals (secrets can't be used in conditionals)
AWS_KEY: ${{ secrets.aws-secret-access-key }}
GRADLE_OPTS: "-Dorg.gradle.jvmargs='-Xmx2048m'"
steps:
# - uses: GitHubSecurityLab/actions-permissions/monitor@v1 # detects minimum permissions required to run the workflow, uncomment to use
- name: Checkout Java agent
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # pin@v6
with:
ref: ${{ inputs.agent-ref || github.ref || 'main' }}
- name: Configure AWS Credentials
if: ${{ env.AWS_KEY != '' }}
uses: aws-actions/configure-aws-credentials@d979d5b3a71173a29b74b5b88418bfda9437d885 # pin@v6
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
echo "api.version=1.44" > $HOME/.docker-java.properties
# 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # pin@v7
with:
name: instrumentation-tests-results-java-${{ matrix.java-version }}
path: |
instrumentation/**/build/reports/tests/*