Skip to content

Commit

Permalink
add run code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
trOnk12 committed Oct 6, 2023
1 parent a57d3c7 commit ba1f73f
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 46 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/run-code-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run code coverage

on:
pull_request:
push:
branches:
- "develop"
- "main"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: macos-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Execute unit tests
- name: Unit Test with Android Emulator Runner
uses: ReactiveCircus/[email protected]
with:
api-level: 29
script: ./gradlew connectedCheck

# run: ./gradlew testDebugUnitTest

- name: generate report
uses: actions/upload-artifact@v2
with:
name: report
path: app/build/reports/coverage/debug
4 changes: 1 addition & 3 deletions .github/workflows/run-snapshot-test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#---
#name: Snapshot verification
#
#on:
# pull_request:
#]
#
#concurrency:
# group: ${{ github.ref }}-${{ github.workflow }}
Expand Down
78 changes: 39 additions & 39 deletions .github/workflows/run-unit-test.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
name: Run unit tests

on:
pull_request:
push:
branches:
- "develop"
- "main"

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

permissions: read-all

jobs:
unit-tests:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Prepare Android Environment
uses: ./.github/actions/prepare-android-env

- name: Run test
run: ./gradlew connectedCheck
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Include Slack Notification
if: failure() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
uses: ./.github/actions/slack-notification
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_GIT_REF: ${{ github.ref }}
SLACK_WORKFLOW: ${{ github.workflow }}
#name: Run unit tests
#
#on:
# pull_request:
# push:
# branches:
# - "develop"
# - "main"
#
#concurrency:
# group: ${{ github.ref }}-${{ github.workflow }}
# cancel-in-progress: true
#
#permissions: read-all
#
#jobs:
# unit-tests:
# runs-on: ubuntu-20.04
#
# steps:
# - name: Checkout
# uses: actions/checkout@v3
#
# - name: Prepare Android Environment
# uses: ./.github/actions/prepare-android-env
#
# - name: Run test
# run: ./gradlew connectedCheck
# env:
# GITHUB_USER: ${{ github.actor }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Include Slack Notification
# if: failure() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
# uses: ./.github/actions/slack-notification
# env:
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# SLACK_GIT_REF: ${{ github.ref }}
# SLACK_WORKFLOW: ${{ github.workflow }}
4 changes: 0 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ android {

task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
reports {
xml.configure {
setEnabled(true)
setBuildDir("${buildDir}/coverage-report")
}
html.configure {
setEnabled(true)
setBuildDir("${buildDir}/coverage-report")
Expand Down

0 comments on commit ba1f73f

Please sign in to comment.