Actions tests

pull/694/head
Mattia Iavarone 6 years ago
parent 129b43e657
commit 02d2c2fdba
  1. 17
      .github/codecov.yml
  2. 72
      .github/workflows/build.yml
  3. 15
      .github/workflows/deploy.yml
  4. 10
      cameraview/build.gradle

@ -0,0 +1,17 @@
coverage:
precision: 1
round: down
range: "30...70"
status:
project:
default:
target: 40%
patch:
default:
target: 70%
changes: no
comment:
# diff, changes, footer, reach, flags, suggestions
layout: "header, files"

@ -0,0 +1,72 @@
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
name: Android Build
on: [push, pull_request]
env:
- ANDROID_UNIT_TESTS_PATH: ./cameraview/build/jacoco/
- ANDROID_EMULATOR_TESTS_PATH: ./cameraview/build/outputs/code_coverage/debugAndroidTest/connected
jobs:
ANDROID_BASE_CHECKS:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with: fetch-depth: 1
- uses: actions/setup-java@v1
with: java-version: 1.8
- run: ./gradlew demo:assembleDebug cameraview:javadoc
ANDROID_UNIT_TESTS:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with: fetch-depth: 1
- uses: actions/setup-java@v1
with: java-version: 1.8
- run: ./gradlew cameraview:testDebugUnitTest
- uses: actions/upload-artifact@v1
with:
name: unit_tests
path: $ANDROID_UNIT_TESTS_PATH
ANDROID_EMULATOR_TESTS:
runs-on: macOS-latest
strategy:
matrix:
EMULATOR_API: [22]
EMULATOR_ARCH: [x86_64]
steps:
- uses: actions/checkout@v1
with: fetch-depth: 1
- uses: actions/setup-java@v1
with: java-version: 1.8
- uses: reactivecircus/android-emulator-runner@v1
with:
api-level: ${{ matrix.EMULATOR_API }}
arch: ${{ matrix.EMULATOR_ARCH }}
disable-animations: true
headless: true
script: ./gradlew cameraview:connectedCheck
- uses: actions/upload-artifact@v1
with:
name: emulator_tests
path: $ANDROID_EMULATOR_TESTS_PATH
CODE_COVERAGE:
runs-on: ubuntu-latest
needs: [ANDROID_UNIT_TESTS, ANDROID_EMULATOR_TESTS]
steps:
- uses: actions/checkout@v1
with: fetch-depth: 1
- uses: actions/setup-java@v1
with: java-version: 1.8
- uses: actions/download-artifact@v1
with:
name: unit_tests
path: $ANDROID_UNIT_TESTS_PATH
- uses: actions/download-artifact@v1
with:
name: emulator_tests
path: ANDROID_EMULATOR_TESTS_PATH
- run: ./gradlew cameraview:mergedCoverageReport
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_KEY }}
file: ./cameraview/build/reports/mergedCoverageReport
yml: ./.github/codecov.yml
fail_ci_if_error: true

@ -0,0 +1,15 @@
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
name: Android Deploy
on: [release]
jobs:
BINTRAY_UPLOAD:
runs-on: ubuntu-latest
env:
- TRAVIS: true
- BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
- BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
- uses: actions/checkout@v1
with: fetch-depth: 1
- uses: actions/setup-java@v1
with: java-version: 1.8
- run: ./gradlew bintrayUpload

@ -8,7 +8,7 @@ group = 'com.otaliastudios'
//region android dependencies
def travis = System.getenv("TRAVIS")
def isCI = System.getenv("TRAVIS")
android {
compileSdkVersion rootProject.ext.compileSdkVersion
@ -19,7 +19,7 @@ android {
versionCode 1
versionName project.version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
if (travis) {
if (isCI) {
testInstrumentationRunnerArgument "notAnnotation", "com.otaliastudios.cameraview.DoNotRunOnTravis"
}
}
@ -109,7 +109,7 @@ install {
def bintrayUser
def bintrayKey
if (travis) {
if (isCI) {
bintrayUser = System.getenv("BINTRAY_USER")
bintrayKey = System.getenv("BINTRAY_KEY")
} else {
@ -234,9 +234,9 @@ task mergedCoverageReport(type: JacocoReport) {
'**/Dagger*Component$Builder.class',
'**/*Module_*Factory.class',
]
if (travis) {
if (isCI) {
// All these classes are tested by the integration tests that we are not able to
// run on the travis emulator.
// run on the CI emulator.
classFilter.add('**/com/otaliastudios/cameraview/engine/CameraEngine**.*')
classFilter.add('**/com/otaliastudios/cameraview/engine/Camera1Engine**.*')
classFilter.add('**/com/otaliastudios/cameraview/engine/Camera2Engine**.*')

Loading…
Cancel
Save