Skip to content

Commit

Permalink
[WIP]: Move testDemo to testDemoDebug
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMarquis committed Nov 11, 2023
1 parent 3f22248 commit 145fc08
Show file tree
Hide file tree
Showing 117 changed files with 9 additions and 107 deletions.
102 changes: 2 additions & 100 deletions .github/workflows/Build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
jobs:
test_and_apk:
name: "Local tests and APKs"
runs-on: ubuntu-latest
runs-on: macOS-latest

permissions:
contents: write
Expand All @@ -39,109 +39,11 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Check spotless
run: ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache

- name: Run all local screenshot tests (Roborazzi)
id: screenshotsverify
continue-on-error: true
run: ./gradlew verifyRoborazziDemoDebug

- name: Prevent pushing new screenshots if this is a fork
id: checkfork
continue-on-error: false
if: steps.screenshotsverify.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository
run: |
echo "::error::Screenshot tests failed, please create a PR in your fork first." && exit 1
# Runs if previous job failed
- name: Generate new screenshots if verification failed and it's a PR
id: screenshotsrecord
if: steps.screenshotsverify.outcome == 'failure' && github.event_name == 'pull_request'
run: |
./gradlew recordRoborazziDemoDebug
- name: Push new screenshots if available
uses: stefanzweifel/git-auto-commit-action@v5
if: steps.screenshotsrecord.outcome == 'success'
with:
file_pattern: '*/*.png'
disable_globbing: true
commit_message: "🤖 Updates screenshots"

# Run local tests after screenshot tests to avoid wrong UP-TO-DATE. TODO: Ignore screenshots.
- name: Run local tests
if: always()
run: ./gradlew testDemoDebug testProdDebug :lint:test

- name: Build all build type and flavor permutations
run: ./gradlew assemble

- name: Upload build outputs (APKs)
uses: actions/upload-artifact@v3
with:
name: APKs
path: '**/build/outputs/apk/**/*.apk'
- run: ./gradlew test

- name: Upload test results (XML)
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: '**/build/test-results/test*UnitTest/**.xml'

- name: Check lint
run: ./gradlew :app:lintProdRelease :app-nia-catalog:lintRelease :lint:lint

- name: Upload lint reports (HTML)
if: always()
uses: actions/upload-artifact@v3
with:
name: lint-reports
path: '**/build/reports/lint-results-*.html'

- name: Check badging
run: ./gradlew :app:checkProdReleaseBadging

androidTest:
runs-on: macOS-latest # enables hardware acceleration in the virtual machine
timeout-minutes: 55
strategy:
matrix:
api-level: [26, 30]

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

- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Build projects before running emulator
run: ./gradlew packageDemoDebug packageDemoDebugAndroidTest

- name: Run instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
disable-animations: true
disk-size: 6000M
heap-size: 600M
script: ./gradlew connectedDemoDebugAndroidTest --daemon

- name: Upload test reports
if: always()
uses: actions/upload-artifact@v3
with:
name: test-reports-${{ matrix.api-level }}
path: '**/build/reports/androidTests'
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class NiaAppScreenSizesScreenshotTests {

composeTestRule.onRoot()
.captureRoboImage(
"src/testDemo/screenshots/$screenshotName.png",
"src/testDemoDebug/screenshots/$screenshotName.png",
roborazziOptions = DefaultRoborazziOptions,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class FilterChipScreenshotTests() {
}
composeTestRule.onRoot()
.captureRoboImage(
"src/test/screenshots/FilterChip/FilterChip_fontScale2.png",
"src/testDebug/screenshots/FilterChip/FilterChip_fontScale2.png",
roborazziOptions = DefaultRoborazziOptions,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class LoadingWheelScreenshotTests() {
composeTestRule.mainClock.advanceTimeBy(deltaTime)
composeTestRule.onRoot()
.captureRoboImage(
"src/test/screenshots/LoadingWheel/LoadingWheel_animation_$deltaTime.png",
"src/testDebug/screenshots/LoadingWheel/LoadingWheel_animation_$deltaTime.png",
roborazziOptions = DefaultRoborazziOptions,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class NavigationScreenshotTests() {
}
composeTestRule.onRoot()
.captureRoboImage(
"src/test/screenshots/Navigation" +
"src/testDebug/screenshots/Navigation" +
"/Navigation_fontScale2.png",
roborazziOptions = DefaultRoborazziOptions,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class TabsScreenshotTests() {
}
composeTestRule.onRoot()
.captureRoboImage(
"src/test/screenshots/Tabs/Tabs_fontScale2.png",
"src/testDebug/screenshots/Tabs/Tabs_fontScale2.png",
roborazziOptions = DefaultRoborazziOptions,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class TagScreenshotTests() {
}
composeTestRule.onRoot()
.captureRoboImage(
"src/test/screenshots/Tag/Tag_fontScale2.png",
"src/testDebug/screenshots/Tag/Tag_fontScale2.png",
roborazziOptions = DefaultRoborazziOptions,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class TopAppBarScreenshotTests() {
}
composeTestRule.onRoot()
.captureRoboImage(
"src/test/screenshots/TopAppBar/TopAppBar_fontScale2.png",
"src/testDebug/screenshots/TopAppBar/TopAppBar_fontScale2.png",
roborazziOptions = DefaultRoborazziOptions,
)
}
Expand Down

0 comments on commit 145fc08

Please sign in to comment.