Skip to content

Commit 1feb955

Browse files
committed
ci: run unit tests, lint and screenshot verify on push and PRs
Mirrors the local pre-push gate (testDebugUnitTest, lintDebug, verifyRoborazziDebug) on ubuntu-latest/JDK 21. Uploads test/lint reports and screenshot diffs on failure; workflow_dispatch with record_screenshots re-records references on the CI runner for committing.
1 parent 1d546fc commit 1feb955

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
workflow_dispatch:
8+
inputs:
9+
record_screenshots:
10+
description: 'Re-record reference screenshots instead of verifying them'
11+
type: boolean
12+
default: false
13+
14+
concurrency:
15+
group: ci-${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
unit-tests-and-lint:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout source code
23+
uses: actions/checkout@v7
24+
25+
- name: Set up JDK
26+
uses: actions/setup-java@v5
27+
with:
28+
java-version: '21'
29+
distribution: 'temurin'
30+
cache: gradle
31+
32+
- name: Setup Android SDK
33+
uses: android-actions/setup-android@v4
34+
35+
- name: Run unit tests and lint
36+
run: |
37+
chmod +x ./gradlew
38+
./gradlew :app:testDebugUnitTest :app:lintDebug --stacktrace --no-daemon -Dorg.gradle.jvmargs="-Xmx2048m"
39+
40+
- name: Verify reference screenshots
41+
if: ${{ inputs.record_screenshots != true }}
42+
run: |
43+
chmod +x ./gradlew
44+
./gradlew :app:verifyRoborazziDebug --stacktrace --no-daemon -Dorg.gradle.jvmargs="-Xmx2048m"
45+
46+
- name: Record reference screenshots (manual re-record)
47+
if: ${{ inputs.record_screenshots == true }}
48+
run: |
49+
chmod +x ./gradlew
50+
./gradlew :app:recordRoborazziDebug --stacktrace --no-daemon -Dorg.gradle.jvmargs="-Xmx2048m"
51+
52+
- name: Upload recorded screenshots for committing
53+
if: ${{ inputs.record_screenshots == true }}
54+
uses: actions/upload-artifact@v7
55+
with:
56+
name: reference-screenshots
57+
path: app/src/test/snapshots/
58+
59+
- name: Upload test and lint reports on failure
60+
if: failure()
61+
uses: actions/upload-artifact@v7
62+
with:
63+
name: test-reports
64+
path: |
65+
app/build/reports/tests/
66+
app/build/reports/lint-results-debug.html
67+
app/src/test/snapshots/*.diff.png
68+
app/src/test/snapshots/*_actual.png
69+
if-no-files-found: ignore

0 commit comments

Comments
 (0)