Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Migrate to GitHub Actions for unit tests and set up code coverage (#396)
Browse files Browse the repository at this point in the history
* Set up GitHub Actions unit tests and code coverage
* fetch-depth: 2
* Specify JaCoCo version
  • Loading branch information
chanseokoh committed Feb 9, 2021
1 parent 6f14e54 commit 093c818
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 39 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Unit Tests
on:
push:
branches:
- master
pull_request:
workflow_dispatch:

jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [8, 11]
env:
CLOUDSDK_CORE_DISABLE_USAGE_REPORTING: true
CLOUDSDK_CORE_DISABLE_PROMPTS: true
# for Gradle
TERM: dumb
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- uses: actions/cache@v2
with:
path: |
~/.m2/repository
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run tests
run: |
./gradlew clean build jacocoTestReport --stacktrace
- name: Test Coverage
uses: codecov/codecov-action@v1
with:
name: actions ${{matrix.java}}
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

16 changes: 15 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ plugins {
id 'net.researchgate.release' version '2.6.0'
id 'com.github.sherter.google-java-format' version '0.8'
id 'checkstyle'
id 'jacoco'
}

repositories {
Expand Down Expand Up @@ -164,11 +165,24 @@ check.dependsOn verifyGoogleJavaFormat
// to auto-format run ./gradlew googleJavaFormat

checkstyle {
toolVersion = "8.18"
toolVersion = '8.18'
// get the google_checks.xml file from the actual tool we're invoking
config = resources.text.fromArchiveEntry(configurations.checkstyle[0], 'google_checks.xml')
maxErrors = 0
maxWarnings = 0
checkstyleTest.enabled = false
}
/* FORMATTING */

/* TEST COVERAGE */
jacoco {
toolVersion = '0.8.6'
}

jacocoTestReport {
reports {
xml.enabled true
html.enabled false
}
}
/* TEST COVERAGE */

0 comments on commit 093c818

Please sign in to comment.