Skip to content

Commit

Permalink
Add GitHub Action
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepylee committed Oct 1, 2020
1 parent 2af941a commit e94c8c4
Showing 1 changed file with 101 additions and 0 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/lint_and_unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Android Lint & Unit Test flow

# Choose the branch or branches you want to run this workflow
on: push
jobs:
setup:
name: Setup
runs-on: macOS-latest
steps:
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

linting:
name: Linting
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/[email protected]

- name: Load Gradle cached
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
# Check the code with Android linter
- name: Run Android Linter
run: ./gradlew app:lintStagingDebug data:lintStagingDebug

# Archive lint report
- name: Archive Lint reports
uses: actions/upload-artifact@v2
with:
name: lint-report
path: |
app/build/reports/*.html
data/build/reports/*.html
detekt:
name: Detekt - Static Code Analysis
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/[email protected]

- name: Load Gradle cached
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Detekt
run: ./gradlew detekt

- name: Archive Detekt report
uses: actions/upload-artifact@v2
with:
name: detekt-report
path: build/reports/detekt/

unitTest:
name: Jacoco - Unit Test & CodeCov
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/[email protected]

- name: Load Gradle cached
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/modules-*
~/.gradle/caches/jars-*
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Unit Tests & Jacoco
run: ./gradlew jacocoTestReport

# Archive Unit test & code coverage report
- name: Archive Code coverage report
uses: actions/upload-artifact@v2
with:
name: code-coverage-report
path: |
app/build/reports/jacoco/jacocoTestReport/
data/build/reports/jacoco/jacocoTestReport/

0 comments on commit e94c8c4

Please sign in to comment.