-
Notifications
You must be signed in to change notification settings - Fork 27
131 lines (119 loc) · 4.54 KB
/
build.yml
File metadata and controls
131 lines (119 loc) · 4.54 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
# validate gradle wrapper binary https://github.com/gradle/wrapper-validation-action
gradle-wrapper-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: gradle/actions/wrapper-validation@v6
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Gradle build without tests
uses: ./.github/workflows/gradle-goal
with:
# We also compile the test-classes, even though we are skipping the tests
command: "./gradlew build testClasses -x test"
# We first tar the working directory and then upload it
# We do this because the upload-artifact action doesn't preserve file permissions
- name: Create working dir archive
run: "mkdir ./wdarch && tar --exclude='./wdarch' -czf ./wdarch/working-dir-build-cache.tar.gz ."
- name: Cache working directory with build results
uses: actions/upload-artifact@v7
with:
name: working-dir-build-cache
path: ./wdarch/working-dir-build-cache.tar.gz
retention-days: 1 # No need to waste space when this artifact is only used as part of the build process
- name: Agent artifact
uses: actions/upload-artifact@v7
with:
name: elastic-otel-javaagent
path: |
./agent/build/libs/elastic-otel-javaagent-*.jar
- name: Agent extension artifact
uses: actions/upload-artifact@v7
with:
name: elastic-otel-agentextension
path: |
./agentextension/build/libs/elastic-otel-agentextension-*.jar
test:
runs-on: ubuntu-latest
needs:
- build
strategy:
# Even if the tests fail on one JDK we want to know if it also fails on others
fail-fast: false
matrix:
# The JVMs for testing will be automatically downloaded by gradle using the toolchains-feature
# We use the following plugin to download them: https://github.com/gradle/foojay-toolchains
# We should make sure to always add the latest releases here when they are GA
# non LTS-releases should be removed if a newer version is GA
include:
- version: 8
vm: 'hotspot'
- version: 11
vm: 'hotspot'
- version: 17
vm: 'hotspot'
- version: 21
vm: 'hotspot'
- version: 25
vm: 'hotspot'
- version: 11
vm: 'openj9'
- version: 21
vm: 'openj9'
- version: 25
vm: 'openj9'
steps:
# We use the cached working directory so that we don't have to recompile everything
- name: Download cached build working directory
uses: actions/download-artifact@v8
with:
name: working-dir-build-cache
path: ./
- name: Untar cached build working directory
run: "tar -xvf working-dir-build-cache.tar.gz"
# Workaround for https://github.com/foojayio/discoapi/issues/143
# The foojay disco API has a broken redirect for Semeru JDK 25, so we pre-install it
# for Gradle's toolchain auto-detection to find locally.
- name: Pre-install Semeru JDK
if: matrix.vm == 'openj9'
uses: actions/setup-java@v5
with:
distribution: semeru
java-version: ${{ matrix.version }}
- name: Run tests
uses: ./.github/workflows/gradle-goal
with:
# We manually skip the compileJni task because we know it is up-to-date in the cached
# working directory. The up-to-date check of this task checks for the presence of docker
# images used for compiling the native library, which do not exist because we are in a new
# environment.
command: "./gradlew test -x compileJni -PtestJavaVersion=${{ matrix.version }} -PtestJavaVM=${{ matrix.vm }}"
- name: Store test results
if: success() || failure()
uses: actions/upload-artifact@v7
with:
name: test-results-${{ matrix.version }}-${{ matrix.vm }}
path: '**/build/test-results/test/TEST-*.xml'
muzzle-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Run muzzle check
uses: ./.github/workflows/gradle-goal
with:
# We also compile the test-classes, even though we are skipping the tests
command: "./gradlew :instrumentation:muzzle"