From bb185437b4b17e08696cc611282a27ccf2d09bcd Mon Sep 17 00:00:00 2001 From: Andrei Piankouski Date: Wed, 4 Sep 2024 16:39:35 +0300 Subject: [PATCH] Release 1.0.0 --- .github/workflows/build.yml | 40 +++++++ .github/workflows/promote.yml | 101 ++++++++++++++++++ .github/workflows/release.yml | 45 ++++++++ gradle.properties | 2 +- jars/plugins.json | 2 +- plugin/build.gradle | 14 ++- .../importing/ImportXUnitPluginExtension.java | 2 +- 7 files changed, 199 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/promote.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a508772 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: Build + +on: + pull_request: + push: + branches: + - master + - develop + paths-ignore: + - '.github/**' + - README.md + - gradle.properties + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '11' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup git credentials + uses: oleksiyrudenko/gha-git-credentials@v2 + with: + name: 'reportportal.io' + email: 'support@reportportal.io' + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Build with Gradle + id: build + run: | + ./gradlew build diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml new file mode 100644 index 0000000..0e00468 --- /dev/null +++ b/.github/workflows/promote.yml @@ -0,0 +1,101 @@ +# Copyright 2022 EPAM Systems +# 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: Promote + +on: + workflow_dispatch: + inputs: + version: + description: 'Release version' + required: true + +env: + REPOSITORY_URL: 'https://maven.pkg.github.com' + UPSTREAM_REPOSITORY_URL: 'https://oss.sonatype.org' + PACKAGE_SUFFIXES: '-javadoc.jar,-javadoc.jar.asc,-sources.jar,-sources.jar.asc,.jar,.jar.asc,.pom,.pom.asc' + PACKAGE: 'com.epam.reportportal' + + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Get variables + run: | + echo "ARTIFACT=`echo ${{ github.repository }} | cut -d/ -f2- | awk '{print tolower($0)}'`" >> $GITHUB_ENV + echo "PACKAGE_PATH=`echo ${{ env.PACKAGE }} | sed 's/\./\//g'`" >> $GITHUB_ENV + - name: Upload package + run: | + IFS=',' read -a files <<< '${{ env.PACKAGE_SUFFIXES }}' + for f in ${files[@]}; do + export URL="${{ env.REPOSITORY_URL }}/${{ github.repository }}/${PACKAGE_PATH}/${ARTIFACT}/${{ github.event.inputs.version }}/${ARTIFACT}-${{ github.event.inputs.version }}${f}" + echo "Downloading artifact: ${URL}" + curl -f -u ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }} -s -O -L "${URL}" + done + files=($(ls)) + echo 'Files downloaded:' + echo "${files[@]}" + echo 'Bundle generation' + export BUNDLE_FILE="bundle.jar" + jar -cvf ${BUNDLE_FILE} "${files[@]}" + echo 'Bundle upload' + curl -f -u ${{ secrets.SONATYPE_USER }}:${{ secrets.SONATYPE_PASSWORD }} -L \ + --request POST '${{ env.UPSTREAM_REPOSITORY_URL }}/service/local/staging/bundle_upload' \ + --form "file=@${BUNDLE_FILE}" >response.json + response_type=`jq type response.json || echo ''` + if [ -z "$response_type" ]; then + echo 'ERROR: Response is not JSON!' 1>&2 + cat response.json 1>&2 + exit 1 + fi + repo=`jq -r '.repositoryUris[0]' response.json` + if [ -z "$repo" ]; then + echo 'Unable to upload bundle' 1>&2 + cat response.json 1>&2 + exit 1 + fi + echo "NEXUS_REPOSITORY=${repo}" >> $GITHUB_ENV + - name: Get repository variables + run: | + echo "NEXUS_REPOSITORY_NAME=`echo ${NEXUS_REPOSITORY} | sed -E 's/(.+)\/([^\/]+)$/\2/'`" >> $GITHUB_ENV + - name: Promote package + env: + ATTEMPTS: 60 + SLEEP_TIME: 10 + run: | + verified=false + for i in `seq 0 ${ATTEMPTS}`; do + sleep $SLEEP_TIME + curl -f -s -u ${{ secrets.SONATYPE_USER }}:${{ secrets.SONATYPE_PASSWORD }} -L \ + --header 'Accept: application/json' \ + ${{ env.UPSTREAM_REPOSITORY_URL }}/service/local/staging/repository/${NEXUS_REPOSITORY_NAME} >result.json + is_closed=`jq -r '.type' result.json` + is_transitioning=`jq -r '.transitioning' result.json` + echo "Current repository status: $is_closed; transitioning: $is_transitioning" + if [[ "$is_closed" == "closed" && "$is_transitioning" == "false" ]]; then + verified=true + break + fi + done + if $verified; then + echo "A bundle was verified, releasing" + curl -f -u ${{ secrets.SONATYPE_USER }}:${{ secrets.SONATYPE_PASSWORD }} -L \ + --header 'Content-Type: application/json' \ + --data-raw "{\"data\":{\"stagedRepositoryIds\":[\"${NEXUS_REPOSITORY_NAME}\"], \"description\":\"Releasing ${{ github.event.inputs.version }}\"}}" \ + --request POST ${{ env.UPSTREAM_REPOSITORY_URL }}/service/local/staging/bulk/promote + else + echo 'Verification failed, please check the bundle' 1>&2 + exit 1 + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..519f7fd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release + +on: + push: + branches: + - master + paths-ignore: + - '.github/**' + - README.md + - gradle.properties + +env: + GH_USER_NAME: github.actor + SCRIPTS_VERSION: 5.12.0 + BOM_VERSION: 5.12.1 + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '11' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup git credentials + uses: oleksiyrudenko/gha-git-credentials@v2 + with: + name: 'reportportal.io' + email: 'support@reportportal.io' + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Release with Gradle + id: release + run: | + ./gradlew release -PreleaseMode -Pscripts.version=${{env.SCRIPTS_VERSION}} -Pbom.version=${{env.BOM_VERSION}} \ + -PgithubUserName=${{env.GH_USER_NAME}} -PgithubToken=${{secrets.GITHUB_TOKEN}} \ + -PgpgPassphrase=${{secrets.GPG_PASSPHRASE}} -PgpgPrivateKey="${{secrets.GPG_PRIVATE_KEY}}" diff --git a/gradle.properties b/gradle.properties index 428f4cf..432856e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ version=1.0.0 description=Reinforce you ReportPortal instance with JUnit import functionality and easily upload your log files right to ReportPortal. -pluginId=JUnit +pluginId=junit diff --git a/jars/plugins.json b/jars/plugins.json index 3ca0f65..bccfe24 100644 --- a/jars/plugins.json +++ b/jars/plugins.json @@ -1,6 +1,6 @@ [ { - "id": "JUnit", + "id": "junit", "description": "Reinforce you ReportPortal instance with JUnit import functionality and easily upload your log files right to ReportPortal.", "releases": [ { diff --git a/plugin/build.gradle b/plugin/build.gradle index 3105d71..c0c5ffb 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -35,16 +35,22 @@ repositories { } } +dependencyManagement { + imports { + mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:' + getProperty('bom.version') : 'com.epam.reportportal:commons-bom:5.12.1') + } +} + dependencies { if (releaseMode) { implementation 'com.epam.reportportal:commons-dao' implementation 'com.epam.reportportal:plugin-api' annotationProcessor 'com.epam.reportportal:plugin-api' } else { - implementation 'com.github.reportportal:commons-dao:28d0461' - implementation 'com.github.reportportal:commons:a30c7bb' - implementation 'com.github.reportportal:plugin-api:a9a8b73' - annotationProcessor 'com.github.reportportal:plugin-api:a9a8b73' + implementation 'com.github.reportportal:commons-dao:acf1ec7' + implementation 'com.github.reportportal:commons:c8ef09c' + implementation 'com.github.reportportal:plugin-api:188792e' + annotationProcessor 'com.github.reportportal:plugin-api:188792e' } implementation('org.hibernate:hibernate-core:5.4.18.Final') implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.7' diff --git a/plugin/src/main/java/com/epam/reportportal/extension/importing/ImportXUnitPluginExtension.java b/plugin/src/main/java/com/epam/reportportal/extension/importing/ImportXUnitPluginExtension.java index 26ba4da..4de1fa6 100644 --- a/plugin/src/main/java/com/epam/reportportal/extension/importing/ImportXUnitPluginExtension.java +++ b/plugin/src/main/java/com/epam/reportportal/extension/importing/ImportXUnitPluginExtension.java @@ -43,7 +43,7 @@ @Extension public class ImportXUnitPluginExtension implements ReportPortalExtensionPoint, DisposableBean { - private static final String PLUGIN_ID = "JUnit"; + private static final String PLUGIN_ID = "junit"; public static final String BINARY_DATA_PROPERTIES_FILE_ID = "binary-data.properties"; private static final String DESCRIPTION = "Reinforce you ReportPortal instance with JUnit import functionality and easily upload your log files right to ReportPortal.";