Repository navigation
146 lines (139 loc) · 4.66 KB
/
Copy pathcheck-build.yml
File metadata and controls
146 lines (139 loc) · 4.66 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Check Build
#
# Description:
# Runs the build for every java version we support
#
# Triggers:
# - pull_request: when a PR is sent to us
# - push: when code is pushed to a specified branch
#
# Notes:
# Builds against Java 17, 21, and 25 which are the supported versions.
on:
workflow_dispatch:
pull_request:
paths:
- 'powertools-batch/**'
- 'powertools-core/**'
- 'powertools-cloudformation/**'
- 'powertools-common/**'
- 'powertools-e2e-tests/**'
- 'powertools-idempotency/**'
- 'powertools-large-messages/**'
- 'powertools-logging/**'
- 'powertools-metrics/**'
- 'powertools-kafka/**'
- 'powertools-parameters/**'
- 'powertools-serialization/**'
- 'powertools-sqs/**'
- 'powertools-tracing/**'
- 'powertools-tracing/**'
- 'powertools-validation/**'
- 'powertools-lambda-metadata/**'
- 'examples/**'
- 'pom.xml'
- 'examples/pom.xml'
- '.github/workflows/**'
push:
branches:
- main
paths:
- 'powertools-batch/**'
- 'powertools-core/**'
- 'powertools-cloudformation/**'
- 'powertools-common/**'
- 'powertools-e2e-tests/**'
- 'powertools-idempotency/**'
- 'powertools-large-messages/**'
- 'powertools-logging/**'
- 'powertools-metrics/**'
- 'powertools-kafka/**'
- 'powertools-parameters/**'
- 'powertools-serialization/**'
- 'powertools-sqs/**'
- 'powertools-tracing/**'
- 'powertools-tracing/**'
- 'powertools-validation/**'
- 'powertools-lambda-metadata/**'
- 'pom.xml'
- 'examples/**'
- 'examples/pom.xml'
- '.github/workflows/**'
name: Build
permissions:
contents: read
run-name: Build - ${{ github.event_name }}
jobs:
java-build:
runs-on: ubuntu-latest
strategy:
matrix:
java:
- 17
- 21
- 25
steps:
- id: checkout
name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Java
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6
with:
distribution: corretto
java-version: ${{ matrix.java }}
cache: maven
- id: build-maven
name: Build (Maven)
run: |
mvn -B -q install --file pom.xml
graalvm-build:
runs-on: aws-powertools_ubuntu-latest_8-core
steps:
- id: checkout
name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
with:
files: |
powertools-*/**
pom.xml
- name: Setup GraalVM
uses: graalvm/setup-graalvm@27b360dbb857524eaf0b4c4cef364d38e5b4f173 # v1.6.7
with:
# Pinned to 21.0.8 due to unsafeAllocated enforcement in 21.0.10+. See #2416
java-version: "21.0.8"
distribution: "graalvm"
cache: maven
- id: graalvm-native-test
name: GraalVM Native Test
if: steps.changed-files.outputs.any_changed == 'true'
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
# Build the entire project first to ensure test-jar dependencies are available
echo "::group::Building project dependencies"
mvn -B -q install -DskipTests
echo "::endgroup::"
echo "Changes detected in powertools modules: $CHANGED_FILES"
# Find modules with native profile and run tests with the tracing agent
find . -name "pom.xml" -path "./powertools-*" | while read module; do
if grep -q "<id>native</id>" "$module"; then
module_dir=$(dirname "$module")
module_name=$(basename "$module_dir")
# Check if this specific module or common dependencies changed
if echo "$CHANGED_FILES" | grep -q "$module_name/" || \
echo " $CHANGED_FILES " | grep -q " pom.xml " || \
echo "$CHANGED_FILES" | grep -q "powertools-common/"; then
echo "::group::Building $module_name with GraalVM"
echo "Changes detected in $module_name - running GraalVM native tests"
mvn -B -q -f "$module" -Pnative -Dagent=true clean test
echo "::endgroup::"
else
echo "No changes detected in $module_name - skipping GraalVM tests"
fi
fi
done