diff --git a/.github/workflows/coveralls.yaml b/.github/workflows/coveralls.yaml new file mode 100644 index 00000000..74e71fa5 --- /dev/null +++ b/.github/workflows/coveralls.yaml @@ -0,0 +1,41 @@ +# +# Copyright 2016-2020 the original author or authors. +# +# 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: Coveralls + +on: [push, pull_request] + +jobs: + build: + if: github.repository_owner == 'mybatis' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 8 + - name: Report Coverage to Coveralls for Pull Requests + if: github.event_name == 'pull_request' + run: ./mvnw test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.number }} + - name: Report Coverage to Coveralls for General Push + if: github.event_name == 'push' + run: ./mvnw test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/sonar.yaml b/.github/workflows/sonar.yaml index 99541290..89c8e4bb 100644 --- a/.github/workflows/sonar.yaml +++ b/.github/workflows/sonar.yaml @@ -35,7 +35,7 @@ jobs: with: java-version: 11 - name: Analyze with SonarCloud - run: ./mvnw verify sonar:sonar -B -Dsonar.projectKey=mybatis_guice -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dlicense.skip=true + run: ./mvnw verify jacoco:report sonar:sonar -B -Dsonar.projectKey=mybatis_guice -Dsonar.organization=mybatis -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dlicense.skip=true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3e7a9a78..00000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: java - -jdk: - - openjdk8 - -after_success: - - chmod -R 777 ./travis/after_success.sh - - ./travis/after_success.sh - -env: - global: - - secure: "L1+69YIDaA4IIsDDxoyjkbQ1Ohhl2wmK6ukrrNiK01tQN3SSxcLo+L31iQFa\npQXrYbB19VcWoqZjAvNS/23ShHOOQ6s4Me2GbpyBh0G1s3muraVp/v4wuOVH\nFZNWVNOQZn4Wuc7D6YslfphkIJzykzSXsLjaAOmu1D1Vmsb/EdY=" - - secure: "XYbj7+l/tI4uHarin7sBTWtOvMq79IE1/ta3Nt9Immh6/6TiYrsFLuxI/l9+\ndGC+YzGuKIjMz/KICiGQShQP76WiLvruJsWZXLqPTj1ma82jMEBFE3VEtHRt\nBWY4q/LF+TrdtZbDmUEp2XEvf0gK4mhWm5c7drkj0B27RxkpHyk=" diff --git a/travis/after_success.sh b/travis/after_success.sh deleted file mode 100644 index b0566903..00000000 --- a/travis/after_success.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# -# Copyright 2009-2020 the original author or authors. -# -# 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. -# - - -# Get Commit Message -commit_message=$(git log --format=%B -n 1) -echo "Current commit detected: ${commit_message}" - -# We build for several JDKs on Travis. -# Some actions, like analyzing the code (Coveralls) and uploading -# artifacts on a Maven repository, should only be made for one version. - -# If the version is 1.8, then perform the following actions. -# 1. Notify Coveralls. -# 2. Deploy site (disabled as solution not complete). - -# Parameters -# 1. Use -q option to only display Maven errors and warnings. -# 2. Use --settings to force the usage of our "settings.xml" file. - -if [ $TRAVIS_REPO_SLUG == "mybatis/guice" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ] && [[ "$commit_message" != *"[maven-release-plugin]"* ]]; then - - if [ $TRAVIS_JDK_VERSION == "oraclejdk8" ]; then - - # Deploy to coveralls - ./mvnw clean test jacoco:report coveralls:report -q --settings ./mvn/settings.xml - echo -e "Successfully ran coveralls under Travis job ${TRAVIS_JOB_NUMBER}" - - # Deploy to site - # Cannot currently run site this way - # ./mvnw site site:deploy -q --settings ./mvn/settings.xml - # echo -e "Successfully deploy site under Travis job ${TRAVIS_JOB_NUMBER}" - else - echo "Java Version does not support additonal activity for travis CI" - fi -else - echo "Travis Pull Request: $TRAVIS_PULL_REQUEST" - echo "Travis Branch: $TRAVIS_BRANCH" - echo "Travis build skipped" -fi