CAMEL-19542: Replace Thread.sleep with alternatives in camel-sjms tests #19863
Workflow file for this run
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
| # | |
| # 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. | |
| # | |
| name: Build and test | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| # CI-only changes don't need a full build. Use workflow_dispatch to | |
| # test CI changes: gh workflow run "Build and test" -f pr_number=XXXX -f pr_ref=branch-name | |
| paths-ignore: | |
| - .github/** | |
| - README.md | |
| - SECURITY.md | |
| - Jenkinsfile | |
| - Jenkinsfile.* | |
| - NOTICE.txt | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'Pull request number to build' | |
| required: true | |
| type: string | |
| pr_ref: | |
| description: 'Git ref of the pull request branch' | |
| required: true | |
| type: string | |
| extra_modules: | |
| description: 'Additional modules to test (comma-separated paths, e.g. from /component-test)' | |
| required: false | |
| type: string | |
| default: '' | |
| skip_full_build: | |
| description: 'Skip full regen build — use quick targeted build instead (for /component-test)' | |
| required: false | |
| type: boolean | |
| default: false | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || inputs.pr_number || github.ref }}${{ inputs.extra_modules && '-component-test' || '' }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| if: github.repository == 'apache/camel' | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| continue-on-error: ${{ matrix.experimental }} | |
| strategy: | |
| matrix: | |
| java: ['17', '25'] | |
| experimental: [ false ] | |
| include: | |
| - java: '17' | |
| # JDK 17 is kept for runtime compatibility testing. | |
| # Skip the enforcer which requires JDK 21+ (needed to compile JDK 21-specific classes). | |
| maven_extra_args: '-Denforcer.phase=none' | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| ref: ${{ inputs.pr_ref || '' }} | |
| - name: Fetch base branch for Scalpel change detection | |
| if: ${{ !inputs.skip_full_build }} | |
| run: | | |
| # Scalpel needs the merge base between HEAD and the base branch. | |
| # The checkout is depth=1; progressively deepen: 50 → 200 → 1000 → full. | |
| # Scalpel is observational — fetch failures must not break the build. | |
| BASE_REF="${GITHUB_BASE_REF:-main}" | |
| for depth in 50 200 1000; do | |
| git fetch --deepen=$depth 2>/dev/null || true | |
| git fetch --no-tags --depth=$depth origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}" 2>/dev/null || true | |
| if git merge-base HEAD "origin/${BASE_REF}" >/dev/null 2>&1; then | |
| echo "Merge base reachable at depth $depth" | |
| break | |
| fi | |
| echo "Merge base not reachable at depth $depth, deepening..." | |
| done | |
| # If still not reachable, fetch full history as last resort | |
| if ! git merge-base HEAD "origin/${BASE_REF}" >/dev/null 2>&1; then | |
| echo "Merge base still not reachable, fetching full history" | |
| git fetch --unshallow 2>/dev/null || true | |
| git fetch --no-tags origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}" 2>/dev/null || true | |
| fi | |
| - id: install-packages | |
| uses: ./.github/actions/install-packages | |
| - id: install-mvnd | |
| uses: ./.github/actions/install-mvnd | |
| - name: Set up JDK ${{ matrix.java }} | |
| uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 | |
| with: | |
| distribution: 'temurin' | |
| java-version: ${{ matrix.java }} | |
| cache: 'maven' | |
| - name: Get Atlassian dependency version | |
| id: atlassian-version | |
| run: | | |
| JIRA_VERSION=$(./mvnw help:evaluate -Dexpression=jira-rest-client-api-version -q -DforceStdout -N -f parent/pom.xml) | |
| echo "version=${JIRA_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Restore Atlassian Maven Cache | |
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: | | |
| ~/.m2/repository/com/atlassian | |
| ~/.m2/repository/io/atlassian | |
| key: atlassian-maven-${{ steps.atlassian-version.outputs.version }} | |
| - name: maven build | |
| if: ${{ !inputs.skip_full_build }} | |
| env: | |
| MAVEN_EXTRA_ARGS: ${{ matrix.maven_extra_args || '' }} | |
| run: ./etc/scripts/regen.sh | |
| - name: Quick dependency build | |
| if: ${{ inputs.skip_full_build }} | |
| shell: bash | |
| env: | |
| EXTRA_MODULES: ${{ inputs.extra_modules }} | |
| MAVEN_EXTRA_ARGS: ${{ matrix.maven_extra_args || '' }} | |
| run: ./mvnw -l build.log install -B -DskipTests -Dquickly $MAVEN_EXTRA_ARGS -pl "$EXTRA_MODULES" -am | |
| - name: archive logs | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| if: always() | |
| with: | |
| name: build-${{ matrix.java }}.log | |
| path: build.log | |
| - name: Save Atlassian Maven Cache | |
| uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| if: always() | |
| with: | |
| path: | | |
| ~/.m2/repository/com/atlassian | |
| ~/.m2/repository/io/atlassian | |
| key: atlassian-maven-${{ steps.atlassian-version.outputs.version }} | |
| - name: Fail if there are uncommitted changes | |
| if: ${{ !inputs.skip_full_build }} | |
| shell: bash | |
| run: | | |
| [[ -z $(git status --porcelain) ]] || { echo 'There are uncommitted changes'; git status; echo; echo; git diff; exit 1; } | |
| - name: mvn test | |
| uses: ./.github/actions/incremental-build | |
| with: | |
| pr-id: ${{ github.event.number || inputs.pr_number }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| skip-mvnd-install: 'true' | |
| extra-modules: ${{ inputs.extra_modules || '' }} | |
| maven-extra-args: ${{ matrix.maven_extra_args || '' }} | |
| - name: archive incremental test logs | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| if: always() | |
| with: | |
| name: incremental-test-java-${{ matrix.java }}.log | |
| path: incremental-test.log | |
| # All non-experimental JDK matrix entries upload with overwrite: true. | |
| # The comment content is identical across JDKs (same modules tested), | |
| # so last writer wins. However, we only upload (and overwrite) when the | |
| # comment file actually exists — a cancelled build (e.g., JDK 25 killed | |
| # while JDK 17 fails) won't have the file and must not overwrite an | |
| # artifact from a matrix entry that did produce it. | |
| - name: Save PR number and test comment for commenter workflow | |
| if: always() && !matrix.experimental | |
| shell: bash | |
| env: | |
| RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| run: | | |
| mkdir -p ci-comment-artifact | |
| prNumber="${{ github.event.number || inputs.pr_number }}" | |
| echo "$prNumber" > ci-comment-artifact/pr-number | |
| if [ -f incremental-test-comment.md ]; then | |
| cp incremental-test-comment.md ci-comment-artifact/ | |
| # Append link to the workflow run for detailed results | |
| echo "" >> ci-comment-artifact/incremental-test-comment.md | |
| echo "---" >> ci-comment-artifact/incremental-test-comment.md | |
| echo ":gear: [View full build and test results](${RUN_URL})" >> ci-comment-artifact/incremental-test-comment.md | |
| fi | |
| - name: Upload CI comment artifact | |
| if: > | |
| always() && !matrix.experimental && | |
| hashFiles('ci-comment-artifact/incremental-test-comment.md') != '' | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: ci-comment | |
| path: ci-comment-artifact/ | |
| overwrite: true |