diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 221daf3..9d9df9c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,30 @@ version: 2 updates: - - package-ecosystem: "maven" - directory: "/" + - package-ecosystem: github-actions + directory: / schedule: - interval: "daily" - open-pull-requests-limit: 10 \ No newline at end of file + interval: weekly + commit-message: + prefix: '[github-actions] ' + prefix-development: '[github-actions] ' + include: scope + reviewers: + - rmgrimm + labels: + - build + open-pull-requests-limit: 5 + + - package-ecosystem: maven + directory: / + schedule: + interval: daily + commit-message: + prefix: '[maven] ' + prefix-development: '[maven] ' + include: scope + reviewers: + - rmgrimm + labels: + - build + - dependencies + open-pull-requests-limit: 5 diff --git a/.github/workflows/build-container-image.yml b/.github/workflows/build-container-image.yml new file mode 100644 index 0000000..773abfb --- /dev/null +++ b/.github/workflows/build-container-image.yml @@ -0,0 +1,128 @@ +name: Build Container Images + +on: + workflow_dispatch: + inputs: + git-ref: + description: Git Ref + required: true + type: string + build-mode: + description: Build Mode + required: false + type: choice + default: only_jvm + options: + - only_jvm + - only_native + - jvm_and_native + tag-as-latest: + description: Tag as Latest + required: false + type: boolean + default: false + workflow_call: + inputs: + git-ref: + required: true + type: string + build-mode: + required: false + type: string + default: only_jvm + tag-as-latest: + required: false + type: boolean + default: false + +jobs: + container-image: + name: Build, Tag, Push Container Image + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout Project + uses: actions/checkout@v4 + with: + ref: ${{ inputs.git-ref }} + + - name: Set Up JDK + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: '17' + settings-path: ${{ github.workspace }} + server-id: github + + - name: Determine Home Directory + id: find-home + run: | + echo "home=$HOME" >> $GITHUB_OUTPUT + + - name: Cache Maven Local Repo + uses: actions/cache@v3 + with: + path: ${{ steps.find-home.outputs.home }}/.m2/repository + key: ${{ runner.os }}-${{ runner.arch }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-maven- + + - name: Lowercase Repository Owner + id: repo-owner-string + uses: ASzc/change-string-case-action@v5 + with: + string: ${{ github.repository_owner }} + + - name: Lowercase Repository Name + id: repo-name-string + uses: ASzc/change-string-case-action@v5 + with: + string: ${{ github.event.repository.name }} + + - name: Build and Push Image (JVM-mode) + if: ${{ success() && contains(fromJSON('["only_jvm","jvm_and_native"]'), inputs.build-mode) }} + run: >- + ./mvnw + --settings ${{ github.workspace }}/settings.xml + --batch-mode + verify + -Dquarkus.jib.platforms=linux/amd64,linux/arm64 + -Dquarkus.container-image.build=true + -Dquarkus.container-image.push=true + -Dquarkus.container-image.registry=ghcr.io + -Dquarkus.container-image.username=${{ github.actor }} + -Dquarkus.container-image.password=${{ github.token }} + -Dquarkus.container-image.group=${{ steps.repo-owner-string.outputs.lowercase }} + -Dquarkus.container-image.name=${{ steps.repo-name-string.outputs.lowercase }} + -Dquarkus.container-image.tag=${{ inputs.git-ref }} + ${{ inputs.tag-as-latest == true && '-Dquarkus.container-image.additional-tags=latest' || '' }} + -Dquarkus.container-image.labels.\"org.opencontainers.image.source\"=${{ github.server_url }}/${{ github.repository }} + -Dquarkus.container-image.labels.url=${{ github.server_url }}/${{ github.repository }}/tree/${{ inputs.git-ref }} + -Dquarkus.container-image.labels.vcs-type=git + -Dquarkus.container-image.labels.vcs-ref=${{ inputs.git-ref }} + + - name: Build and Push Image (native-mode) + if: ${{ success() && contains(fromJSON('["only_native","jvm_and_native"]'), inputs.build-mode) }} + run: >- + ./mvnw + --settings ${{ github.workspace }}/settings.xml + --batch-mode + verify + -Pnative + -Dquarkus.container-image.build=true + -Dquarkus.container-image.push=true + -Dquarkus.container-image.registry=ghcr.io + -Dquarkus.container-image.username=${{ github.actor }} + -Dquarkus.container-image.password=${{ github.token }} + -Dquarkus.container-image.group=${{ steps.repo-owner-string.outputs.lowercase }} + -Dquarkus.container-image.name=${{ steps.repo-name-string.outputs.lowercase }} + -Dquarkus.container-image.tag=${{ inputs.git-ref }}-native + ${{ inputs.tag-as-latest == true && '-Dquarkus.container-image.additional-tags=latest-native' || '' }} + -Dquarkus.container-image.labels.\"org.opencontainers.image.source\"=${{ github.server_url }}/${{ github.repository }} + -Dquarkus.container-image.labels.url=${{ github.server_url }}/${{ github.repository }}/tree/${{ inputs.git-ref }} + -Dquarkus.container-image.labels.vcs-type=git + -Dquarkus.container-image.labels.vcs-ref=${{ inputs.git-ref }} diff --git a/.github/workflows/perform-release.yml b/.github/workflows/perform-release.yml index 9e2615c..6403fb3 100644 --- a/.github/workflows/perform-release.yml +++ b/.github/workflows/perform-release.yml @@ -1,32 +1,60 @@ name: Perform Release on: - workflow_dispatch: { } + workflow_dispatch: + inputs: + dry-run: + description: Dry Run + required: false + type: boolean + default: false + release-version: + description: Release Version + required: false + type: string + next-version: + description: Next Development Version + required: false + type: string jobs: - build-deploy-maven: + maven-build-deploy: name: Build and Deploy Maven Artifacts runs-on: ubuntu-latest + permissions: contents: write packages: write outputs: release-sha: ${{ steps.release-sha.outputs.value }} + release-tag: ${{ steps.release-tag.outputs.value }} steps: - name: Checkout 3scale CMS - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set Up JDK uses: actions/setup-java@v3 with: distribution: temurin java-version: '17' - cache: maven settings-path: ${{ github.workspace }} server-id: github + - name: Determine Home Directory + id: find-home + run: | + echo "home=$HOME" >> $GITHUB_OUTPUT + + - name: Cache Maven Local Repo + uses: actions/cache@v3 + with: + path: ${{ steps.find-home.outputs.home }}/.m2/repository + key: ${{ runner.os }}-${{ runner.arch }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-maven- + - name: Configure Git User run: | git config user.name "GitHub Actions" @@ -41,12 +69,20 @@ jobs: -e 's;.*;scm:git:${{ github.server_url }}/${{ github.repository }}.git;' pom.xml - - name: Prepare Maven Release (build code) + - name: Prepare Maven Release (build code and create tag) + id: release-prepare + env: + GITHUB_TOKEN: ${{ github.token }} + NEXT_VERSION_ARGS: ${{ inputs.next-version && format('-DdevelopmentVersion={0}', inputs.next-version) || '' }} + RELEASE_VER_ARGS: ${{ inputs.release-version && format('-DreleaseVersion={0}', inputs.release-version) || '' }} run: >- ./mvnw --settings ${{ github.workspace }}/settings.xml --batch-mode release:prepare + ${{ format('-DdryRun={0}', inputs.dry-run) }} + $NEXT_VERSION_ARGS + $RELEASE_VER_ARGS -DcheckModificationExcludeList=pom.xml -Dusername=${{ github.token }} -DpreparationGoals='clean verify' @@ -54,79 +90,86 @@ jobs: --settings ${{ github.workspace }}/settings.xml -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository_owner }}/${{ github.event.repository.name }} ' - env: - GITHUB_TOKEN: ${{ github.token }} - name: Perform Maven Release (deploy artifacts) + env: + GITHUB_TOKEN: ${{ github.token }} run: >- ./mvnw --settings ${{ github.workspace }}/settings.xml --batch-mode release:perform + -DlocalCheckout=true + ${{ format('-DdryRun={0}', inputs.dry-run) }} -Dusername=${{ github.token }} -Dgoals='deploy' + + - name: Rollback Maven Release unless Success + if: ${{ !success() && !inputs.dry-run && steps.release-prepare.outcome == 'success' }} env: GITHUB_TOKEN: ${{ github.token }} + run: >- + ./mvnw + --settings ${{ github.workspace }}/settings.xml + --batch-mode + release:rollback + -Dusername=${{ github.token }} - - name: Determine release commit SHA + - name: Determine Release Commit SHA id: release-sha run: | echo "value=$(git rev-parse HEAD^)" >> $GITHUB_OUTPUT - container-image: - name: Build, Tag, Push Container Image + - name: Determine Release Tag + id: release-tag + env: + RELEASE_SHA: ${{ steps.release-sha.outputs.value }} + run: | + echo "value=$(git show-ref --tags --dereference | grep -F $RELEASE_SHA | cut -d' ' -f2 | cut -d'^' -f1 | cut -d'/' -f3-)" >> $GITHUB_OUTPUT + + create-github-release: + name: Create GitHub Release from Tag runs-on: ubuntu-latest + + if: ${{ success() && !inputs.dry-run }} + permissions: - packages: write + contents: write needs: - - build-deploy-maven + - maven-build-deploy steps: - - name: Checkout 3scale CMS - uses: actions/checkout@v3 - with: - ref: ${{ needs.build-deploy-maven.outputs.release-sha }} + - name: Checkout Project + uses: actions/checkout@v4 + with: + ref: ${{ needs.maven-build-deploy.outputs.release-tag }} + + - uses: spenserblack/actions-tag-to-release@v3 + with: + tag: ${{ needs.maven-build-deploy.outputs.release-tag }} + tag-as-title: true + draft: true + dry-run: ${{ inputs.dry-run }} + prerelease: auto + prerelease-pattern: v*.*.*-* + + build-container-image: + name: Build, Tag, Push Container Image - - name: Set Up JDK - uses: actions/setup-java@v3 - with: - distribution: temurin - java-version: '17' - cache: maven - settings-path: ${{ github.workspace }} - server-id: github + if: ${{ success() && !inputs.dry-run }} - - name: Calculate lowercase repository owner - id: repo-owner-string - uses: ASzc/change-string-case-action@v5 - with: - string: ${{ github.repository_owner }} + permissions: + contents: read + packages: write - - name: Calculate lowercase repository name - id: repo-name-string - uses: ASzc/change-string-case-action@v5 - with: - string: ${{ github.event.repository.name }} + secrets: inherit - - name: Build and push CLI container image - run: >- - ./mvnw - --settings ${{ github.workspace }}/settings.xml - --batch-mode - verify - --projects cli - --also-make - -Dquarkus.jib.platforms=linux/amd64,linux/arm64 - -Dquarkus.container-image.build=true - -Dquarkus.container-image.push=true - -Dquarkus.container-image.registry=ghcr.io - -Dquarkus.container-image.username=${{ github.actor }} - -Dquarkus.container-image.password=${{ github.token }} - -Dquarkus.container-image.group=${{ steps.repo-owner-string.outputs.lowercase }} - -Dquarkus.container-image.name=${{ steps.repo-name-string.outputs.lowercase }} - -Dquarkus.container-image.additional-tags=latest - -Dquarkus.container-image.labels.name=${{ steps.repo-owner-string.outputs.lowercase }}/${{ steps.repo-name-string.outputs.lowercase }} - -Dquarkus.container-image.labels.url=${{ github.server_url }}/${{ github.repository }}/tree/${{ needs.build-deploy-maven.outputs.release-sha }} - -Dquarkus.container-image.labels.vcs-type=git - -Dquarkus.container-image.labels.vcs-ref=${{ needs.build-deploy-maven.outputs.release-sha }} + needs: + - maven-build-deploy + + uses: ./.github/workflows/build-container-image.yml + with: + git-ref: ${{ needs.maven-build-deploy.outputs.release-tag }} + build-mode: jvm_and_native + tag-as-latest: true diff --git a/.github/workflows/pull-request-tests.yml b/.github/workflows/pull-request-tests.yml index 64a0b47..c48a004 100644 --- a/.github/workflows/pull-request-tests.yml +++ b/.github/workflows/pull-request-tests.yml @@ -11,11 +11,23 @@ on: - unlocked branches: - main + paths-ignore: + - '.github/**' + - '.run/**' + - 'samples/**' + - .editorconfig + - .gitignore + - LICENSE + - README.adoc jobs: - build: + build-and-test: + name: Build and Run Tests runs-on: ubuntu-latest + permissions: + contents: read + steps: - name: Checkout Code uses: actions/checkout@v4 @@ -23,10 +35,25 @@ jobs: - name: Set up Java uses: actions/setup-java@v3 with: + distribution: temurin java-version: '17' - distribution: 'temurin' - - name: Build and Verify + - name: Determine Home Directory + id: find-home run: | - ./mvnw clean verify + echo "home=$HOME" >> $GITHUB_OUTPUT + + - name: Cache Maven Local Repo + uses: actions/cache@v3 + with: + path: ${{ steps.find-home.outputs.home }}/.m2/repository + key: ${{ runner.os }}-${{ runner.arch }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-${{ runner.arch }}-maven- + - name: Run Maven Build and Verify + run: >- + ./mvnw + --batch-mode + clean + verify diff --git a/parent/pom.xml b/parent/pom.xml index 1aa64fe..39e707f 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -55,14 +55,22 @@ + 3.5.0 + 3.3.1 3.11.0 + 3.1.1 3.3.0 3.1.2 + 3.1.1 3.3.0 - 3.1.2 3.0.1 + 3.3.1 + 4.0.0-M9 + 3.1.2 + 3.2.0 + 4.0.2 1.6.10 1.1.0 @@ -146,6 +154,11 @@ dec ${version.brotli-dec} + + org.mapstruct + mapstruct + ${version.mapstruct} + @@ -184,11 +197,6 @@ ${version.hamcrest} test - - org.mapstruct - mapstruct - ${version.mapstruct} - @@ -200,6 +208,11 @@ quarkus-maven-plugin ${version.quarkus} + + com.github.ferstl + depgraph-maven-plugin + ${version.depgraph-maven-plugin} + io.github.floverfelt find-and-replace-maven-plugin @@ -219,6 +232,16 @@ + + org.apache.maven.plugins + maven-artifact-plugin + ${version.maven-artifact-plugin} + + + org.apache.maven.plugins + maven-clean-plugin + ${version.maven-clean-plugin} + org.apache.maven.plugins maven-compiler-plugin @@ -238,6 +261,11 @@ + + org.apache.maven.plugins + maven-deploy-plugin + ${version.maven-deploy-plugin} + org.apache.maven.plugins maven-enforcer-plugin @@ -290,6 +318,11 @@ + + org.apache.maven.plugins + maven-install-plugin + ${version.maven-install-plugin} + org.apache.maven.plugins maven-jar-plugin @@ -303,6 +336,16 @@ v@{project.version} + + org.apache.maven.plugins + maven-resources-plugin + ${version.maven-resources-plugin} + + + org.apache.maven.plugins + maven-site-plugin + ${version.maven-site-plugin} + org.apache.maven.plugins maven-surefire-plugin @@ -324,6 +367,11 @@ + + org.apache.maven.plugins + maven-wrapper-plugin + ${version.maven-wrapper-plugin} + org.jacoco jacoco-maven-plugin