generated from quarkiverse/quarkiverse-template
-
Notifications
You must be signed in to change notification settings - Fork 62
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
3 changed files
with
192 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,93 @@ | ||
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_STATE=closed" >> $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_STATE=open" >> $GITHUB_ENV ) | ||
- name: test the output | ||
shell: bash | ||
run: | | ||
echo "${{ env.GH_ISSUE_MESSAGE }}" | ||
echo "${{ env.GH_ISSUE_STATE }}" | ||
- name: update-issue | ||
uses: ./.github/actions/update-issue | ||
with: | ||
issue-id: "${{ env.ISSUE_ID }}" | ||
token: "${{ inputs.token }}" | ||
add-message: "${{ env.GH_ISSUE_MESSAGE }}" | ||
new-state: "${{ env.GH_ISSUE_STATE }}" | ||
|
||
- name: Make the current workflow fail | ||
shell: bash | ||
if: env.GH_ISSUE_STATE == 'open' | ||
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,39 @@ | ||
name: update-issue | ||
description: 'Update the status of a specific issue and optionally add a message' | ||
|
||
inputs: | ||
issue-id: | ||
description: "The number of the issue to update" | ||
required: true | ||
token: | ||
description: "The token to use to authenticate against GitHub API" | ||
required: true | ||
add-message: | ||
description: "The message body to add" | ||
required: true | ||
default: '' | ||
new-state: | ||
description: "The new issue state to set" | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
|
||
- name: Add message to issue ${{ inputs.issue-id }} | ||
if: inputs.add-message != '' | ||
uses: peter-evans/create-or-update-comment@v4 | ||
with: | ||
token: ${{ inputs.token }} | ||
issue-number: ${{ inputs.issue-id }} | ||
body: | | ||
${{ inputs.add-message }} | ||
- name: Update the status of issue ${{ inputs.issue-id }} | ||
shell: bash | ||
run: | | ||
curl --request PATCH \ | ||
--url ${{ github.api_url }}/repos/${{ github.repository }}/issues/${{ inputs.issue-id }} \ | ||
--header 'Authorization: token ${{ inputs.token }}' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{"state": "${{ inputs.new-state }}"}' |
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,60 @@ | ||
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() }} | ||
uses: ./.github/actions/update-issue | ||
with: | ||
issue-id: "${{ env.ISSUE_ID }}" | ||
add-message: "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 }}" | ||
new-state: "open" | ||
|
||
- name: Update issue ${{ env.ISSUE_ID }} | ||
if: ${{ success() }} | ||
uses: ./.github/actions/update-issue | ||
with: | ||
issue-id: "${{ env.ISSUE_ID }}" | ||
token: "${{ secrets.QUARKIVERSEBOT_TOKEN }}" | ||
new-state: "closed" |