generated from quarkiverse/quarkiverse-template
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
160 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
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' | ||
|
||
inputs: | ||
java-version: | ||
description: 'Java version' | ||
required: true | ||
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 | ||
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 | ||
additional-maven-args: | ||
description: "Additional arguments to append to mvn install -ntp" | ||
required: true | ||
|
||
outputs: | ||
dependency-commit: | ||
description: "The SHA1 of the dependency main branch" | ||
value: ${{ steps.checkout-dependency.outputs.dependency-commit }} | ||
dependency-version: | ||
description: "The version of the dependency as present in the top pom.xml of its main branch" | ||
value: ${{ steps.checkout-dependency.outputs.dependency-version }} | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: rebase ${{ inputs.dependency-short-name }}-main | ||
shell: bash | ||
run: | | ||
echo "GH_ISSUE_OPERATION=close" >> $GITHUB_ENV | ||
set -e | ||
git fetch origin | ||
git checkout ${{ inputs.dependency-short-name }}-main 2>/dev/null || git checkout -b ${{ inputs.dependency-short-name }}-main | ||
git rebase origin/main \ | ||
|| ( echo "GH_ISSUE_MESSAGE=Could not rebase ${{ inputs.dependency-short-name }}-main in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV \ | ||
&& echo "GH_ISSUE_OPERATION=reopen" >> $GITHUB_ENV ) | ||
- name: test the output | ||
shell: bash | ||
run: | | ||
echo "${{ env.GH_ISSUE_MESSAGE }}" | ||
echo "${{ env.GH_ISSUE_OPERATION }}" | ||
- name: ${{ env.GH_ISSUE_OPERATION }} issue https://github.com/${{ github.repository }}/issues/${{ inputs.issue-id }} | ||
shell: bash | ||
run: | | ||
comment="$( [[ "${{ env.GH_ISSUE_MESSAGE }}" != "" ]] && echo "--comment '${{ env.GH_ISSUE_MESSAGE }}'" )" | ||
echo "comment: $comment" | ||
gh issue ${{ env.GH_ISSUE_OPERATION }} \ | ||
--repo ${{ github.repository }} \ | ||
$comment \ | ||
${{ inputs.issue-id }} | ||
env: | ||
GH_TOKEN: ${{ inputs.token }} | ||
|
||
- name: Make the current workflow fail | ||
shell: bash | ||
if: env.GH_ISSUE_OPERATION == 'reopen' | ||
run: | | ||
exit 1 | ||
- name: Checkout ${{ inputs.dependency-git-repo-url }} | ||
id: checkout-dependency | ||
shell: bash | ||
run: | | ||
repoName="$(basename -s .git "${{ inputs.dependency-git-repo-url }}")" | ||
cd ~ | ||
[[ -d "$repoName" ]] || git clone --depth 1 --branch main ${{ inputs.dependency-git-repo-url }} | ||
cd $repoName \ | ||
&& echo "Current $repoName commit:" $(git rev-parse HEAD) \ | ||
&& 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 | ||
- name: Set ${{ inputs.dependency-short-name }}.version to ${{ steps.checkout-dependency.outputs.dependency-version }} | ||
shell: bash | ||
run: | | ||
sed -i 's|<${{ inputs.dependency-short-name }}.version>\[^<\]*</${{ inputs.dependency-short-name }}.version>|<${{ inputs.dependency-short-name }}.version>${{ steps.checkout-dependency.outputs.dependency-version }}</${{ inputs.dependency-short-name }}.version>|' pom.xml | ||
if git diff-index --quiet HEAD --; then | ||
echo "${{ inputs.dependency-short-name }}-main uses version ${{ steps.checkout-dependency.outputs.dependency-version }} already" | ||
./mvnw cq:sync-versions -Dcq.simpleElementWhitespace=AUTODETECT_PREFER_SPACE -N | ||
git add -A | ||
git commit -m "Re-run mvn cq:sync-versions" | ||
else | ||
./mvnw cq:sync-versions -Dcq.simpleElementWhitespace=AUTODETECT_PREFER_SPACE -N | ||
git add -A | ||
git commit -m "Upgrade ${{ inputs.dependency-short-name }}.version to ${{ steps.checkout-dependency.outputs.dependency-version }}" | ||
fi |
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,63 @@ | ||
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 | ||
|
||
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 | ||
|
||
- 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 }} | ||
issue-id: ${{ env.ISSUE_ID }} | ||
token: "${{ secrets.QUARKIVERSEBOT_TOKEN }}" | ||
additional-maven-args: '-DskipTests -Dcheckstyle.skip' | ||
|
||
- name: build-and-run-jvm-tests | ||
uses: ./.github/actions/build-and-run-jvm-tests | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
|
||
- name: push origin ${{ env.DEPENDENCY_SHORT_NAME }}-main -f | ||
shell: bash | ||
run: | | ||
push origin ${{ env.DEPENDENCY_SHORT_NAME }}-main -f | ||
- name: Update issue ${{ env.ISSUE_ID }} | ||
if: ${{ failure() }} | ||
shell: bash | ||
run: | | ||
gh issue reopen \ | ||
--repo ${{ github.repository }} \ | ||
--comment "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 }}" \ | ||
${{ env.ISSUE_ID }} | ||
env: | ||
GH_TOKEN: ${{ secrets.QUARKIVERSEBOT_TOKEN }} | ||
|
||
- name: Close issue ${{ env.ISSUE_ID }} | ||
if: ${{ success() }} | ||
shell: bash | ||
run: gh issue close --repo ${{ github.repository }} ${{ env.ISSUE_ID }} | ||
env: | ||
GH_TOKEN: ${{ secrets.QUARKIVERSEBOT_TOKEN }} | ||
|