From 84b98be91cfaee05cf77c9af60b53fd8da92636e Mon Sep 17 00:00:00 2001 From: Nishant Mishra Date: Mon, 14 Jul 2025 22:23:26 +0530 Subject: [PATCH] ci: GitHub actions workflow (#8) * chore: Create GitHub actions workflow to upload debug APK on commit * build: Log test results while running tests with gradlew * ci: update jdk version used, only test debug build * ci: use correct order of execution of tasks (build, test, deploy) --- .github/workflows/android.yml | 31 +++++++++++++++++++++++++++++++ app/build.gradle.kts | 10 ++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .github/workflows/android.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..70cf57a --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,31 @@ +name: Android CI + +on: [ push, pull_request ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build debug APK with Gradle + run: ./gradlew assembleDebug + + - name: Run tests + run: ./gradlew testDebugUnitTest + + - name: Upload debug APK artifact + uses: actions/upload-artifact@v4 + with: + name: tomato-debug + path: ./app/build/outputs/apk/debug/app-debug.apk diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6333317..c88e94d 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -5,6 +5,8 @@ * along with this program. If not, see . */ +import org.gradle.api.tasks.testing.logging.TestExceptionFormat +import org.gradle.api.tasks.testing.logging.TestLogEvent import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { @@ -15,6 +17,14 @@ plugins { alias(libs.plugins.ksp) } +tasks.withType(Test::class) { + testLogging { + exceptionFormat = TestExceptionFormat.FULL + events = setOf(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) + showStandardStreams = true + } +} + android { namespace = "org.nsh07.pomodoro" compileSdk = 36