Build - pull_request #1303
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-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: | |
| - 11 | |
| - 17 | |
| - 21 | |
| - 25 | |
| steps: | |
| - id: checkout | |
| name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup Java | |
| uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 | |
| 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get changed files | |
| id: changed-files | |
| uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5 | |
| with: | |
| files: | | |
| powertools-*/** | |
| pom.xml | |
| - name: Setup GraalVM | |
| uses: graalvm/setup-graalvm@f744c72a42b1995d7b0cbc314bde4bace7ac1fe1 # v1.5.0 | |
| 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 |