Skip to content

Commit

Permalink
Refactor: Move tests from androidTest to test directory (#112)
Browse files Browse the repository at this point in the history
* Move tests from `androidTest` to `test` directory

- Adds test setup and teardown gradle tasks
- Updates workflows to cater for added tasks

Signed-off-by: Maxwell Mapako <wax911@users.noreply.github.com>
  • Loading branch information
wax911 committed Jun 18, 2023
1 parent dae90eb commit c29d6a6
Show file tree
Hide file tree
Showing 12 changed files with 433 additions and 379 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/android-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: gradle-unit-test
name: android-test

on:
push:
Expand All @@ -10,7 +10,7 @@ on:
- "app/src/main/**"

jobs:
unit-test:
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -23,18 +23,24 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Run tests
run: ./gradlew emojify:test --stacktrace
run: |
./gradlew emojify:preTest
./gradlew emojify:test --stacktrace
./gradlew emojify:postTest
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test/TEST-*.xml'

instrumented-test:
instrumented:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
api-level:
- 21
- 24
- 26
- 29
- 23
- 33
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
Expand All @@ -50,8 +56,4 @@ jobs:
script: ./gradlew connectedCheck
env:
API_LEVEL: ${{ matrix.api-level }}
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test/TEST-*.xml'

2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Android Emojify &nbsp; &nbsp; [![Release](https://jitpack.io/v/wax911/android-emojify.svg?style=flat-square)](https://jitpack.io/#wax911/android-emojify) &nbsp; [![Codacy Badge](https://app.codacy.com/project/badge/Grade/6bace5612f8c4799ac86f104f5b2db0f)](https://www.codacy.com/gh/AniTrend/android-emojify/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=AniTrend/android-emojify&amp;utm_campaign=Badge_Grade) &nbsp; [![Build Status](https://travis-ci.org/AniTrend/android-emojify.svg?branch=master)](https://travis-ci.org/AniTrend/android-emojify) [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FAniTrend%2Fandroid-emojify.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FAniTrend%2Fandroid-emojify?ref=badge_shield)
# Android Emojify &nbsp; &nbsp; [![Release](https://jitpack.io/v/wax911/android-emojify.svg?style=flat-square)](https://jitpack.io/#wax911/android-emojify) &nbsp; [![Codacy Badge](https://app.codacy.com/project/badge/Grade/6bace5612f8c4799ac86f104f5b2db0f)](https://www.codacy.com/gh/AniTrend/android-emojify/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=AniTrend/android-emojify&amp;utm_campaign=Badge_Grade) &nbsp; [![gradle-unit-test](https://github.com/AniTrend/android-emojify/actions/workflows/android-test.yml/badge.svg)](https://github.com/AniTrend/android-emojify/actions/workflows/android-test.yml)

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FAniTrend%2Fandroid-emojify.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FAniTrend%2Fandroid-emojify?ref=badge_large)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ internal fun Project.configureAndroid(): Unit = baseExtension().run {
}

packagingOptions {
resources.excludes.add("META-INF/NOTICE.txt")
resources.excludes.add("META-INF/LICENSE")
resources.excludes.add("META-INF/LICENSE.txt")
resources.excludes.add("META-INF/NOTICE.*")
resources.excludes.add("META-INF/LICENSE*")
}

sourceSets {
Expand Down
16 changes: 15 additions & 1 deletion emojify/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.Delete

plugins {
id("io.wax911.emojify")
id("kotlinx-serialization")
Expand All @@ -11,4 +14,15 @@ dependencies {

android {
namespace = "io.wax911.emojify"
}
}

tasks.register<Copy>("preTest") {
from("src/main/assets/emoticons/")
into("src/test/resources/io/wax911/emojify/core/")
}

tasks.register<Delete>("postTest") {
delete(fileTree("src/test/resources/io/wax911/emojify/core/") {
include("emoji.json")
})
}
218 changes: 0 additions & 218 deletions emojify/src/androidTest/java/io/wax911/emojify/EmojiUtilTest.kt

This file was deleted.

Loading

0 comments on commit c29d6a6

Please sign in to comment.