Skip to content

Commit 9e1a3e7

Browse files
authored
Merge branch 'master' into dependabot/gradle/androidx_work-a76513af8b
2 parents 6cb66d9 + ef82fc3 commit 9e1a3e7

36 files changed

Lines changed: 994 additions & 160 deletions

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# These owners will be the default owners for everything in the repo.
22
# Unless a later match takes precedence,
33
# these owners will be requested for review when someone opens a pull request.
4-
* @DenBond7 @ioanatflowcrypt
4+
* @DenBond7 @sosnovsky
55

66
# The following files will no have codeowners to allow dependabot auto-merge
77
# based on https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features

.idea/gradle.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.semaphore/semaphore.yml

Lines changed: 12 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,47 +25,28 @@ global_job_config:
2525
value: /home/semaphore/Android/Sdk
2626
prologue:
2727
commands:
28-
# fix DNS to ping *.localhost and *.flowcrypt.test
2928
- sudo apt-get update
30-
- sudo apt install -y dnsmasq resolvconf
31-
- echo "#added by flowcrypt" | sudo tee -a /etc/dnsmasq.conf
32-
- echo "listen-address=127.0.0.1" | sudo tee -a /etc/dnsmasq.conf
33-
- echo "address=/test/127.0.0.1" | sudo tee -a /etc/dnsmasq.conf
34-
- echo "address=/localhost/127.0.0.1" | sudo tee -a /etc/dnsmasq.conf
35-
- echo "server=8.8.8.8" | sudo tee -a /etc/dnsmasq.conf
36-
# redirect the systemd-resolved to use the localhost as the primary nameserver
37-
- sudo sed -i '1inameserver 127.0.0.1\' /etc/resolv.conf
38-
- sudo systemctl restart dnsmasq
39-
# print some debug info
40-
- ping fel.localhost -c 1
41-
- ping fel.flowcrypt.test -c 1
4229
# use JAVA 21 by default
4330
- sem-version java 21
4431
# general settings
4532
- export PATH=${ANDROID_HOME}/emulator:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${PATH}
4633
- sudo rm -rf ~/.rbenv ~/.phpbrew
4734
- checkout
35+
# fix DNS to ping *.localhost and *.flowcrypt.test
36+
- ./script/ci-setup-DNS.sh
4837
# init environment variables
49-
- export SUM=$(checksum build.gradle.kts)-$(checksum FlowCrypt/build.gradle.kts)-$(checksum ./script/ci-install-android-sdk.sh)
50-
- export APP_GRADLE_CACHE=gradle-cache-$SUM # per conf files hash
51-
- export ANDROID_SDK_CACHE=android-sdk-$SUM # per conf files hash
52-
- export BUILD_CXX_CACHE=build-cxx-cache-$SEMAPHORE_GIT_BRANCH-$SUM # per branch and conf files hash
53-
- export BUILD_NATIVE_CACHE=build-native-cache-$SEMAPHORE_GIT_BRANCH-$SUM # per branch and conf files hash
54-
- export BUILD_CACHE=build-cache-$SEMAPHORE_GIT_BRANCH-$SUM # per branch and conf files hash
38+
- export GRADLE_SUM=$(checksum build.gradle.kts)-$(checksum FlowCrypt/build.gradle.kts)
39+
- export SDK_SUM=$(checksum ./script/ci-install-android-sdk.sh)
40+
- export APP_GRADLE_CACHE=project-gradle-cache-$GRADLE_SUM # project .gradle cache, per Gradle config hash
41+
- export ANDROID_SDK_CACHE=android-sdk-$SDK_SUM # Android SDK cache, per SDK installer hash
5542
# restore app caches
5643
- cache restore $APP_GRADLE_CACHE
57-
- cache restore $BUILD_CXX_CACHE
58-
- cache restore $BUILD_NATIVE_CACHE
59-
- cache restore $BUILD_CACHE
6044
# restore global caches
6145
- cache restore $ANDROID_SDK_CACHE
6246
- cache restore gradle-wrapper
63-
- cache restore gradle-cache
64-
- cache restore android-build-cache
47+
- cache restore gradle-cache-$GRADLE_SUM
6548
# Install Android dependencies if needed
6649
- ./script/ci-install-android-sdk.sh
67-
# Install ninja
68-
- sudo apt install -y ninja-build
6950
blocks:
7051
- name: 'Build'
7152
execution_time_limit:
@@ -79,27 +60,20 @@ blocks:
7960
# print Java version
8061
- java -version
8162
# compile project
82-
- ./gradlew --console=plain assembleConsumerUiTests
63+
- ./gradlew --console=plain --no-daemon --build-cache assembleConsumerUiTests
8364
epilogue:
8465
on_pass:
8566
commands:
8667
# store app cache
8768
- echo "Store the app cache"
8869
- cache has_key $APP_GRADLE_CACHE || cache store $APP_GRADLE_CACHE .gradle
89-
- cache has_key $BUILD_CXX_CACHE || cache store $BUILD_CXX_CACHE FlowCrypt/.cxx
90-
- cache has_key $BUILD_NATIVE_CACHE || cache store $BUILD_NATIVE_CACHE FlowCrypt/.externalNativeBuild
91-
- cache has_key $BUILD_CACHE || cache store $BUILD_CACHE FlowCrypt/build
9270

