From d4287f7a4aa067ead56285023fa997e85b03036d Mon Sep 17 00:00:00 2001 From: Romain Grecourt Date: Wed, 1 Nov 2023 10:07:06 -0700 Subject: [PATCH] 2.x GitHub Actions release - Add release workflow - Simplify scripts (same as 3.x and main) - Use new copyright tool - Remove 'All right reserved from copyright' - Fix copyright errors --- .github/workflows/release.yml | 76 +++++++ .github/workflows/validate.yml | 84 +++++--- .mvn/jvm.config | 0 Jenkinsfile | 64 ------ README.md | 2 +- build-cache-maven-plugin/pom.xml | 2 +- dev-loop/pom.xml | 2 +- .../src/main/resources/application.yaml | 2 +- .../src/main/resources/logging.properties | 2 +- enforcer-maven-plugin/pom.xml | 2 +- .../enforcer/copyright/TemplateLineTest.java | 6 +- etc/copyright-exclude.txt | 21 +- etc/copyright.txt | 28 ++- etc/scripts/build-cli.bat | 42 ---- etc/scripts/build-cli.sh | 63 ------ etc/scripts/build.bat | 26 --- etc/scripts/build.sh | 45 ---- etc/scripts/checkstyle.sh | 29 +-- etc/scripts/copyright.sh | 37 ++-- etc/scripts/pipeline-env.bat | 49 ----- etc/scripts/pipeline-env.sh | 56 ----- etc/scripts/release.sh | 197 ++++++++++-------- etc/scripts/spotbugs.sh | 46 ---- helidon-archetype/engine/pom.xml | 2 +- .../build/archetype/engine/catalog.xml | 2 +- .../archetype/engine/helidon-archetype.xml | 2 +- helidon-archetype/maven-plugin/pom.xml | 2 +- .../META-INF/helidon-archetype.xml.mustache | 2 +- .../it/projects/test1/catalog2/catalog.xml | 4 +- .../archetype/maven/helidon-archetype.xml | 2 +- helidon-archetype/pom.xml | 2 +- helidon-cli-maven-plugin/pom.xml | 2 +- helidon-cli/codegen/pom.xml | 2 +- helidon-cli/harness/pom.xml | 2 +- helidon-cli/impl/pom.xml | 2 +- helidon-cli/plugin/pom.xml | 2 +- helidon-cli/pom.xml | 2 +- helidon-linker/pom.xml | 2 +- helidon-maven-plugin/pom.xml | 2 +- licensing/pom.xml | 2 +- pom.xml | 61 ++---- services-maven-plugin/pom.xml | 2 +- sitegen-maven-plugin/pom.xml | 2 +- .../sitegen/maven/DoxiaSiteRenderer.java | 2 +- .../vuetify/libs/superagent.js | 2 +- .../vuetify/libs/vuex-router-sync.js | 2 +- .../basic/block_admonition.ftl | 2 +- .../basic/block_dlist.ftl | 2 +- .../basic/block_example.ftl | 2 +- .../basic/block_image.ftl | 2 +- .../basic/block_listing.ftl | 2 +- .../basic/block_literal.ftl | 2 +- .../basic/block_open.ftl | 2 +- .../basic/block_paragraph.ftl | 2 +- .../basic/block_preamble.ftl | 2 +- .../basic/block_section.ftl | 2 +- .../basic/block_table.ftl | 2 +- .../basic/document.ftl | 2 +- .../basic/inline_break.ftl | 2 +- .../basic/inline_quoted.ftl | 2 +- .../vuetify/block_admonition.ftl | 2 +- .../vuetify/block_card.ftl | 2 +- .../vuetify/block_colist.ftl | 2 +- .../vuetify/block_example.ftl | 2 +- .../vuetify/block_image.ftl | 2 +- .../vuetify/block_listing.ftl | 2 +- .../vuetify/block_literal.ftl | 2 +- .../vuetify/block_olist.ftl | 2 +- .../vuetify/block_open.ftl | 2 +- .../vuetify/block_paragraph.ftl | 2 +- .../vuetify/block_pass.ftl | 2 +- .../vuetify/block_pillars.ftl | 2 +- .../vuetify/block_preamble.ftl | 2 +- .../vuetify/block_section.ftl | 2 +- .../vuetify/block_table.ftl | 2 +- .../vuetify/block_thematic_break.ftl | 2 +- .../vuetify/block_ulist.ftl | 2 +- .../vuetify/common.ftl | 2 +- .../vuetify/config.ftl | 2 +- .../vuetify/custom_bindings.ftl | 2 +- .../vuetify/document.ftl | 2 +- .../vuetify/index.ftl | 2 +- .../vuetify/inline_anchor.ftl | 2 +- .../vuetify/inline_break.ftl | 2 +- .../vuetify/inline_callout.ftl | 2 +- .../vuetify/inline_image.ftl | 2 +- .../vuetify/inline_kbd.ftl | 2 +- .../vuetify/inline_quoted.ftl | 2 +- .../vuetify/search_index.ftl | 2 +- .../test/resources/test-maven-site/pom.xml | 2 +- .../test/resources/testbasic1/_expected.ftl | 2 +- .../test/resources/testbasic2/_expected.ftl | 2 +- .../test/resources/testbasic3/_expected.ftl | 2 +- .../test/resources/testvuetify1/sitegen.yaml | 2 +- snakeyaml-codegen-maven-plugin/pom.xml | 2 +- stager-maven-plugin/pom.xml | 2 +- .../src/redirect.html.mustache | 2 +- utils/pom.xml | 2 +- 98 files changed, 412 insertions(+), 680 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .mvn/jvm.config delete mode 100644 Jenkinsfile delete mode 100644 etc/scripts/build-cli.bat delete mode 100755 etc/scripts/build-cli.sh delete mode 100644 etc/scripts/build.bat delete mode 100755 etc/scripts/build.sh delete mode 100644 etc/scripts/pipeline-env.bat delete mode 100644 etc/scripts/pipeline-env.sh delete mode 100755 etc/scripts/spotbugs.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..24580668f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,76 @@ +# +# Copyright (c) 2023 Oracle and/or its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "Release" + +on: + push: + branches: + - 'release-*' + +env: + JAVA_VERSION: '11' + JAVA_DISTRO: 'temurin' + MAVEN_ARGS: | + -B -e + -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 + -Dmaven.wagon.http.retryHandler.count=3 + -Djdk.toolchain.version=${JAVA_VERSION} + +concurrency: + group: release-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + create-tag: + runs-on: ubuntu-20.04 + environment: release + outputs: + tag: ${{ steps.create-tag.outputs.tag }} + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.SERVICE_ACCOUNT_TOKEN }} + - name: Set up JDK + uses: actions/setup-java@v3.11.0 + with: + distribution: ${{ env.JAVA_DISTRO }} + java-version: ${{ env.JAVA_VERSION }} + - id: create-tag + run: ./etc/scripts/release.sh create_tag >> "${GITHUB_OUTPUT}" + validate: + needs: create-tag + uses: ./.github/workflows/validate.yml + with: + ref: ${{ needs.create-tag.outputs.tag }} + release: + needs: [ create-tag, validate ] + runs-on: ubuntu-20.04 + timeout-minutes: 30 + environment: release + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ needs.create-tag.outputs.tag }} + - uses: actions/setup-java@v3.6.0 + with: + distribution: ${{ env.JAVA_DISTRO }} + java-version: ${{ env.JAVA_VERSION }} + cache: maven + - env: + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + MAVEN_SETTINGS: ${{ secrets.MAVEN_SETTINGS }} + run: etc/scripts/release.sh release_build diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ee7f24a2e..0d29c5da5 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,14 +1,41 @@ -name: "Validate PR" +# +# Copyright (c) 2023 Oracle and/or its affiliates. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. -on: [pull_request, push, workflow_dispatch] +name: "Validate" + +on: + pull_request: + push: + workflow_call: + inputs: + ref: + description: The branch, tag or SHA to checkout + required: false + type: string + default: '' env: JAVA_VERSION: '11' JAVA_DISTRO: 'temurin' GRAALVM_VERSION: '20.2.0' GRAALVM_COMPONENTS: 'native-image' - HELIDON_PIPELINES: 'true' - MAVEN_HTTP_ARGS: '-Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -Dmaven.wagon.http.retryHandler.count=3' + MAVEN_ARGS: | + -B -fae -e + -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 + -Dmaven.wagon.http.retryHandler.count=3 + -Djdk.toolchain.version=${JAVA_VERSION} concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -21,72 +48,75 @@ jobs: steps: - uses: actions/checkout@v3 with: + ref: ${{ inputs.ref }} fetch-depth: 0 - - name: Set up JDK 11 - uses: actions/setup-java@v3.6.0 + - uses: actions/setup-java@v3.6.0 with: distribution: ${{ env.JAVA_DISTRO }} java-version: ${{ env.JAVA_VERSION }} cache: maven - - name: Copyright - run: etc/scripts/copyright.sh + - run: etc/scripts/copyright.sh checkstyle: timeout-minutes: 10 runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3.6.0 + with: + ref: ${{ inputs.ref }} + - uses: actions/setup-java@v3.6.0 with: distribution: ${{ env.JAVA_DISTRO }} java-version: ${{ env.JAVA_VERSION }} cache: maven - - name: Checkstyle - run: etc/scripts/checkstyle.sh + - run: etc/scripts/checkstyle.sh spotbugs: timeout-minutes: 30 runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3.6.0 + with: + ref: ${{ inputs.ref }} + - uses: actions/setup-java@v3.6.0 with: distribution: ${{ env.JAVA_DISTRO }} java-version: ${{ env.JAVA_VERSION }} cache: maven - - name: Spotbugs - run: etc/scripts/spotbugs.sh + - run: | + mvn ${MAVEN_ARGS} -T 8 \ + verify \ + -DskipTests \ + --fail-at-end \ + -Pspotbugs build: timeout-minutes: 60 strategy: matrix: os: [ ubuntu-20.04,windows-2019 ] - include: - - os: ubuntu-20.04 - build_script: etc/scripts/build.sh - - os: windows-2019 - build_script: etc/scripts/build.bat runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - name: Set up Java 11 + with: + ref: ${{ inputs.ref }} + - uses: actions/setup-java@v3.6.0 if: matrix.os == 'ubuntu-20.04' - uses: actions/setup-java@v3.6.0 with: distribution: ${{ env.JAVA_DISTRO }} java-version: ${{ env.JAVA_VERSION }} cache: maven - - name: Set up Java 11 + - uses: graalvm/setup-graalvm@v1 if: matrix.os == 'windows-2019' - uses: graalvm/setup-graalvm@v1 with: version: ${{ env.GRAALVM_VERSION }} java-version: ${{ env.JAVA_VERSION }} components: ${{ env.GRAALVM_COMPONENTS }} github-token: ${{ secrets.GITHUB_TOKEN }} cache: maven - - name: Maven build - run: ${{ matrix.build_script }} + - run: | + mvn ${MAVEN_ARGS} -T 8 \ + clean install \ + --fail-at-end \ + -Dmaven.test.failure.ignore=true + shell: bash - name: Archive test results uses: actions/upload-artifact@v3.1.2 with: diff --git a/.mvn/jvm.config b/.mvn/jvm.config new file mode 100644 index 000000000..e69de29bb diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index d26ae9733..000000000 --- a/Jenkinsfile +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2020, 2022 Oracle and/or its affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -pipeline { - agent { - label "linux" - } - options { - parallelsAlwaysFailFast() - } - stages { - stage('release') { - when { - branch '**/release-*' - } - stages { - stage('build') { - environment { - GITHUB_SSH_KEY = credentials('helidonrobot-github-ssh-private-key') - MAVEN_SETTINGS_FILE = credentials('helidonrobot-maven-settings-ossrh') - GPG_PUBLIC_KEY = credentials('helidon-gpg-public-key') - GPG_PRIVATE_KEY = credentials('helidon-gpg-private-key') - GPG_PASSPHRASE = credentials('helidon-gpg-passphrase') - } - steps { - sh './etc/scripts/release.sh release_build' - } - } - stage('cli-native') { - parallel { - stage('cli-linux') { - steps { - sh './etc/scripts/build-cli.sh --release' - archiveArtifacts artifacts: "helidon-cli/impl/target/helidon" - } - } - stage('cli-windows') { - agent { - label "windows" - } - steps { - bat './etc/scripts/build-cli.bat /release' - archiveArtifacts artifacts: "helidon-cli/impl/target/helidon.exe" - } - } - } - } - } - } - } -} diff --git a/README.md b/README.md index f211065e6..0a8471fd9 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The Helidon Build Tools version is aligned with the Helidon `major.minor` versio ## Build -You will need Java 11 and Maven 3.6.3 or newer. +You will need Java 11 and Maven 3.8.2 or newer. **Full build** ```bash diff --git a/build-cache-maven-plugin/pom.xml b/build-cache-maven-plugin/pom.xml index a2ab2adfb..b52cc2bc5 100644 --- a/build-cache-maven-plugin/pom.xml +++ b/build-cache-maven-plugin/pom.xml @@ -1,7 +1,7 @@ - ${top.parent.basedir} + ${maven.multiModuleProjectDirectory} META-INF/ LICENSE.txt @@ -875,9 +859,10 @@ validate - ${top.parent.basedir}/etc/checkstyle.xml + ${maven.multiModuleProjectDirectory}/etc/checkstyle.xml - ${top.parent.basedir}/etc/checkstyle-suppressions.xml + + ${maven.multiModuleProjectDirectory}/etc/checkstyle-suppressions.xml @@ -891,34 +876,28 @@ - org.glassfish.copyright - glassfish-copyright-maven-plugin + io.helidon.build-tools + helidon-enforcer-plugin + 2.3.7 + + + copyright + + + true + + ${maven.multiModuleProjectDirectory}/etc/copyright.txt + + ${maven.multiModuleProjectDirectory}/etc/copyright-exclude.txt + + - print-copyright - - copyright - + helidon-enforcer validate - - - ${top.parent.basedir}/etc/copyright.txt - - ${top.parent.basedir}/etc/copyright-exclude.txt - - - - check-copyright check - validate - - - ${top.parent.basedir}/etc/copyright.txt - - ${top.parent.basedir}/etc/copyright-exclude.txt - diff --git a/services-maven-plugin/pom.xml b/services-maven-plugin/pom.xml index f7870b41c..22a379fc9 100644 --- a/services-maven-plugin/pom.xml +++ b/services-maven-plugin/pom.xml @@ -1,7 +1,7 @@ diff --git a/utils/pom.xml b/utils/pom.xml index 1d72ca501..311a41473 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -1,7 +1,7 @@