Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build

on:
workflow_call:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- uses: gradle/actions/setup-gradle@v4

- name: Assemble Debug
run: ./gradlew composeApp:assembleDebug
43 changes: 43 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Coverage

on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: true

jobs:
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- uses: gradle/actions/setup-gradle@v4

- name: Download unit test execution data
uses: actions/download-artifact@v4
with:
name: jacoco-unit-exec
path: composeApp/build/jacoco/

- name: Download instrumented test coverage data
uses: actions/download-artifact@v4
with:
name: jacoco-instrumented-ec
path: composeApp/build/outputs/code_coverage/

- name: Generate coverage report
run: ./gradlew composeApp:jacocoTestReport -x connectedDebugAndroidTest -x testDebugUnitTest

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: composeApp/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml
fail_ci_if_error: true
44 changes: 44 additions & 0 deletions .github/workflows/instrumented-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Instrumented Tests

on:
workflow_call:

jobs:
instrumented-tests:
name: Instrumented Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- uses: gradle/actions/setup-gradle@v4

- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm

- name: Run instrumented tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
arch: x86_64
script: ./gradlew composeApp:connectedDebugAndroidTest

- name: Upload test report
uses: actions/upload-artifact@v4
if: always()
with:
name: instrumented-test-report
path: composeApp/build/reports/androidTests/connected/

- name: Upload instrumented coverage data
uses: actions/upload-artifact@v4
with:
name: jacoco-instrumented-ec
path: composeApp/build/outputs/code_coverage/
34 changes: 34 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PR Checks

on:
pull_request:
branches: [ master ]
push:
branches: [ master ]

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

jobs:
build:
uses: ./.github/workflows/build.yml

spotless:
uses: ./.github/workflows/spotless.yml
permissions:
contents: write

unit-tests:
needs: build
uses: ./.github/workflows/unit-tests.yml

instrumented-tests:
needs: build
uses: ./.github/workflows/instrumented-tests.yml

coverage:
needs: [ unit-tests, instrumented-tests ]
uses: ./.github/workflows/coverage.yml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
32 changes: 32 additions & 0 deletions .github/workflows/spotless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Spotless

on:
workflow_call:

jobs:
spotless:
name: Spotless
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- uses: gradle/actions/setup-gradle@v4

- name: Apply Spotless formatting
run: ./gradlew spotlessApply

- name: Commit formatting changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'style: apply spotless formatting'
34 changes: 34 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Unit Tests

on:
workflow_call:

jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- uses: gradle/actions/setup-gradle@v4

- name: Run unit tests
run: ./gradlew composeApp:testDebugUnitTest

- name: Upload test report
uses: actions/upload-artifact@v4
if: always()
with:
name: unit-test-report
path: composeApp/build/reports/tests/testDebugUnitTest/

- name: Upload Jacoco execution data
uses: actions/upload-artifact@v4
with:
name: jacoco-unit-exec
path: composeApp/build/jacoco/testDebugUnitTest.exec
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
<img src="https://img.shields.io/badge/Compose-Multiplatform-4285F4?logo=jetpackcompose&logoColor=white" />
<img src="https://img.shields.io/badge/Platform-Android%20%7C%20iOS-blue?logo=apple&logoColor=white" />
<img src="https://img.shields.io/badge/License-Apache%202.0-green?logo=open-source-initiative&logoColor=white" />
<img src="https://img.shields.io/badge/Test%20Coverage-JaCoCo-orange?logo=codecov&logoColor=white" />
<a href="https://github.com/Nacchofer31/RandomBoxd/actions/workflows/pr-checks.yml">
<img src="https://github.com/Nacchofer31/RandomBoxd/actions/workflows/pr-checks.yml/badge.svg?branch=master" alt="PR Checks" />
</a>
<a href="https://codecov.io/gh/Nacchofer31/RandomBoxd">
<img src="https://codecov.io/gh/Nacchofer31/RandomBoxd/branch/master/graph/badge.svg" alt="Coverage" />
</a>
</p>