9371
# clean and store global cache
9472
- echo "Store the global cache"
9573
- find ~/.gradle/caches/ -name "*.lock" -type f -delete # https://medium.com/cirruslabs/mastering-gradle-caching-and-incremental-builds-37eb1af7fcde
9674
- cache has_key $ANDROID_SDK_CACHE || cache store $ANDROID_SDK_CACHE $ANDROID_HOME
97-
- cache delete gradle-wrapper
98-
- cache delete gradle-cache
99-
- cache delete android-build-cache
100-
- cache store gradle-wrapper ~/.gradle/wrapper
101-
- cache store gradle-cache ~/.gradle/caches
102-
- cache store android-build-cache ~/.android/build-cache
75+
- cache has_key gradle-wrapper || cache store gradle-wrapper ~/.gradle/wrapper
76+
- cache has_key gradle-cache-$GRADLE_SUM || cache store gradle-cache-$GRADLE_SUM ~/.gradle/caches
10377

10478
- name: 'Testing'
10579
task:
@@ -188,6 +162,8 @@ blocks:
188162
commands:
189163
# collect and store debug info as artifacts
190164
- ./script/ci-get-and-publish-debug-info-as-artifact.sh
165+
# print debug info
166+
- ./script/ci-after-fail-debug.sh
191167

192168
after_pipeline:
193169
task:

FlowCrypt/build.gradle.kts

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
import com.android.build.api.artifact.SingleArtifact
88
import com.android.build.api.variant.ResValue
9-
import org.gradle.api.GradleException
10-
import java.io.File
119
import com.android.ddmlib.DdmPreferences
1210
import java.io.FileInputStream
1311
import java.text.SimpleDateFormat
@@ -32,6 +30,15 @@ if (propertiesFile.exists()) {
3230
keystoreProperties.load(FileInputStream(propertiesFile))
3331
}
3432

33+
kotlin {
34+
jvmToolchain(21)
35+
36+
compilerOptions {
37+
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21)
38+
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
39+
}
40+
}
41+
3542
android {
3643
compileSdk = rootProject.extra["compileSdkVersion"] as Int
3744
namespace = "com.flowcrypt.email"
@@ -395,20 +402,6 @@ easylauncher {
395402
}
396403
}
397404

