From a65f427767ace60b0991324907f5a88a8b7c0b72 Mon Sep 17 00:00:00 2001 From: Maxim Grischenko Date: Mon, 29 Jan 2024 19:06:11 +0100 Subject: [PATCH] release workflow --- .github/workflows/pull-request.yml | 44 ++++++++++++++++++++++++ .github/workflows/pull-requests.yml | 22 ------------ .github/workflows/push-develop.yml | 53 +++++++++++++++++++++++++++++ .github/workflows/release.yml | 37 ++++++++++++++++++++ .travis/codecov_bash.sh | 11 ------ .travis/deploy.sh | 8 ----- pom.xml | 24 ++++--------- scripts/mvn_deploy.sh | 8 +++++ {.travis => scripts}/settings.xml | 0 9 files changed, 148 insertions(+), 59 deletions(-) create mode 100644 .github/workflows/pull-request.yml delete mode 100644 .github/workflows/pull-requests.yml create mode 100644 .github/workflows/push-develop.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis/codecov_bash.sh delete mode 100644 .travis/deploy.sh create mode 100755 scripts/mvn_deploy.sh rename {.travis => scripts}/settings.xml (100%) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 000000000..988ae1ee7 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,44 @@ +name: Actions on pull requests +on: + pull_request: + branches: + - develop + - master + +jobs: + pull-request-job: + runs-on: ubuntu-latest + steps: + - name: Step 1 - Checkout repository code + uses: actions/checkout@v4 + + - name: Step 2 - Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: 'maven' + + - name: Step 3 - Cache Docker images. + uses: ScribeMD/docker-cache@0.3.7 + with: + key: docker-${{ runner.os }} + + - name: Step 4 - Build & Test + run: mvn clean verify -ntp + + - name: Step 5 - Upload coverage unittests reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + gcov_ignore: '!*datasafe-business*' + flags: unittests + verbose: true + + - name: Step 6 - Upload coverage e2e tests reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + gcov_include: '*datasafe-business*' + flags: e2e_tests + verbose: true \ No newline at end of file diff --git a/.github/workflows/pull-requests.yml b/.github/workflows/pull-requests.yml deleted file mode 100644 index 0891234c0..000000000 --- a/.github/workflows/pull-requests.yml +++ /dev/null @@ -1,22 +0,0 @@ -# Builds Pull-requests to key branches -name: Pull request CI - -on: - pull_request: - branches: - - develop - - master - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: 17 - distribution: 'adopt' - - - name: Build project and run default test suite - run: mvn clean verify -ntp diff --git a/.github/workflows/push-develop.yml b/.github/workflows/push-develop.yml new file mode 100644 index 000000000..14dc23fc3 --- /dev/null +++ b/.github/workflows/push-develop.yml @@ -0,0 +1,53 @@ +name: Develop branch build +on: + push: + branches: + - develop + +jobs: + develop-build-job: + runs-on: ubuntu-latest + steps: + - name: Step 1 - Checkout repository code + uses: actions/checkout@v4 + + - name: Step 2 - Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: 'maven' + + - name: Step 3 - Cache Docker images. + uses: ScribeMD/docker-cache@0.3.7 + with: + key: docker-${{ runner.os }} + + - name: Step 4 - Build & Test + run: mvn clean verify -ntp + + - name: Step 5 - Deploy Snapshot + run: ./scripts/mvn_deploy.sh + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + GPG_EXECUTABLE: gpg + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} + GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }} + + - name: Step 6 - Upload coverage unittests reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + gcov_ignore: '!*datasafe-business*' + flags: unittests + verbose: true + + - name: Step 7 - Upload coverage e2e tests reports to Codecov + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + gcov_include: '*datasafe-business*' + flags: e2e_tests + verbose: true \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..2ecc29728 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Release to Maven Central +on: + push: + tags: + - v* + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Step 1 - Checkout repository code + uses: actions/checkout@v4 + + - name: Step 2 - Setup JDK + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: 'maven' + + - name: Step 3 - Cache Docker images. + uses: ScribeMD/docker-cache@0.3.7 + with: + key: docker-${{ runner.os }} + + - name: Step 4 - Maven deploy release + run: ./scripts/mvn_deploy.sh + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + GPG_EXECUTABLE: gpg + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} + GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }} + +# - name: Step 4 - Push JavaDoc to GitHub Pages +# run: ./scripts/push-javadoc-to-gh-pages.sh diff --git a/.travis/codecov_bash.sh b/.travis/codecov_bash.sh deleted file mode 100644 index a11db3d6a..000000000 --- a/.travis/codecov_bash.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -BRANCH="$TRAVIS_BRANCH" -if [[ -n "$TRAVIS_PULL_REQUEST_BRANCH" ]]; then - BRANCH="$TRAVIS_PULL_REQUEST_BRANCH" - echo "Pull request branch identified: $TRAVIS_PULL_REQUEST_BRANCH" -fi - -echo "Sending test results to codecov using $BRANCH" -bash <(curl -s https://codecov.io/bash) -f '!*datasafe-business*' -F unittests -B "$BRANCH"; -bash <(curl -s https://codecov.io/bash) -s '*datasafe-business*' -F e2e_tests -B "$BRANCH"; \ No newline at end of file diff --git a/.travis/deploy.sh b/.travis/deploy.sh deleted file mode 100644 index 3f1052e59..000000000 --- a/.travis/deploy.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -echo "$GPG_SECRET_KEY" | base64 --decode | "$GPG_EXECUTABLE" --import -echo "$GPG_OWNERTRUST" | base64 --decode | "$GPG_EXECUTABLE" --import-ownertrust - -set -e - -mvn --settings .travis/settings.xml package gpg:sign deploy -Prelease -DskipTests -B -U; diff --git a/pom.xml b/pom.xml index 0eeb0d03d..34c85459e 100644 --- a/pom.xml +++ b/pom.xml @@ -74,15 +74,14 @@ src/main/java src/test/java - - ${basedir}/../../target/jacoco.exec - ${basedir}/../target/jacoco-e2e.exec + ${maven.multiModuleProjectDirectory}/target/jacoco.exec + ${maven.multiModuleProjectDirectory}/target/jacoco-e2e.exec 19.2.0 3.11.0 17 17 - 3.6.0 + 3.6.1 1.18.30 2.8.9 2.46.1 @@ -96,7 +95,7 @@ UTF-8 false 1.18.3 - 0.8.10 + 0.8.11 2.5 2.0.7 9.44.0.Final @@ -387,6 +386,7 @@ + org.apache.maven.plugins maven-dependency-plugin ${maven.dependency.plugin.version} @@ -519,6 +519,7 @@ org.apache.maven.plugins maven-compiler-plugin + ${maven.compiler.plugin.version} @@ -586,8 +587,6 @@ sonatype https://oss.sonatype.org/ true - true - 30 @@ -608,11 +607,6 @@ maven-gpg-plugin ${maven-gpg-plugin.version} - opensource@adorsys.de - - --pinentry-mode - loopback - @@ -621,12 +615,6 @@ sign - - - --pinentry-mode - loopback - - diff --git a/scripts/mvn_deploy.sh b/scripts/mvn_deploy.sh new file mode 100755 index 000000000..dbf870f1f --- /dev/null +++ b/scripts/mvn_deploy.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +echo "$GPG_SECRET_KEY" | base64 --decode | $GPG_EXECUTABLE --import --no-tty --batch --yes || true +echo "$GPG_OWNERTRUST" | base64 --decode | $GPG_EXECUTABLE --import-ownertrust --no-tty --batch --yes || true + +mvn clean deploy -ntp --settings scripts/settings.xml gpg:sign -Prelease -DskipTests -U || exit 1 \ No newline at end of file diff --git a/.travis/settings.xml b/scripts/settings.xml similarity index 100% rename from .travis/settings.xml rename to scripts/settings.xml