forked from quarkiverse/quarkus-cxf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the CI more modular to allow for testing also against CXF and also
against branches other than main
- Loading branch information
Showing
7 changed files
with
197 additions
and
139 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
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 | ||
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" | ||
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 "[email protected]" | ||
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 | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }}" |
This file contains 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
Oops, something went wrong.