-
Notifications
You must be signed in to change notification settings - Fork 24
71 lines (59 loc) · 2.28 KB
/
Copy pathadaptive-jetstream-build.yml
File metadata and controls
71 lines (59 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Build and Test Adaptive Jetstream
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build-and-test:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# screenshot reference files to the repository.
contents: write
steps:
- name: Checkout code
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
working-directory: ./AdaptiveJetStream
- name: Build Debug APK
run: ./gradlew assembleDebug
working-directory: ./AdaptiveJetStream
- name: Run Unit Tests
run: ./gradlew testDebugUnitTest
working-directory: ./AdaptiveJetStream
- name: Run all local screenshot tests
id: screenshotsverify
continue-on-error: true
run: ./gradlew validateDebugScreenshotTest
working-directory: ./AdaptiveJetStream
- name: Prevent pushing new screenshots if this is a fork
id: checkfork_screenshots
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."
echo "Your fork's CI will take screenshots for your fork."
exit 1
working-directory: ./AdaptiveJetStream
# 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 updateDebugScreenshotTest
working-directory: ./AdaptiveJetStream
- name: Push new screenshots if available
uses: stefanzweifel/git-auto-commit-action@v5
if: steps.screenshotsrecord.outcome == 'success'
with:
file_pattern: 'AdaptiveJetStream/jetstream/src/screenshotTestDebug/reference/**/*.png'
commit_message: "🤖 Updates screenshots"