22#
33# Description:
44# Runs the build for every java version we support
5- #
5+ #
66# Triggers:
77# - pull_request: when a PR is sent to us
88# - push: when code is pushed to a specified branch
99#
1010# Notes:
11- # The matrix build for this workflow is unusual, we need to make it dyanmic since
12- # we need to change java versions we build for depending on the branch.
13-
11+ # Builds against Java 11, 17, and 21 which are the supported versions.
1412
1513on :
1614 workflow_dispatch :
3836 push :
3937 branches :
4038 - main
41- paths : # add other modules when there are under e2e tests
39+ paths :
4240 - ' powertools-batch/**'
4341 - ' powertools-core/**'
4442 - ' powertools-cloudformation/**'
@@ -63,31 +61,11 @@ name: Build
6361run-name : Build - ${{ github.event_name }}
6462
6563jobs :
66- setup :
67- runs-on : ubuntu-latest
68- outputs :
69- build_matrix : ${{ format('{0}{1}', steps.build_matrix_v1.outputs.build_matrix, steps.build_matrix_v1.outputs.build_matrix) }}
70- steps :
71- - id : base
72- name : Base
73- run : |
74- echo build_version=$(test ${{ github.ref }} == "v2" && echo "v2" || echo "v1") >> $GITHUB_OUTPUT
75- - id : build_matrix_v1
76- name : Build matrix (v1)
77- if : ${{ steps.base.outputs.build_version == 'v1' }}
78- run : |
79- echo build_matrix='["8", "11", "17", "21"]' >> "$GITHUB_OUTPUT"
80- - id : build_matrix_v2
81- name : Build matrix (v2)
82- if : ${{ steps.base.outputs.build_version == 'v2' }}
83- run : |
84- echo build_matrix='["11", "17", "21"]'>> "$GITHUB_OUTPUT"
85- build :
64+ java-build :
8665 runs-on : ubuntu-latest
8766 strategy :
8867 matrix :
8968 java :
90- - 8
9169 - 11
9270 - 17
9371 - 21
@@ -96,13 +74,39 @@ jobs:
9674 name : Checkout repository
9775 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9876 - name : Setup Java
99- uses : actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00
77+ uses : actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
10078 with :
10179 distribution : corretto
10280 java-version : ${{ matrix.java }}
10381 cache : maven
10482 - id : build-maven
10583 name : Build (Maven)
106- if : ${{ matrix.java != '8' }}
10784 run : |
108- mvn -B install --file pom.xml
85+ mvn -B install --file pom.xml
86+
87+ graalvm-build :
88+ runs-on : ubuntu-latest
89+ steps :
90+ - id : checkout
91+ name : Checkout repository
92+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
93+ - name : Setup GraalVM
94+ uses : graalvm/setup-graalvm@7f488cf82a3629ee755e4e97342c01d6bed318fa # v1.3.5
95+ with :
96+ java-version : " 21"
97+ distribution : " graalvm"
98+ cache : maven
99+ - id : graalvm-native-test
100+ name : GraalVM Native Test
101+ run : |
102+ # Find modules with graalvm-native profile and run tests.
103+ # This will make sure to discover new GraalVM supported modules automatically in the future.
104+ for module in powertools-*/pom.xml; do
105+ if grep -q "<id>graalvm-native</id>" "$module"; then
106+ module_dir=$(dirname "$module")
107+ echo "Regenerating GraalVM metadata for $module_dir"
108+ mvn -B -f "$module" -Pgenerate-graalvm-files clean test
109+ echo "Running GraalVM native tests for $module_dir"
110+ mvn -B -f "$module" -Pgraalvm-native test
111+ fi
112+ done
0 commit comments