Skip to content

Commit b4ba493

Browse files
Merge pull request thunderbird#9681 from rafaeltonholo/ci/update-pr-pipeline
ci: introduce new PR workflow
2 parents 789c1bc + b75cc56 commit b4ba493

6 files changed

Lines changed: 242 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Gradle cache
2+
description: Enable Gradle Wrapper caching (optimization)
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Enable Gradle Wrapper caching
7+
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # 4.2.4
8+
with:
9+
path:
10+
~/.gradle/caches
11+
~/.gradle/wrapper
12+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
13+
restore-keys: |
14+
${{ runner.os }}-gradle-

.github/actions/setup/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Set up build environment
2+
description: Prepares environment for building with JDK and Gradle
3+
runs:
4+
using: 'composite'
5+
steps:
6+
- name: Copy CI gradle.properties
7+
shell: bash
8+
run: mkdir -p ~/.gradle ; cp .github/ci-gradle-android-pr-workflow.properties ~/.gradle/gradle.properties
9+
10+
- name: Set up JDK
11+
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
12+
with:
13+
distribution: 'temurin'
14+
java-version: '17'
15+
16+
- name: Set up Gradle
17+
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
18+
19+
- name: Restore Gradle cache
20+
uses: ./.github/actions/gradle_cache
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
org.gradle.daemon=false
2+
org.gradle.parallel=true
3+
org.gradle.caching=true
4+
org.gradle.configuration-cache=true
5+
org.gradle.configuration-cache.parallel=true
6+
org.gradle.workers.max=4
7+
org.gradle.jvmargs=-Xmx10g -XX:MaxMetaspaceSize=4g -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError
8+
9+
kotlin.incremental=true
10+
kotlin.compiler.execution.strategy=in-process

