From 33356d968de3248cd35eab631ff7a4c9be26327e Mon Sep 17 00:00:00 2001 From: Peter Palaga Date: Mon, 18 Nov 2024 13:18:33 +0100 Subject: [PATCH 1/2] Allow running CI against other dependency branches than main --- .../build-and-run-jvm-tests/action.yml | 15 ------- .../maintenance-branch-info/action.yml | 40 +++++++++++++++++++ .../rebase-dependency-main-branch/action.yml | 31 ++++++++------ .github/actions/rebuild-dependency/action.yml | 6 ++- .github/workflows/build.yml | 38 ++++++++++++++++++ .github/workflows/quarkus-main-rebase.yml | 6 ++- 6 files changed, 106 insertions(+), 30 deletions(-) create mode 100644 .github/actions/maintenance-branch-info/action.yml diff --git a/.github/actions/build-and-run-jvm-tests/action.yml b/.github/actions/build-and-run-jvm-tests/action.yml index bb3d8a455..8a005b0bb 100644 --- a/.github/actions/build-and-run-jvm-tests/action.yml +++ b/.github/actions/build-and-run-jvm-tests/action.yml @@ -16,21 +16,6 @@ runs: distribution: temurin java-version: ${{ inputs.java-version }} - - name: Build CXF - if: github.ref == 'refs/heads/cxf-main' || github.base_ref == 'cxf-main' || github.head_ref == 'cxf-main' - uses: ./.github/actions/rebuild-dependency - id: rebuild-cxf - with: - dependency-git-repo-url: https://github.com/apache/cxf.git - dependency-short-name: cxf - - name: Build Quarkus - if: github.ref == 'refs/heads/quarkus-main' || github.base_ref == 'quarkus-main' || github.head_ref == 'quarkus-main' - uses: ./.github/actions/rebuild-dependency - id: rebuild-quarkus - with: - dependency-git-repo-url: https://github.com/quarkusio/quarkus.git - dependency-short-name: quarkus - - name: Ensure mvn cq:sync-versions -N causes no changes shell: bash run: | diff --git a/.github/actions/maintenance-branch-info/action.yml b/.github/actions/maintenance-branch-info/action.yml new file mode 100644 index 000000000..7e4e44191 --- /dev/null +++ b/.github/actions/maintenance-branch-info/action.yml @@ -0,0 +1,40 @@ +name: maintenance-branch-info +description: 'Figure out some information about the underlying maintenance branch of the current PR, merge or manually triggered event' + +inputs: + dependency-short-name: + description: "The short lower case name of the dependency as quarkus or cxf" + required: true + +outputs: + is-maintenance-branch: + description: "'true' if the underlying branch of the PR, merge or manually triggered build is a maintenance branch, such as quarkus-main, quarkus-3.15; otherwise 'false'" + value: '${{ steps.maintenance-branch-info-step.outputs.is-maintenance-branch }}' + dependency-stream: + description: "The name of the stream in the dependency git repository, such as main or 3.15 for Quarkus or main or 4.0 for CXF. The caller may map the stream to a remote branch that may be called differently, such as 4.0.x-fixes in case of CXF." + value: '${{ steps.maintenance-branch-info-step.outputs.dependency-stream }}' + +runs: + using: 'composite' + steps: + + - name: Detect maintenance branch info + id: maintenance-branch-info-step + shell: bash + run: | + refs=('${{ github.ref }}' '${{ github.base_ref }}' '${{ github.head_ref }}') + regex="${{ inputs.dependency-short-name }}-(main|[0-9]+\.[0-9]+)$" + + isMaintenanceBranch=false + dependencyStream='' + for ref in "${refs[@]}"; do + if [[ $ref =~ $regex ]]; then + isMaintenanceBranch=true + dependencyStream="${BASH_REMATCH[1]}" + break + fi + done + echo "isMaintenanceBranch = ${isMaintenanceBranch}" + echo "is-maintenance-branch='${isMaintenanceBranch}'" >> $GITHUB_OUTPUT + echo "dependencyStream = ${dependencyStream}" + echo "dependency-stream='$(echo "$dependencyStream")'" >> $GITHUB_OUTPUT diff --git a/.github/actions/rebase-dependency-main-branch/action.yml b/.github/actions/rebase-dependency-main-branch/action.yml index 0fdd63ae9..f1a0b8068 100644 --- a/.github/actions/rebase-dependency-main-branch/action.yml +++ b/.github/actions/rebase-dependency-main-branch/action.yml @@ -1,5 +1,5 @@ name: rebase-dependency-main-branch -description: 'Rebase a dependency main branch such as quarkus-main or cxf-main, rebuild it and report the status in a dedicated issue' +description: 'Rebase a maintenenance branch such as quarkus-main or cxf-main, rebuild it and report the status in a dedicated issue' inputs: java-version: @@ -11,6 +11,10 @@ inputs: dependency-short-name: description: "The short lower case name of the dependency as quarkus or cxf" required: true + dependency-branch: + description: "The name of the dependency branch to build against, such as main or 3.15" + required: true + default: main issue-id: description: "The issue number where to report any rebase or build issues" required: true @@ -20,7 +24,7 @@ inputs: outputs: dependency-commit: - description: "The SHA1 of the dependency main branch" + description: "The SHA1 of the branch specified in inputs.dependency-branch against which the current build was run" value: ${{ steps.rebuild-dependency.outputs.dependency-commit }} dependency-version: description: "The version of the dependency as present in the top pom.xml of its main branch" @@ -47,32 +51,34 @@ runs: distribution: temurin java-version: ${{ inputs.java-version }} - - name: rebase ${{ inputs.dependency-short-name }}-main + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: rebase ${{ inputs.dependency-short-name }}-${{ inputs.dependency-branch }} shell: bash run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" echo "REBASE_DEPENDENCY_MAIN_EXIT_STATUS=success" >> $GITHUB_ENV - git fetch origin main - git checkout main - git reset --hard origin/main - git fetch origin ${{ inputs.dependency-short-name }}-main - git checkout ${{ inputs.dependency-short-name }}-main >/dev/null 2>&1 || git checkout -b ${{ inputs.dependency-short-name }}-main origin/main + git fetch origin ${{ inputs.dependency-short-name }}-${{ inputs.dependency-branch }} \ + && git checkout ${{ inputs.dependency-short-name }}-${{ inputs.dependency-branch }} >/dev/null 2>&1 \ + || git checkout -b ${{ inputs.dependency-short-name }}-${{ inputs.dependency-branch }} origin/${{ github.head_ref || github.ref_name }} git status - echo "${{ inputs.dependency-short-name }}-main is at $(git rev-parse HEAD)" - git rebase main + echo "${{ inputs.dependency-short-name }}-${{ github.head_ref || github.ref_name }} is at $(git rev-parse HEAD)" + git rebase ${{ github.head_ref || github.ref_name }} rebaseExitCode=$? echo "rebaseExitCode = $rebaseExitCode" exit $rebaseExitCode - - name: reopen or comment on issue https://github.com/${{ github.repository }}/issues/${{ inputs.issue-id }} + - name: Reopen or comment on issue https://github.com/${{ github.repository }}/issues/${{ inputs.issue-id }} if: ${{ failure() }} shell: bash run: | echo "REBASE_DEPENDENCY_MAIN_EXIT_STATUS=rebase-failed" >> $GITHUB_ENV oldState=$(gh issue view ${{ inputs.issue-id }} --json state -q .state -R ${{ github.repository }}) echo "oldState = $oldState" - msg="❌ Could not rebase ${{ inputs.dependency-short-name }}-main in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + msg="❌ Could not rebase ${{ inputs.dependency-short-name }}-${{ github.head_ref || github.ref_name }} in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" if [[ "$oldState" == "OPEN" ]] ; then gh issue comment \ --repo ${{ github.repository }} \ @@ -93,6 +99,7 @@ runs: with: dependency-git-repo-url: ${{ inputs.dependency-git-repo-url }} dependency-short-name: ${{ inputs.dependency-short-name }} + dependency-branch: ${{ inputs.dependency-branch }} issue-id: ${{ inputs.issue-id }} token: "${{ inputs.token }}" diff --git a/.github/actions/rebuild-dependency/action.yml b/.github/actions/rebuild-dependency/action.yml index d518e38ab..b386e7518 100644 --- a/.github/actions/rebuild-dependency/action.yml +++ b/.github/actions/rebuild-dependency/action.yml @@ -8,6 +8,10 @@ inputs: dependency-short-name: description: "The short lower case name of the dependency as quarkus or cxf" required: true + dependency-branch: + description: "The name of the dependency branch to build against, such as main or 3.15" + required: true + default: main issue-id: description: "The issue number where to report the build failure" required: false @@ -47,7 +51,7 @@ runs: cd ~ if [[ ! -d "${{ inputs.dependency-short-name }}" ]] ; then # the dependency might have been build already - git clone --quiet --depth 1 --branch main ${{ inputs.dependency-git-repo-url }} + git clone --quiet --depth 1 --branch ${{ inputs.dependency-branch }} ${{ inputs.dependency-git-repo-url }} cd "${{ inputs.dependency-short-name }}" echo "Current ${{ inputs.dependency-short-name }} commit:" $(git rev-parse HEAD) if [[ "${{ inputs.dependency-short-name }}" == "quarkus" ]] ; then diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 674f4c84b..b5c5e2c27 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,44 @@ jobs: restore-keys: | ${{ runner.os }}-maven- + - name: Set up JDK ${{ inputs.java-version }} + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: ${{ inputs.java-version }} + + + - name: Detect CXF maintenance branch + id: cxf-branch-info + uses: ./.github/actions/maintenance-branch-info + with: + dependency-short-name: cxf + + - name: Build CXF if needed + if: steps.cxf-branch-info.outputs.is-maintenance-branch == 'true' + uses: ./.github/actions/rebuild-dependency + id: rebuild-cxf + with: + dependency-git-repo-url: https://github.com/apache/cxf.git + dependency-short-name: cxf + dependency-branch: '${{ steps.cxf-branch-info.outputs.dependency-stream == 'main' && steps.cxf-branch-info.outputs.dependency-stream || format('{0}.x-fixes', steps.cxf-branch-info.outputs.dependency-stream) }}' + + + - name: Detect Quarkus maintenance branch + id: quarkus-branch-info + uses: ./.github/actions/maintenance-branch-info + with: + dependency-short-name: quarkus + + - name: Build Quarkus if needed + if: steps.quarkus-branch-info.outputs.is-maintenance-branch == 'true' + uses: ./.github/actions/rebuild-dependency + id: rebuild-quarkus + with: + dependency-git-repo-url: https://github.com/quarkusio/quarkus.git + dependency-short-name: quarkus + dependency-branch: '${{ steps.quarkus-branch-info.outputs.dependency-stream }}' + - name: build-and-run-jvm-tests uses: ./.github/actions/build-and-run-jvm-tests with: diff --git a/.github/workflows/quarkus-main-rebase.yml b/.github/workflows/quarkus-main-rebase.yml index 7160a8f62..8e1307c89 100644 --- a/.github/workflows/quarkus-main-rebase.yml +++ b/.github/workflows/quarkus-main-rebase.yml @@ -10,6 +10,7 @@ env: LANG: en_US.UTF-8 ISSUE_ID: 1287 DEPENDENCY_SHORT_NAME: quarkus + DEPENDENCY_BRANCH: main JAVA_VERSION: 17 concurrency: @@ -32,6 +33,7 @@ jobs: java-version: ${{ env.JAVA_VERSION }} dependency-git-repo-url: https://github.com/quarkusio/quarkus.git dependency-short-name: ${{ env.DEPENDENCY_SHORT_NAME }} + dependency-branch: ${{ env.DEPENDENCY_BRANCH }} issue-id: ${{ env.ISSUE_ID }} token: "${{ secrets.QUARKIVERSEBOT_TOKEN }}" @@ -45,7 +47,7 @@ jobs: with: java-version: ${{ env.JAVA_VERSION }} - - name: git push origin ${{ env.DEPENDENCY_SHORT_NAME }}-main -f + - name: git push origin ${{ env.DEPENDENCY_SHORT_NAME }}-${{ env.DEPENDENCY_BRANCH }} -f shell: bash run: | lastCommitMessage="$(git log -1 --pretty=%B)" @@ -56,7 +58,7 @@ jobs: else echo "Not removing the last commit because its message is not '${{ steps.rebase-dependency-main-branch.outputs.upgrade-message }}' but '$lastCommitMessage'" fi - git push origin ${{ env.DEPENDENCY_SHORT_NAME }}-main -f + git push origin ${{ env.DEPENDENCY_SHORT_NAME }}-${{ env.DEPENDENCY_BRANCH }} -f - name: Reopen issue https://github.com/${{ github.repository }}/issues/${{ env.ISSUE_ID }} if: ${{ steps.rebase-dependency-main-branch.outputs.exit-status != 'success' && failure() }} From 3c8d91a1e3074bbb8fc83b349d7522ebf17dff8c Mon Sep 17 00:00:00 2001 From: Peter Palaga Date: Tue, 19 Nov 2024 14:54:58 +0100 Subject: [PATCH 2/2] Make the CI more modular to allow for testing also against CXF and also against branches other than main --- .../action.yml | 23 ++-- .../build-integration-branch/action.yml | 116 ++++++++++++++++++ .../action.yml | 41 ++++--- .github/actions/rebuild-dependency/action.yml | 12 +- .github/workflows/build-quarkus-main.yml | 33 +++++ .github/workflows/build.yml | 12 +- .github/workflows/quarkus-main-rebase.yml | 99 --------------- 7 files changed, 197 insertions(+), 139 deletions(-) rename .github/actions/{build-and-run-jvm-tests => build-and-test}/action.yml (61%) create mode 100644 .github/actions/build-integration-branch/action.yml rename .github/actions/{rebase-dependency-main-branch => rebase-integration-branch}/action.yml (74%) create mode 100644 .github/workflows/build-quarkus-main.yml delete mode 100644 .github/workflows/quarkus-main-rebase.yml diff --git a/.github/actions/build-and-run-jvm-tests/action.yml b/.github/actions/build-and-test/action.yml similarity index 61% rename from .github/actions/build-and-run-jvm-tests/action.yml rename to .github/actions/build-and-test/action.yml index 8a005b0bb..b54fca439 100644 --- a/.github/actions/build-and-run-jvm-tests/action.yml +++ b/.github/actions/build-and-test/action.yml @@ -1,11 +1,19 @@ -name: build-and-run-jvm-tests -description: 'Build the project and run JVM tests' +name: build-and-test +description: 'Build the project and run tests, optionally also native tests' inputs: java-version: description: 'Java version' required: true - + run-native-tests: + description: 'If true, the native tests will be run, otherwise only JVM tests will be run' + required: true + default: false + upload-antora-site: + description: 'If true, the Antora documentation site will be zipped and uploaded to the workflow run storage; otherwise it will not be uploaded' + required: true + default: false + runs: using: 'composite' steps: @@ -22,18 +30,19 @@ runs: ./mvnw cq:sync-versions -Dcq.simpleElementWhitespace=AUTODETECT_PREFER_SPACE -N -ntp [[ -z $(git status --porcelain | grep -v antora.yml) ]] || { echo 'There are uncommitted changes'; git status; git diff; exit 1; } - - name: mvn -B formatter:validate install + - name: mvn -B formatter:validate install ${{ inputs.run-native-tests && '-Pnative -Dquarkus.native.container-build' || '' }} shell: bash - run: ./mvnw -B formatter:validate install -fae -ntp + run: ./mvnw -B formatter:validate install ${{ inputs.run-native-tests && '-Pnative -Dquarkus.native.container-build' || '' }} -fae -ntp # Same as the previous but only JVM tests and different default ConduitFactory - - name: QUARKUS_CXF_DEFAULT_HTTP_CONDUIT_FACTORY=URLConnectionHTTPConduitFactory mvn -B test + - name: QUARKUS_CXF_DEFAULT_HTTP_CONDUIT_FACTORY=URLConnectionHTTPConduitFactory mvn clean install ${{ inputs.run-native-tests && '-Pnative -Dquarkus.native.container-build' || '' }} shell: bash env: QUARKUS_CXF_DEFAULT_HTTP_CONDUIT_FACTORY: URLConnectionHTTPConduitFactory - run: ./mvnw -B clean install -fae -ntp + run: ./mvnw -B clean install ${{ inputs.run-native-tests && '-Pnative -Dquarkus.native.container-build' || '' }} -fae -ntp - name: 'Upload generated Antora docs site' + if: ${{ inputs.upload-antora-site }} uses: actions/upload-artifact@v4 with: name: docs diff --git a/.github/actions/build-integration-branch/action.yml b/.github/actions/build-integration-branch/action.yml new file mode 100644 index 000000000..cfe576b19 --- /dev/null +++ b/.github/actions/build-integration-branch/action.yml @@ -0,0 +1,116 @@ +name: build-integration-branch +description: 'Build and test an integration branch such as quarkus-main, quarkus-3.15, cxf-main or cxf-4.0 against Quarkus or CXF freshly built from the respective maintenance branch' + +inputs: + java-version: + description: 'Java version' + required: true + base-branch: + description: "The name of the branch in our git repository, such as main or 3.15, on top of which the given integration branch, such as quarkus-main, quarkus-3.15, cxf-main or cxf-4.0, should be rebased" + required: true + default: main + integration-branch: + description: "The name of the integration branch in our git repository, such as quarkus-main or quarkus-3.15, which should be rebased on top of the given base branch" + required: true + default: main + dependency-git-repo-url: + description: "The URL of the dependency's git repository to checkout and build from" + required: true + dependency-short-name: + description: "The short lower case name of the dependency as quarkus or cxf" + required: true + dependency-branch: + description: "The name of the dependency branch in the dependency git repository to build and test against, such as main or 3.15 for Quarkus or main or 4.0.x-fixes for CXF" + required: true + default: main + issue-id: + description: "The issue number where to report any rebase or build issues" + required: true + token: + description: "The token to use to authenticate against GitHub API" + required: true + +runs: + using: 'composite' + steps: + + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: rebase-integration-branch + uses: ./.github/actions/rebase-integration-branch + id: rebase-integration-branch + with: + java-version: ${{ inputs.java-version }} + base-branch: ${{ inputs.base-branch }} + integration-branch: ${{ inputs.integration-branch }} + dependency-git-repo-url: ${{ inputs.dependency-git-repo-url }} + dependency-short-name: ${{ inputs.dependency-short-name }} + dependency-branch: ${{ inputs.dependency-branch }} + issue-id: ${{ inputs.issue-id }} + token: "${{ inputs.token }}" + + - name: Show steps.rebase-integration-branch.outputs.exit-status + if: ${{ !cancelled() }} + shell: bash + run: | + echo "steps.rebuild-dependency.outputs.exit-status: ${{ steps.rebase-integration-branch.outputs.exit-status }}" + + - name: build-and-test + uses: ./.github/actions/build-and-test + with: + java-version: ${{ inputs.java-version }} + run-native-tests: true + upload-antora-site: false + + - name: git push origin ${{ inputs.dependency-integration-branch }} -f + shell: bash + run: | + lastCommitMessage="$(git log -1 --pretty=%B)" + echo "Comparing last commit message '$lastCommitMessage' with '${{ steps.rebase-integration-branch.outputs.upgrade-message }}'" + if [[ "$lastCommitMessage" == "${{ steps.rebase-integration-branch.outputs.upgrade-message }}" ]]; then + echo "Removing last commit '$lastCommitMessage'" + git reset --hard HEAD~1 + else + echo "Not removing the last commit because its message is not '${{ steps.rebase-integration-branch.outputs.upgrade-message }}' but '$lastCommitMessage'" + fi + git push origin ${{ inputs.dependency-integration-branch }} -f + + - name: Reopen issue https://github.com/${{ github.repository }}/issues/${{ inputs.issue-id }} + if: ${{ steps.rebase-integration-branch.outputs.exit-status != 'success' && failure() }} + shell: bash + run: | + oldState=$(gh issue view ${{ inputs.issue-id }} --json state -q .state -R ${{ github.repository }}) + echo "oldState = $oldState" + msg="❌ Build with ${{ inputs.dependency-short-name }} ${{ steps.rebase-integration-branch.outputs.dependency-commit }} failed in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + if [[ "$oldState" == "OPEN" ]] ; then + gh issue comment \ + --repo ${{ github.repository }} \ + --body "$msg" \ + ${{ inputs.issue-id }} + else + gh issue reopen \ + --repo ${{ github.repository }} \ + --comment "$msg" \ + ${{ inputs.issue-id }} + fi + env: + GH_TOKEN: ${{ inputs.token }} + + - name: Close issue https://github.com/${{ github.repository }}/issues/${{ inputs.issue-id }} + if: ${{ success() }} + shell: bash + run: | + oldState=$(gh issue view ${{ inputs.issue-id }} --json state -q .state -R ${{ github.repository }}) + echo "oldState = $oldState" + msg="✅ Build with ${{ inputs.dependency-short-name }} ${{ steps.rebase-integration-branch.outputs.dependency-commit }} succeeded in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + if [[ "$oldState" != "CLOSED" ]] ; then + gh issue close \ + --repo ${{ github.repository }} \ + --comment "$msg" \ + ${{ inputs.issue-id }} + fi + env: + GH_TOKEN: ${{ inputs.token }} + diff --git a/.github/actions/rebase-dependency-main-branch/action.yml b/.github/actions/rebase-integration-branch/action.yml similarity index 74% rename from .github/actions/rebase-dependency-main-branch/action.yml rename to .github/actions/rebase-integration-branch/action.yml index f1a0b8068..6cd7a80c4 100644 --- a/.github/actions/rebase-dependency-main-branch/action.yml +++ b/.github/actions/rebase-integration-branch/action.yml @@ -1,10 +1,18 @@ -name: rebase-dependency-main-branch -description: 'Rebase a maintenenance branch such as quarkus-main or cxf-main, rebuild it and report the status in a dedicated issue' +name: rebase-integration-branch +description: 'Rebase an integration branch such as quarkus-main, quarkus-3.15, cxf-main or cxf-4.0, rebuild it and report the status in a dedicated issue' inputs: java-version: description: 'Java version' required: true + base-branch: + description: "The name of the branch in our git repository, such as main or 3.15, on top of which the given integration branch, such as quarkus-main, quarkus-3.15, cxf-main or cxf-4.0, should be rebased" + required: true + default: main + integration-branch: + description: "The name of the integration branch in our git repository, such as quarkus-main or quarkus-3.15, which should be rebased on top of the given base branch" + required: true + default: main dependency-git-repo-url: description: "The URL of the dependency's git repository to checkout and build from" required: true @@ -12,7 +20,7 @@ inputs: description: "The short lower case name of the dependency as quarkus or cxf" required: true dependency-branch: - description: "The name of the dependency branch to build against, such as main or 3.15" + description: "The name of the dependency branch in the dependency git repository to build and test against, such as main or 3.15 for Quarkus or main or 4.0.x-fixes for CXF" required: true default: main issue-id: @@ -39,7 +47,7 @@ outputs: * success * rebase-failed * dependency-build-failed - value: ${{ env.REBASE_DEPENDENCY_MAIN_EXIT_STATUS }} + value: ${{ steps.rebase.outputs.exit-status != 'success' && steps.rebase.outputs.exit-status || steps.rebuild-dependency.outputs.exit-status }} runs: using: 'composite' @@ -55,30 +63,30 @@ runs: with: fetch-depth: 0 - - name: rebase ${{ inputs.dependency-short-name }}-${{ inputs.dependency-branch }} + - name: rebase ${{ inputs.integration-branch }} + id: rebase shell: bash run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - echo "REBASE_DEPENDENCY_MAIN_EXIT_STATUS=success" >> $GITHUB_ENV - git fetch origin ${{ inputs.dependency-short-name }}-${{ inputs.dependency-branch }} \ - && git checkout ${{ inputs.dependency-short-name }}-${{ inputs.dependency-branch }} >/dev/null 2>&1 \ - || git checkout -b ${{ inputs.dependency-short-name }}-${{ inputs.dependency-branch }} origin/${{ github.head_ref || github.ref_name }} + git fetch origin ${{ inputs.integration-branch }} \ + && git checkout ${{ inputs.integration-branch }} >/dev/null 2>&1 \ + || git checkout -b ${{ inputs.integration-branch }} origin/${{ inputs.base-branch }} git status - echo "${{ inputs.dependency-short-name }}-${{ github.head_ref || github.ref_name }} is at $(git rev-parse HEAD)" - git rebase ${{ github.head_ref || github.ref_name }} + echo "${{ inputs.integration-branch }} is at $(git rev-parse HEAD)" + git rebase ${{ inputs.base-branch }} rebaseExitCode=$? echo "rebaseExitCode = $rebaseExitCode" + echo "exit-status=$( [[ $rebaseExitCode == 0 ]] && echo 'success' || echo 'rebase-failed' )" >> $GITHUB_OUTPUT exit $rebaseExitCode - name: Reopen or comment on issue https://github.com/${{ github.repository }}/issues/${{ inputs.issue-id }} if: ${{ failure() }} shell: bash run: | - echo "REBASE_DEPENDENCY_MAIN_EXIT_STATUS=rebase-failed" >> $GITHUB_ENV oldState=$(gh issue view ${{ inputs.issue-id }} --json state -q .state -R ${{ github.repository }}) echo "oldState = $oldState" - msg="❌ Could not rebase ${{ inputs.dependency-short-name }}-${{ github.head_ref || github.ref_name }} in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + msg="❌ Could not rebase ${{ inputs.integration-branch }} on top of ${{ inputs.base-branch }}}} in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" if [[ "$oldState" == "OPEN" ]] ; then gh issue comment \ --repo ${{ github.repository }} \ @@ -104,16 +112,11 @@ runs: token: "${{ inputs.token }}" - name: Show steps.rebuild-dependency.outputs.exit-status + if: ${{ !cancelled() }} shell: bash run: | echo "steps.rebuild-dependency.outputs.exit-status: ${{ steps.rebuild-dependency.outputs.exit-status }}" - - name: Set status - if: ${{ failure() && steps.rebuild-dependency.outputs.exit-status == 'dependency-build-failed' }} - shell: bash - run: | - echo "REBASE_DEPENDENCY_MAIN_EXIT_STATUS=dependency-build-failed" >> $GITHUB_ENV - - name: Set ${{ inputs.dependency-short-name }}.version to ${{ steps.rebuild-dependency.outputs.dependency-version }} shell: bash id: set-version diff --git a/.github/actions/rebuild-dependency/action.yml b/.github/actions/rebuild-dependency/action.yml index b386e7518..90ca8b22c 100644 --- a/.github/actions/rebuild-dependency/action.yml +++ b/.github/actions/rebuild-dependency/action.yml @@ -33,7 +33,7 @@ outputs: It can be one of the following: * success * dependency-build-failed - value: ${{ env.REBUILD_DEPENDENCY_EXIT_STATUS }} + value: ${{ steps.set-outputs.outputs.exit-status }} runs: using: 'composite' @@ -66,24 +66,18 @@ runs: - name: Set outputs id: set-outputs + if: ${{ !cancelled() }} shell: bash run: | cd ~/${{ inputs.dependency-short-name }} echo "dependency-commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT echo "dependency-version=$(xmllint --xpath "/*[local-name() = 'project']/*[local-name() = 'version']/text()" pom.xml)" >> $GITHUB_OUTPUT - echo "REBUILD_DEPENDENCY_EXIT_STATUS=success" >> $GITHUB_ENV - - - name: Set status - if: ${{ failure() }} - shell: bash - run: | - echo "REBUILD_DEPENDENCY_EXIT_STATUS=dependency-build-failed" >> $GITHUB_ENV + echo "exit-status=${{ failed() && 'dependency-build-failed' || 'success' }}" >> $GITHUB_OUTPUT - name: Reopen or comment on issue https://github.com/${{ github.repository }}/issues/${{ inputs.issue-id }} if: ${{ failure() && inputs.issue-id != '' }} shell: bash run: | - echo "REBASE_DEPENDENCY_MAIN_EXIT_STATUS=rebase-failed" >> $GITHUB_ENV oldState=$(gh issue view ${{ inputs.issue-id }} --json state -q .state -R ${{ github.repository }}) echo "oldState = $oldState" gitUrl="${{ inputs.dependency-git-repo-url }}" diff --git a/.github/workflows/build-quarkus-main.yml b/.github/workflows/build-quarkus-main.yml new file mode 100644 index 000000000..140ba1bf0 --- /dev/null +++ b/.github/workflows/build-quarkus-main.yml @@ -0,0 +1,33 @@ +name: build-quarkus-main + +on: + workflow_dispatch: + schedule: + # Run every day at 2AM + - cron: '0 2 * * *' + +env: + LANG: en_US.UTF-8 + JAVA_VERSION: 17 + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + rebase-quarkus-main: + if: github.repository == 'quarkiverse/quarkus-cxf' + runs-on: ubuntu-latest + steps: + + - name: build-integration-branch + uses: ./.github/actions/build-integration-branch + with: + java-version: ${{ env.JAVA_VERSION }} + base-branch: main + integration-branch: quarkus-main + dependency-git-repo-url: https://github.com/quarkusio/quarkus.git + dependency-short-name: quarkus + dependency-branch: main + issue-id: 1287 + token: "${{ secrets.QUARKIVERSEBOT_TOKEN }}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5c5e2c27..f55eabe06 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ concurrency: cancel-in-progress: true jobs: - build-and-run-jvm-tests: + build-and-test: if: startsWith(github.head_ref, 'trigger-release-') == false runs-on: ubuntu-latest @@ -67,10 +67,12 @@ jobs: dependency-short-name: quarkus dependency-branch: '${{ steps.quarkus-branch-info.outputs.dependency-stream }}' - - name: build-and-run-jvm-tests - uses: ./.github/actions/build-and-run-jvm-tests + - name: build-and-test + uses: ./.github/actions/build-and-test with: java-version: ${{ env.JAVA_VERSION }} + run-native-tests: false + upload-antora-site: true native-tests: strategy: @@ -78,7 +80,7 @@ jobs: matrix: testModule: ['async-vertx-client', 'client', 'client-server', 'fastinfoset', 'hc5', 'metrics', 'mtls', 'mtls -Djks', 'mtom', 'mtom-awt', 'opentelemetry', 'saaj', 'santuario-xmlsec', 'server', 'ws-rm-client', 'ws-security', 'ws-security -Djks', 'ws-security-policy', 'ws-security-policy -Djks', 'ws-trust', 'wsdl2java', 'wsdl2java-no-config'] name: ${{matrix.testModule}} native tests - needs: build-and-run-jvm-tests + needs: build-and-test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -90,7 +92,7 @@ jobs: windows-tests: name: Windows tests - needs: build-and-run-jvm-tests + needs: build-and-test runs-on: windows-latest steps: diff --git a/.github/workflows/quarkus-main-rebase.yml b/.github/workflows/quarkus-main-rebase.yml deleted file mode 100644 index 8e1307c89..000000000 --- a/.github/workflows/quarkus-main-rebase.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: quarkus-main rebase - -on: - workflow_dispatch: - schedule: - # Run every day at 2AM - - cron: '0 2 * * *' - -env: - LANG: en_US.UTF-8 - ISSUE_ID: 1287 - DEPENDENCY_SHORT_NAME: quarkus - DEPENDENCY_BRANCH: main - JAVA_VERSION: 17 - -concurrency: - group: ${{ github.ref }}-${{ github.workflow }} - cancel-in-progress: true - -jobs: - rebase-quarkus-main: - if: github.repository == 'quarkiverse/quarkus-cxf' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: rebase-dependency-main-branch - uses: ./.github/actions/rebase-dependency-main-branch - id: rebase-dependency-main-branch - with: - java-version: ${{ env.JAVA_VERSION }} - dependency-git-repo-url: https://github.com/quarkusio/quarkus.git - dependency-short-name: ${{ env.DEPENDENCY_SHORT_NAME }} - dependency-branch: ${{ env.DEPENDENCY_BRANCH }} - issue-id: ${{ env.ISSUE_ID }} - token: "${{ secrets.QUARKIVERSEBOT_TOKEN }}" - - - name: Show steps.rebase-dependency-main-branch.outputs.exit-status - shell: bash - run: | - echo "steps.rebuild-dependency.outputs.exit-status: ${{ steps.rebase-dependency-main-branch.outputs.exit-status }}" - - - name: build-and-run-jvm-tests - uses: ./.github/actions/build-and-run-jvm-tests - with: - java-version: ${{ env.JAVA_VERSION }} - - - name: git push origin ${{ env.DEPENDENCY_SHORT_NAME }}-${{ env.DEPENDENCY_BRANCH }} -f - shell: bash - run: | - lastCommitMessage="$(git log -1 --pretty=%B)" - echo "Comparing last commit message '$lastCommitMessage' with '${{ steps.rebase-dependency-main-branch.outputs.upgrade-message }}'" - if [[ "$lastCommitMessage" == "${{ steps.rebase-dependency-main-branch.outputs.upgrade-message }}" ]]; then - echo "Removing last commit '$lastCommitMessage'" - git reset --hard HEAD~1 - else - echo "Not removing the last commit because its message is not '${{ steps.rebase-dependency-main-branch.outputs.upgrade-message }}' but '$lastCommitMessage'" - fi - git push origin ${{ env.DEPENDENCY_SHORT_NAME }}-${{ env.DEPENDENCY_BRANCH }} -f - - - name: Reopen issue https://github.com/${{ github.repository }}/issues/${{ env.ISSUE_ID }} - if: ${{ steps.rebase-dependency-main-branch.outputs.exit-status != 'success' && failure() }} - shell: bash - run: | - oldState=$(gh issue view ${{ env.ISSUE_ID }} --json state -q .state -R ${{ github.repository }}) - echo "oldState = $oldState" - msg="❌ Build with ${{ env.DEPENDENCY_SHORT_NAME }} ${{ steps.rebase-dependency-main-branch.outputs.dependency-commit }} failed in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - if [[ "$oldState" == "OPEN" ]] ; then - gh issue comment \ - --repo ${{ github.repository }} \ - --body "$msg" \ - ${{ env.ISSUE_ID }} - else - gh issue reopen \ - --repo ${{ github.repository }} \ - --comment "$msg" \ - ${{ env.ISSUE_ID }} - fi - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Close issue https://github.com/${{ github.repository }}/issues/${{ env.ISSUE_ID }} - if: ${{ success() }} - shell: bash - run: | - oldState=$(gh issue view ${{ env.ISSUE_ID }} --json state -q .state -R ${{ github.repository }}) - echo "oldState = $oldState" - msg="✅ Build with ${{ env.DEPENDENCY_SHORT_NAME }} ${{ steps.rebase-dependency-main-branch.outputs.dependency-commit }} succeeded in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - if [[ "$oldState" != "CLOSED" ]] ; then - gh issue close \ - --repo ${{ github.repository }} \ - --comment "$msg" \ - ${{ env.ISSUE_ID }} - fi - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} -