-
Notifications
You must be signed in to change notification settings - Fork 149
83 lines (73 loc) · 2.85 KB
/
Java-Instrumentation-Tests.yml
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
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/*