.github/workflows/android-pr.yml

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
name: Pull request checks
2+
on:
3+
pull_request:
4+
paths-ignore:
5+
- '.idea/**'
6+
- '.gitattributes'
7+
- '.github/**.json'
8+
- '.gitignore'
9+
- '.gitmodules'
10+
- '**.md'
11+
- 'LICENSE'
12+
- 'NOTICE'
13+
14+
env:
15+
CI_CHECK_RELEASE_BUILDS: 'false'
16+
17+
permissions:
18+
contents: read
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.pull_request.number || 'no-pr' }}
22+
cancel-in-progress: true
23+
24+
jobs:
25+
build-k9:
26+
name: Build K9 application
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 90
29+
steps:
30+
- name: Checkout the repo
31+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
33+
- name: Prepares environment
34+
uses: ./.github/actions/setup
35+
36+
- name: Build K9 application
37+
run: ./gradlew :app-k9mail:assemble
38+
39+
build-thunderbird:
40+
name: Build Thunderbird application
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 90
43+
steps:
44+
- name: Checkout the repo
45+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46+
47+
- name: Prepares environment
48+
uses: ./.github/actions/setup
49+
50+
- name: Build Thunderbird application
51+
run: ./gradlew :app-thunderbird:assemble
52+
53+
build-app-ui-catalog:
54+
name: Build App UI-catalog application
55+
runs-on: ubuntu-latest
56+
timeout-minutes: 90
57+
steps:
58+
- name: Checkout the repo
59+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
60+
61+
- name: Prepares environment
62+
uses: ./.github/actions/setup
63+
64+
- name: Build App UI-catalog application in Debug mode
65+
run: ./gradlew :app-ui-catalog:assembleDebug
66+
67+
build-cli-tools:
68+
name: Build CLI tools if needed
69+
runs-on: ubuntu-latest
70+
timeout-minutes: 90
71+
steps:
72+
- name: Check if CLI tools are changed
73+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
74+
id: changes
75+
with:
76+
filters: |
77+
cli_tools_changed:
78+
- 'cli/**'
79+
- name: Build CLI tools
80+
# run only if CLI tools were changed
81+
if: steps.changes.outputs.cli_tools_changed == 'true'
82+
run: ./gradlew buildCliTools
83+
84+
lint:
85+
name: Quality - Lint
86+
runs-on: ubuntu-latest
87+
timeout-minutes: 90
88+
steps:
89+
- name: Checkout the repo
90+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
91+
92+
- name: Prepares environment
93+
uses: ./.github/actions/setup
94+
95+
- name: Running Android lint
96+
run: ./gradlew lint
97+
98+
spotless:
99+
name: Quality - Spotless
100+
runs-on: ubuntu-latest
101+
timeout-minutes: 90
102+
steps:
103+
- name: Checkout the repo
104+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
105+
106+
- name: Prepares environment
107+
uses: ./.github/actions/setup
108+
109+
- name: Running spotless check
110+
run: ./gradlew spotlessCheck
111+
112+
detekt:
113+
name: Quality - Detekt
114+
runs-on: ubuntu-latest
115+
timeout-minutes: 90
116+
steps:
117+
- name: Checkout the repo
118+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
119+
120+
- name: Prepares environment
121+
uses: ./.github/actions/setup
122+
123+
- name: Running Detekt
124+
run: ./gradlew detekt
125+
126+
- name: Running Detekt including KMP
127+
# As we were not verifying detekt in KMP sources before,
128+
# this step is likely to fail.
129+
continue-on-error: true
130+
run: |
131+
./gradlew detektMetadataCommonMain
132+
./gradlew detektMetadataMain
133+
./gradlew detektMetadataCommonJvmMain
134+
135+
unit-test:
136+
name: Quality - Unit tests
137+
runs-on: ubuntu-latest
138+
timeout-minutes: 90
139+
steps:
140+
- name: Checkout the repo
141+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
142+
143+
- name: Prepares environment
144+
uses: ./.github/actions/setup
145+
146+
- name: Running unit tests
147+
run: ./gradlew testDebugUnitTest --parallel
148+
149+
dependency-guard:
150+
name: Quality - Dependency Guard
151+
runs-on: ubuntu-latest
152+
timeout-minutes: 90
153+
steps:
154+
- name: Checkout the repo
155+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
156+
157+
- name: Prepares environment
158+
uses: ./.github/actions/setup
159+
160+
- name: Running Dependency Guard
161+
run: ./gradlew dependencyGuard
162+
163+
check-badging:
164+
name: Quality - Badging
165+
runs-on: ubuntu-latest
166+
timeout-minutes: 90
167+
steps:
168+
- name: Checkout the repo
169+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
170+
171+
- name: Prepares environment
172+
uses: ./.github/actions/setup
173+
174+
- name: Running K9 Badging
175+
run: |
176+
./gradlew :app-k9mail:checkFossReleaseBadging \
177+
:app-k9mail:checkFullReleaseBadging \
178+
-x assemble \
179+
-x build
180+
181+
- name: Running Thunderbird Badging
182+
run: |
183+
./gradlew :app-thunderbird:checkFossBetaBadging \
184+
:app-thunderbird:checkFossDailyBadging \
185+
:app-thunderbird:checkFossReleaseBadging \
186+
:app-thunderbird:checkFullBetaBadging \
187+
:app-thunderbird:checkFullDailyBadging \
188+
:app-thunderbird:checkFullReleaseBadging \
189+
-x assemble \
190+
-x build

build-plugin/src/main/kotlin/AndroidExtension.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ internal fun CommonExtension<*, *, *, *, *, *>.configureSharedConfig(project: Pr
2525
checkDependencies = true
2626
lintConfig = project.file("${project.rootProject.projectDir}/config/lint/lint.xml")
2727
baseline = project.file("${project.rootProject.projectDir}/config/lint/android-lint-baseline.xml")
28+
checkReleaseBuilds = System.getenv("CI_CHECK_RELEASE_BUILDS")?.toBoolean() ?: true
2829
}
2930

3031
testOptions {

build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ tasks.register("testsOnCi") {
4343
)
4444
}
4545

46+
tasks.register("buildCliTools") {
47+
val cliToolsProjects = subprojects.filter { it.path.startsWith(":cli:") }
48+
dependsOn(
49+
cliToolsProjects.map { project -> project.tasks.named("build") },
50+
)
51+
}
52+
4653
tasks.named<Wrapper>("wrapper") {
4754
gradleVersion = libs.versions.gradle.get()
4855
distributionType = Wrapper.DistributionType.ALL

0 commit comments

Comments
 (0)