From 508f37120b043fbb7929a45b9a10847835275532 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Wed, 1 Apr 2020 16:53:56 +0200 Subject: [PATCH 1/4] Add GHA workflows for build and deploy --- .github/workflows/build.yml | 43 ++++++++++++++++++++++++++++++ .github/workflows/deploy.yml | 51 ++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..b0671426 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,43 @@ +on: [push, pull_request] + +env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Check out repo + uses: actions/checkout@v2 + + # fetch unshallow to enable blame for Sonar + - name: Fetch unshallow + run: git fetch --prune --unshallow + + - name: Set up JDK 8 + uses: actions/setup-java@v1 + with: + java-version: 8 + + - name: Cache Maven + uses: actions/cache@v1 + with: + path: ~/.m2/repository/ + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: Cache Sonar + uses: actions/cache@v1 + with: + path: ~/.sonar/cache/ + key: ${{ runner.os }}-sonar + + - name: Build with Maven + run: > + mvn --batch-mode verify sonar:sonar -Pcoverage + -Dsonar.host.url=https://sonarcloud.io + -Dsonar.organization=retest + -Dsonar.projectKey=de.retest:recheck.cli diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..b821e2ab --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,51 @@ +on: + push: + tags: v* + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Check out repo + uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v1 + with: + java-version: 8 + + - name: Cache Maven + uses: actions/cache@v1 + with: + path: ~/.m2/repository/ + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-maven- + + - name: Package with Maven + id: maven_package + run: | + mvn --batch-mode package -DskipTests + cd ./target/ + echo "::set-output name=zip_name::$(echo recheck.cli-*-bin.zip)" + + - name: Create release + id: create_release + uses: actions/create-release@v1 + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: true + + - name: Upload release asset + id: upload_release_asset + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./target/${{ steps.maven_package.outputs.zip_name }} + asset_name: ${{ steps.maven_package.outputs.zip_name }} + asset_content_type: application/zip From c9ffb851bad2afbb2c6c16e119702ed5e5772ed4 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Wed, 1 Apr 2020 16:54:13 +0200 Subject: [PATCH 2/4] Remove obsolete Travis CI stuff --- .travis.settings.xml | 9 --------- .travis.yml | 32 -------------------------------- ci/script.sh | 12 ------------ 3 files changed, 53 deletions(-) delete mode 100644 .travis.settings.xml delete mode 100644 .travis.yml delete mode 100755 ci/script.sh diff --git a/.travis.settings.xml b/.travis.settings.xml deleted file mode 100644 index 8468c1c6..00000000 --- a/.travis.settings.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - ossrh - ${env.OSSRH_USERNAME} - ${env.OSSRH_PASSWORD} - - - diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 688c5d6f..00000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: java -dist: trusty - -git: - depth: false - -addons: - sonarcloud: - organization: retest - token: "${SONAR_CLOUD_TOKEN}" - -notifications: - email: false - -cache: - directories: - - "${HOME}/.sonar/cache/" - - "${HOME}/.m2/" - -install: true - -script: ci/script.sh - -deploy: - - provider: releases - api_key: "${GH_TOKEN}" - file_glob: true - file: "./target/recheck.cli-*-bin.zip" - skip_cleanup: true - draft: true - on: - tags: true diff --git a/ci/script.sh b/ci/script.sh deleted file mode 100755 index 44ee944e..00000000 --- a/ci/script.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -o nounset -set -o errexit -set -o pipefail - -###### Maven ###### -if [ ${TRAVIS_SECURE_ENV_VARS} = "true" ]; then - ${MVN} clean verify sonar:sonar -Pcoverage -else - ${MVN} clean verify -fi From 46e3b536952594ba4e78d5520f98bb14636681c9 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Wed, 1 Apr 2020 16:54:25 +0200 Subject: [PATCH 3/4] Update badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 46123af4..2aece4df 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # .cli -[![Build Status](https://travis-ci.com/retest/recheck.cli.svg?branch=master)](https://travis-ci.com/retest/recheck.cli) +![.github/workflows/build.yml](https://github.com/retest/recheck.cli/workflows/.github/workflows/build.yml/badge.svg) [![license](https://img.shields.io/badge/license-AGPL-brightgreen.svg)](https://github.com/retest/recheck.cli/blob/master/LICENSE) [![PRs welcome](https://img.shields.io/badge/PRs-welcome-ff69b4.svg)](https://github.com/retest/recheck.cli/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) [![code with hearth by retest](https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-retest-C1D82F.svg)](https://retest.de/) From 8d1810dd3529a79dc15c7b4d41f58e9410163816 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Wed, 1 Apr 2020 16:54:34 +0200 Subject: [PATCH 4/4] Update PR template --- .github/pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b9bd6d39..7ed3eefe 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,7 +2,7 @@ - [ ] the code follows the [Clean Code](https://clean-code-developer.com/) guidelines. - [ ] the necessary tests are either created or updated. -- [ ] all status checks (Travis CI, SonarCloud, etc.) pass. +- [ ] all status checks (GitHub Actions, SonarCloud, etc.) pass. - [ ] your commit history is cleaned up. - [ ] you updated the changelog. - [ ] you updated necessary documentation within [retest/docs](https://github.com/retest/docs).