| # | |
| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| # | |
| # Use only actions from GitHub (actions/*) or those in | |
| # https://github.com/apache/infrastructure-actions/blob/main/approved_patterns.yml | |
| name: CI | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| env: | |
| JDK_DISTRIBUTION: corretto | |
| JDK_VERSION: '25' | |
| jobs: | |
| build: | |
| name: Build and license check | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Check out the source code | |
| uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - name: Set up JDK | |
| uses: actions/setup-java@v6 | |
| with: | |
| distribution: ${{ env.JDK_DISTRIBUTION }} | |
| java-version: ${{ env.JDK_VERSION }} | |
| - name: Set up Gradle | |
| uses: ./.github/actions/setup-gradle | |
| with: | |
| develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} | |
| # Checkstyle doesn't cover buildSrc and the sample apps. The Git history records the authors. | |
| - name: Check that there are no author tags | |
| run: | | |
| if git grep -nwE '@+author' -- '*.java' '*.kt' '*.groovy'; then | |
| echo "Remove the author tags, as the Git history records the authors." | |
| exit 1 | |
| fi | |
| # Includes the format, Checkstyle, nohttp and RAT checks, the Javadoc and the Antora site | |
| - name: Build without running the tests | |
| run: ./gradlew build -x test -x integrationTest -x dockerTest --continue | |
| - name: Upload the build reports | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: build-reports | |
| path: | | |
| build/reports/ | |
| **/build/reports/ | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| tests: | |
| name: Tests - ${{ matrix.name }} | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: Core | |
| tasks: >- | |
| :pulsar-spring:test | |
| :pulsar-spring-test:test | |
| - name: Spring Boot | |
| tasks: >- | |
| :pulsar-spring-boot-autoconfigure:test | |
| :pulsar-spring-boot-autoconfigure:dockerTest | |
| - name: Cloud Stream binder | |
| tasks: >- | |
| :pulsar-spring-cloud-stream-binder:test | |
| - name: Integration | |
| tasks: >- | |
| :pulsar-spring-integration-tests:integrationTest | |
| # Tests the artifacts as they are published, including their POMs and the BOM, by running | |
| # the sample apps as a separate build that gets them from a local repository. | |
| - name: Sample apps | |
| publish: true | |
| working-directory: pulsar-spring-sample-apps | |
| tasks: >- | |
| runAllSampleTests | |
| -PsampleTests | |
| -PpulsarSpringRepository=../build/publications/repos | |
| steps: | |
| - name: Check out the source code | |
| uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - name: Set up JDK | |
| uses: actions/setup-java@v6 | |
| with: | |
| distribution: ${{ env.JDK_DISTRIBUTION }} | |
| java-version: ${{ env.JDK_VERSION }} | |
| - name: Set up Gradle | |
| uses: ./.github/actions/setup-gradle | |
| with: | |
| develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} | |
| - name: Publish the artifacts to a local repository | |
| if: ${{ matrix.publish }} | |
| run: ./gradlew publishAllPublicationsToLocalRepository | |
| - name: Run the tests | |
| working-directory: ${{ matrix.working-directory || '.' }} | |
| env: | |
| TASKS: ${{ matrix.tasks }} | |
| run: | | |
| # TASKS holds several arguments, so it must be split | |
| # shellcheck disable=SC2086 | |
| "$GITHUB_WORKSPACE/gradlew" $TASKS --continue | |
| - name: Upload the test reports | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-reports-${{ matrix.name }} | |
| path: | | |
| **/build/reports/tests/ | |
| **/build/test-results/ | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| # Tests the AOT support and the runtime hints in a native image of a sample app | |
| native-image: | |
| name: Tests - Native image | |
| needs: build | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Check out the source code | |
| uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - name: Set up GraalVM | |
| uses: graalvm/setup-graalvm@f70bc8032f90a104502824a54bcb94b6f01715bc # v1.6.8 | |
| with: | |
| distribution: graalvm-community | |
| java-version: ${{ env.JDK_VERSION }} | |
| - name: Set up Gradle | |
| uses: ./.github/actions/setup-gradle | |
| with: | |
| develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} | |
| - name: Publish the artifacts to a local repository | |
| run: ./gradlew publishAllPublicationsToLocalRepository | |
| - name: Build and test the native image | |
| working-directory: pulsar-spring-sample-apps | |
| run: ../gradlew :sample-native-image:nativeSmokeTest -PpulsarSpringRepository=../build/publications/repos | |
| - name: Upload the test reports | |
| if: ${{ failure() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-reports-native-image | |
| path: | | |
| **/build/reports/tests/ | |
| **/build/test-results/ | |
| if-no-files-found: ignore | |
| retention-days: 7 | |
| # A single job that can be required for merging pull requests, through the | |
| # required_status_checks of the protected branch in .asf.yaml | |
| ci-checks-completed: | |
| name: CI checks completed | |
| if: ${{ always() }} | |
| needs: | |
| - build | |
| - tests | |
| - native-image | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Check that all the required jobs succeeded | |
| if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') || contains(needs.*.result, 'skipped') }} | |
| run: | | |
| echo "Some of the required jobs haven't completed successfully." | |
| exit 1 |