-
Notifications
You must be signed in to change notification settings - Fork 95
148 lines (120 loc) · 4.15 KB
/
build.yml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Build & test
on:
push:
branches:
- main
- release-0.1.x
paths-ignore:
- '**.md'
pull_request:
workflow_dispatch:
jobs:
build:
# Skip build if head commit contains 'skip ci'
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
lfs: 'true'
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Unit Tests
uses: gradle/gradle-build-action@v2
id: screenshotsverify
continue-on-error: true
with:
arguments: testDebug --rerun
- 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
- 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 testDebug -P screenshot.record=repair
- name: Push new screenshots if available
uses: stefanzweifel/git-auto-commit-action@v5
if: steps.screenshotsrecord.outcome == 'success'
with:
file_pattern: '**/snapshots/images/*.png'
disable_globbing: true
commit_message: "🤖 Updates screenshots"
- name: Upload test results and reports
if: always()
uses: actions/upload-artifact@v4
with:
name: build-results
path: |
**/build/test-results/*
**/build/reports/*
**/out/*
compiletests:
# Skip build if head commit contains 'skip ci'
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
timeout-minutes: 50
env:
TERM: dumb
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
lfs: 'true'
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Compile tests
uses: gradle/gradle-build-action@v2
with:
arguments: compileDebugAndroidTestSources
verify:
# Skip build if head commit contains 'skip ci'
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
lfs: 'true'
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
- name: set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Check GIT lfs images
run: |
./scripts/git-lfs-check.sh
- name: Metalava compatibility check
uses: gradle/gradle-build-action@v2
with:
arguments: --stacktrace
metalavaCheckCompatibility metalavaCheckCompatibilityRelease
- name: Code analysis
uses: gradle/gradle-build-action@v2
with:
arguments: --stacktrace
spotlessCheck
lintDebug
- name: Dependencies analysis
uses: gradle/gradle-build-action@v2
if: ${{ false }} # Disabled until -android supported https://github.com/google/horologist/issues/1314
with:
arguments: --stacktrace
projectHealth