Build - pull_request #452
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 11, 17, and 21 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-parameters/**' | |
- 'powertools-serialization/**' | |
- 'powertools-sqs/**' | |
- 'powertools-tracing/**' | |
- 'powertools-tracing/**' | |
- 'powertools-validation/**' | |
- '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-parameters/**' | |
- 'powertools-serialization/**' | |
- 'powertools-sqs/**' | |
- 'powertools-tracing/**' | |
- 'powertools-tracing/**' | |
- 'powertools-validation/**' | |
- 'pom.xml' | |
- 'examples/**' | |
- 'examples/pom.xml' | |
- '.github/workflows/**' | |
name: Build | |
run-name: Build - ${{ github.event_name }} | |
jobs: | |
java-build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: | |
- 11 | |
- 17 | |
- 21 | |
steps: | |
- id: checkout | |
name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup Java | |
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 | |
with: | |
distribution: corretto | |
java-version: ${{ matrix.java }} | |
cache: maven | |
- id: build-maven | |
name: Build (Maven) | |
run: | | |
mvn -B install --file pom.xml | |
graalvm-build: | |
runs-on: ubuntu-latest | |
steps: | |
- id: checkout | |
name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Setup GraalVM | |
uses: graalvm/setup-graalvm@7f488cf82a3629ee755e4e97342c01d6bed318fa # v1.3.5 | |
with: | |
java-version: "21" | |
distribution: "graalvm" | |
cache: maven | |
- id: graalvm-native-test | |
name: GraalVM Native Test | |
run: | | |
# Build the entire project first to ensure test-jar dependencies are available | |
mvn -B install -DskipTests | |
# Find modules with graalvm-native profile and run tests. | |
# This will make sure to discover new GraalVM supported modules automatically in the future. | |
for module in powertools-*/pom.xml; do | |
if grep -q "<id>graalvm-native</id>" "$module"; then | |
module_dir=$(dirname "$module") | |
echo "Regenerating GraalVM metadata for $module_dir" | |
mvn -B -f "$module" -Pgenerate-graalvm-files clean test | |
echo "Running GraalVM native tests for $module_dir" | |
mvn -B -f "$module" -Pgraalvm-native test | |
fi | |
done |