From 7d028bce4e0c752faeb9de101a1b0731f97ba3b6 Mon Sep 17 00:00:00 2001 From: Jonathan Austin Date: Wed, 16 Feb 2022 20:08:09 +1000 Subject: [PATCH] Switch from travis-ci to Github Actions. Closes #46 --- .github/workflows/github-actions-build.yml | 40 ++++++++++++++++++++++ .travis.yml | 27 --------------- CHANGELOG.md | 1 + README.md | 2 +- pom.xml | 4 +-- 5 files changed, 44 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/github-actions-build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/github-actions-build.yml b/.github/workflows/github-actions-build.yml new file mode 100644 index 0000000..ab581c6 --- /dev/null +++ b/.github/workflows/github-actions-build.yml @@ -0,0 +1,40 @@ +name: Java CI + +# Trigger workflow on push or pull_request +# Note - the first pull_request from a forked repo will need to be given approval to run +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + + - name: Cache Maven Repo + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + + - name: Build Test and Verify + run: mvn -B -U clean install -Dmaven.javadoc.skip=true -Pdisplay-versions + + - name: SonarCloud Scan + run: | + if ["$SONAR_TOKEN" == ""]; then + echo "Sonar secure variables NOT available" + else + echo "Sonar secure variables ARE available" + mvn -B sonar:sonar -Dsonar.projectKey="bordertech-java-config" -Dsonar.organization="bordertech-github" -Dsonar.host.url="https://sonarcloud.io" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f4d729a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -dist: trusty - -cache: - directories: - - $HOME/.m2 - -addons: - sonarcloud: - organization: "bordertech-github" - token: $SONAR_TOKEN - -before_install: -- echo "MAVEN_OPTS='-Xmx512m -XX:MaxPermSize=128m'" > ~/.mavenrc -- mvn clean -- wget https://github.com/codacy/codacy-coverage-reporter/releases/download/4.0.5/codacy-coverage-reporter-4.0.5-assembly.jar - -language: Java -jdk: - - oraclejdk8 - -## Travis installs the project with the following maven command:- "mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V" -script: - - mvn package sonar:sonar -Dsonar.projectKey="bordertech-java-config" - -## Send Coverage to Codacy -after_success: - - java -jar codacy-coverage-reporter-4.0.5-assembly.jar report -l Java -r target/site/jacoco/jacoco.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e164c7..c170188 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Change log ## Release in-progress +* Switch from travis-ci to GitHub Actions #46 ## 1.0.7 diff --git a/README.md b/README.md index cdd5df4..33a7d95 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Config ## Status -[![Build Status](https://travis-ci.com/BorderTech/java-config.svg?branch=master)](https://travis-ci.com/BorderTech/java-config) +[![Build Status](https://github.com/BorderTech/java-config/actions/workflows/github-actions-build.yml/badge.svg)](https://github.com/BorderTech/java-config/actions/workflows/github-actions-build.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bordertech-java-config&metric=alert_status)](https://sonarcloud.io/dashboard?id=bordertech-java-config) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=bordertech-java-config&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=bordertech-java-config) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=bordertech-java-config&metric=coverage)](https://sonarcloud.io/dashboard?id=bordertech-java-config) diff --git a/pom.xml b/pom.xml index 76f88f2..6c2ab0b 100644 --- a/pom.xml +++ b/pom.xml @@ -39,8 +39,8 @@ - Travis CI - https://travis-ci.com/BorderTech/java-config + Github Actions + https://github.com/BorderTech/java-config/actions