398-
java {
399-
toolchain {
400-
languageVersion.set(JavaLanguageVersion.of(21))
401-
}
402-
}
403-
404-
405-
kotlin {
406-
compilerOptions {
407-
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_21)
408-
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
409-
}
410-
}
411-
412405
tasks.register("checkCorrectBranch") {
413406
if (!grgit.branch.current().name.equals("master")) {
414407
throw GradleException("Please use 'master' branch to generate a release build")
@@ -492,7 +485,7 @@ dependencies {
492485
implementation("androidx.appcompat:appcompat:1.7.1")
493486
implementation("androidx.legacy:legacy-preference-v14:1.0.0")
494487
implementation("androidx.cardview:cardview:1.0.0")
495-
implementation("androidx.browser:browser:1.9.0")
488+
implementation("androidx.browser:browser:1.10.0")
496489
implementation("androidx.recyclerview:recyclerview:1.4.0")
497490
implementation("androidx.recyclerview:recyclerview-selection:1.2.0")
498491
implementation("androidx.constraintlayout:constraintlayout:2.2.1")
@@ -509,7 +502,7 @@ dependencies {
509502
//noinspection GradleDependency
510503
implementation("androidx.paging:paging-runtime-ktx:2.1.2")
511504
implementation("androidx.preference:preference-ktx:1.2.1")
512-
implementation("androidx.core:core-ktx:1.17.0")
505+
implementation("androidx.core:core-ktx:1.18.0")
513506
implementation("androidx.core:core-splashscreen:1.2.0")
514507
implementation("androidx.activity:activity-ktx:1.12.2")
515508
implementation("androidx.fragment:fragment-ktx:1.8.9")
@@ -524,7 +517,7 @@ dependencies {
524517
implementation("com.google.android.material:material:1.13.0")
525518
implementation("com.google.android.flexbox:flexbox:3.0.0")
526519
implementation("com.google.code.gson:gson:2.13.2")
527-
implementation("com.google.api-client:google-api-client-android:2.8.1")
520+
implementation("com.google.api-client:google-api-client-android:2.9.0")
528521
implementation("com.google.apis:google-api-services-gmail:v1-rev20251201-2.0.0")
529522
//ACRA needs the following dependency to use a custom report sender
530523
implementation("com.google.auto.service:auto-service-annotations:1.1.1")
@@ -549,7 +542,7 @@ dependencies {
549542
implementation("org.pgpainless:pgpainless-core:2.0.2")
550543
implementation("org.eclipse.angus:angus-mail:2.0.5")
551544
implementation("org.eclipse.angus:gimap:2.0.5")
552-
implementation("commons-io:commons-io:2.21.0")
545+
implementation("commons-io:commons-io:2.22.0")
553546
implementation("net.openid:appauth:0.11.1")
554547
implementation("ch.acra:acra-http:5.13.1")
555548
implementation("io.github.everythingme:overscroll-decor-android:1.1.1")

FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/SubmitPublicKeyAfterCreationNonGoogleAccountFlowTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import okhttp3.mockwebserver.MockResponse
3838
import okhttp3.mockwebserver.RecordedRequest
3939
import org.eclipse.angus.mail.imap.IMAPFolder
4040
import org.junit.Assert.assertTrue
41+
import org.junit.Ignore
4142
import org.junit.Rule
4243
import org.junit.Test
4344
import org.junit.rules.RuleChain
@@ -56,6 +57,7 @@ import java.util.concurrent.TimeUnit
5657
@MediumTest
5758
@RunWith(AndroidJUnit4::class)
5859
@FlowCryptTestSettings(useIntents = true, useCommonIdling = false)
60+
@Ignore("temporary disabled")
5961
class SubmitPublicKeyAfterCreationNonGoogleAccountFlowTest : BaseSignTest() {
6062
override val activityScenarioRule = activityScenarioRule<MainActivity>()
6163

FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/gmailapi/passwordprotected/ComposeScreenPasswordProtectedDisallowedTermsReFetchConfigurationFlowTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import okhttp3.mockwebserver.Dispatcher
4040
import okhttp3.mockwebserver.MockResponse
4141
import okhttp3.mockwebserver.RecordedRequest
4242
import org.hamcrest.Matchers.allOf
43+
import org.junit.Ignore
4344
import org.junit.Rule
4445
import org.junit.Test
4546
import org.junit.rules.RuleChain
@@ -63,6 +64,7 @@ import java.util.concurrent.TimeUnit
6364
subject = "",
6465
isNew = true
6566
)
67+
@Ignore("temporary disabled")
6668
class ComposeScreenPasswordProtectedDisallowedTermsReFetchConfigurationFlowTest :
6769
BaseComposeScreenPasswordProtectedDisallowedTermsTest(
6870
ACCOUNT_ENTITY_WITH_EXISTING_OPTIONAL_PARAMETERS

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@ This guide follows Google's recommendations for [testing apps on Android](https:
1515
Please follow these steps to setup your virtual or physical device:
1616

1717
- [Set up your test environment](https://developer.android.com/training/testing/espresso/setup#set-up-environment).
18-
- Some of the tests use [MockWebServer](https://github.com/square/okhttp/tree/master/mockwebserver). We run a local mock web server via [FlowCryptMockWebServerRule](https://github.com/FlowCrypt/flowcrypt-android/blob/master/FlowCrypt/src/androidTest/java/com/flowcrypt/email/rules/FlowCryptMockWebServerRule.kt). It uses [TestConstants.MOCK_WEB_SERVER_PORT](https://github.com/FlowCrypt/flowcrypt-android/blob/master/FlowCrypt/src/androidTest/java/com/flowcrypt/email/TestConstants.kt#L19) as a port. Unfortunately, the Android system doesn't allow us to use the `HTTPS 433` port by default to run a web server on the `localhost (127.0.0.1)`. That's why we have to run a mock web server on another port (for example, `1212`) and route all traffic from `127.0.0.1:433` to `127.0.0.1:1212`. For that purpose, you can use the [script/ci-wait-for-emulator.sh](https://github.com/FlowCrypt/flowcrypt-android/blob/master/script/ci-wait-for-emulator.sh#L13) script.
18+
- Some of the tests use [MockWebServer](https://github.com/square/okhttp/tree/master/mockwebserver). We run a local mock web server via [FlowCryptMockWebServerRule](https://github.com/FlowCrypt/flowcrypt-android/blob/master/FlowCrypt/src/androidTest/java/com/flowcrypt/email/rules/FlowCryptMockWebServerRule.kt). It uses [TestConstants.MOCK_WEB_SERVER_PORT](https://github.com/FlowCrypt/flowcrypt-android/blob/master/FlowCrypt/src/androidTest/java/com/flowcrypt/email/TestConstants.kt#L19) as a port. Unfortunately, the Android system doesn't allow us to use the `HTTPS 443` port by default to run a web server on the `localhost (127.0.0.1)`. That's why we have to run a mock web server on another port (for example, `1212`) and route all traffic from `127.0.0.1:443` to `127.0.0.1:1212`. For that purpose, you can use the [script/ci-wait-for-emulator.sh](https://github.com/FlowCrypt/flowcrypt-android/blob/master/script/ci-wait-for-emulator.sh#L13) script.
1919
- Additionally, the test environment should handle all requests to `*.flowcrypt.test`. All traffic to `*.flowcrypt.test` should be routed to `localhost (127.0.0.1)`. You can use a DNS server to do this. For example, using these commands:
2020

2121
```bash
22-
1. sudo apt install -y dnsmasq resolvconf
23-
2. echo "#added by flowcrypt" | sudo tee -a /etc/dnsmasq.conf
24-
3. echo "listen-address=127.0.0.1" | sudo tee -a /etc/dnsmasq.conf
25-
4. echo "address=/flowcrypt.test/127.0.0.1" | sudo tee -a /etc/dnsmasq.conf
26-
5. echo "address=/localhost/127.0.0.1" | sudo tee -a /etc/dnsmasq.conf
27-
6. sudo systemctl restart dnsmasq
22+
./script/ci-setup-DNS.sh
2823
```
2924

25+
The script:
26+
- Installs `dnsmasq` and `dnsutils`.
27+
- Creates `/etc/dnsmasq.d/flowcrypt.conf` with local rules for `*.test` and `*.localhost`.
28+
- Sets `no-resolv` with upstream DNS servers (`8.8.8.8` and `1.1.1.1`).
29+
- Sets `/etc/resolv.conf` to `nameserver 127.0.0.1`.
30+
- Restarts `dnsmasq` and verifies resolution with `dig` and `ping`.
31+
3032
### ✔️ Test types
3133

3234
We have two types of tests:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM nginx:1.27-alpine
2+
3+
RUN apk add --no-cache dnsmasq bind-tools iputils
4+
5+
COPY docker/HttpsTestWebServer/nginx.conf /etc/nginx/conf.d/default.conf
6+
7+
COPY FlowCrypt/src/androidTest/resources/ssl/server_combined.pem \
8+
/etc/nginx/certs/server_combined.pem
9+
10+
COPY docker/HttpsTestWebServer/dnsmasq.conf /etc/dnsmasq.d/flowcrypt-test.conf
11+
COPY docker/HttpsTestWebServer/entrypoint.sh /entrypoint.sh
12+
13+
RUN chmod +x /entrypoint.sh
14+
15+
EXPOSE 53/udp 53/tcp 443
16+
17+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
bind-interfaces
2+
listen-address=127.0.0.1
3+
port=53
4+
5+
# Do not read /etc/resolv.conf to avoid recursive localhost DNS loops.
6+
no-resolv
7+
8+
# Upstream DNS for public domains.
9+
server=8.8.8.8
10+
server=1.1.1.1
11+
12+
# Local test domains.
13+
address=/test/127.0.0.1
14+
address=/localhost/127.0.0.1
15+
16+
log-queries
17+
log-facility=-
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
3+
#
4+
# © 2016-present FlowCrypt a.s. Limitations apply. Contact human@flowcrypt.com
5+
# Contributors: denbond7
6+
#
7+
8+
set -e
9+
10+
dnsmasq --no-daemon --conf-file=/etc/dnsmasq.d/flowcrypt-test.conf --log-facility=- &
11+
12+
echo "Configuring resolver to use dnsmasq..."
13+
printf "nameserver 127.0.0.1\n" > /etc/resolv.conf
14+
15+
echo "Checking dnsmasq directly..."
16+
dig @127.0.0.1 fel.localhost +short
17+
dig @127.0.0.1 fel.flowcrypt.test +short
18+
dig @127.0.0.1 www.google.com +short
19+
20+
echo "Checking resolver..."
21+
ping -c 1 fel.localhost
22+
ping -c 1 fel.flowcrypt.test
23+
ping -c 1 www.google.com
24+
25+
exec nginx -g 'daemon off;'

0 commit comments

Comments
 (0)