RandomBoxd is a **Compose Multiplatform** project designed to fetch a random movie from a Letterboxd user's **watchlists** or **custom lists**. This app is built for **Android** and **iOS** devices. 📱🎬
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.randomboxd.feature.random_film.presentation

import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.assertIsNotDisplayed
import androidx.compose.ui.test.assertIsNotEnabled
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.test.onNodeWithTag
Expand All @@ -26,29 +25,29 @@ class RandomFilmScreenTest {
@Test
fun all_random_film_screen_initial_components_should_be_displayed() {
composeTestRule.setContent {
RandomFilmScreenRoot { }
RandomFilmScreenRoot(onFilmClicked = {})
}

composeTestRule.onNodeWithTag("test-random-film-user-name-text-field").assertIsDisplayed()
composeTestRule.onNodeWithTag("test-random-film-submit-button").assertIsDisplayed()
composeTestRule.onNodeWithTag("test-loading-indicator").assertIsNotDisplayed()
composeTestRule.onNodeWithTag("test-loading-indicator").assertDoesNotExist()
}

@Test
fun press_on_disabled_button_should_not_show_loading_indicator() {
composeTestRule.setContent {
RandomFilmScreenRoot { }
RandomFilmScreenRoot(onFilmClicked = {})
}

composeTestRule.onNodeWithTag("test-random-film-submit-button").performClick()
composeTestRule.onNodeWithTag("test-random-film-submit-button").assertIsNotEnabled()
composeTestRule.onNodeWithTag("test-loading-indicator").assertIsNotDisplayed()
composeTestRule.onNodeWithTag("test-loading-indicator").assertDoesNotExist()
}

@Test
fun enter_text_and_submit_button_should_show_loading_indicator() {
composeTestRule.setContent {
RandomFilmScreenRoot { }
RandomFilmScreenRoot(onFilmClicked = {})
}

composeTestRule.onNodeWithTag("test-random-film-user-name-text-field").performTextInput("user")
Expand All @@ -59,7 +58,7 @@ class RandomFilmScreenTest {
@Test
fun enter_text_and_on_clear_text_field_should_remove_text_from_field() {
composeTestRule.setContent {
RandomFilmScreenRoot { }
RandomFilmScreenRoot(onFilmClicked = {})
}

composeTestRule.onNodeWithTag("test-random-film-user-name-text-field").performTextInput("user")
Expand All @@ -86,7 +85,7 @@ class RandomFilmScreenTest {
) { }
}

composeTestRule.onNodeWithTag("test-film-display").assertIsDisplayed()
composeTestRule.onNodeWithTag("test-film-display").assertExists()
composeTestRule.onNodeWithTag("test-film-display").performClick()
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class RandomBoxdColorsTest {
fun testColors() {
val colors =
listOf(
Pair(RandomBoxdColors.BackgroundColor, Color(0xff2C343F)),
Pair(RandomBoxdColors.BackgroundLightColor, Color(0xff556678)),
Pair(RandomBoxdColors.BackgroundDarkColor, Color(0xff14171C)),
Pair(RandomBoxdColors.GreenAccent, Color(0xff00B021)),
Pair(RandomBoxdColors.BackgroundColor, Color(0xff1c2228)),
Pair(RandomBoxdColors.BackgroundLightColor, Color(0xff99aabb)),
Pair(RandomBoxdColors.BackgroundDarkColor, Color(0xff14181c)),
Pair(RandomBoxdColors.GreenAccent, Color(0xff00e054)),
Pair(RandomBoxdColors.OrangeAccent, Color(0xfff27405)),
Pair(RandomBoxdColors.BlueAccent, Color(0xff40bcf4)),
Pair(RandomBoxdColors.White, Color.White),
Expand Down
Loading
Loading