-
Notifications
You must be signed in to change notification settings - Fork 912
[QA-1126] Adding sanity check against real devices for Prod builds #5526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 41 commits
815c739
ed5b752
5b012e1
a6ef2ea
047b762
2af019e
6181378
772245c
a2ed706
2856545
58c98fa
a44a8dc
b0fb071
26cb4ce
a371efb
b8172f9
4b2f0da
6b2ac29
22644ab
5fc3c02
e9afd92
a6bd9b6
c6f8fe2
9a724d8
a5721f3
e20c814
7bedb1f
85f0bd9
d3d02f4
cab4461
9474133
47a9117
7dc5b99
909b0d0
bbd7e7c
6be753b
62b9088
7a98555
c4ebde7
be325eb
b6e90e4
b1a74c6
a6efb31
b74d3b1
ab481d2
f803752
bb8dda4
12edccc
15b5b86
da9b60f
9bf3d1e
0aafc52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,12 +5,155 @@ on: | |
|
|
||
| permissions: | ||
| contents: read | ||
| actions: read | ||
| checks: write | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| id-token: write | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Test Device | ||
| test-device: | ||
| name: Check main build against real devices | ||
| runs-on: ubuntu-24.04 | ||
| env: | ||
| _JAVA_VERSION: 17 | ||
| _GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| steps: | ||
| - name: Placeholder step | ||
| run: echo "Placeholder workflow step" | ||
| - name: Check out repo | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Validate Gradle wrapper | ||
| uses: gradle/actions/wrapper-validation@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.1 | ||
|
|
||
| - name: Cache Gradle files | ||
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-v2-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle-v2- | ||
|
|
||
| - name: Cache build output | ||
| uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 | ||
| with: | ||
| path: ${{ github.workspace }}/build-cache | ||
| key: ${{ runner.os }}-build-cache-${{ github.sha }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-build- | ||
|
|
||
| - name: Configure JDK | ||
| uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 | ||
| with: | ||
| distribution: "temurin" | ||
| java-version: ${{ env.JAVA_VERSION }} | ||
|
|
||
| - name: Configure Ruby | ||
| uses: ruby/setup-ruby@ca041f971d66735f3e5ff1e21cc13e2d51e7e535 # v1.233.0 | ||
| with: | ||
| bundler-cache: true | ||
|
|
||
| - name: Install Fastlane | ||
| run: | | ||
| gem install bundler:2.2.27 | ||
| bundle config path vendor/bundle | ||
| bundle install --jobs 4 --retry 3 | ||
|
|
||
| - name: Install saucectl | ||
| run: | | ||
| npm i -g saucectl | ||
|
|
||
| - name: Log in to Azure | ||
| uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 | ||
| with: | ||
| creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} | ||
|
|
||
| - name: Retrieve secrets | ||
| env: | ||
| ACCOUNT_NAME: bitwardenci | ||
| CONTAINER_NAME: mobile | ||
| run: | | ||
| mkdir -p ${{ github.workspace }}/secrets | ||
| mkdir -p ${{ github.workspace }}/app/src/standardRelease | ||
|
|
||
| az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \ | ||
| --name app_play-keystore.jks --file ${{ github.workspace }}/keystores/app_play-keystore.jks --output none | ||
| az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME \ | ||
| --name google-services.json --file ${{ github.workspace }}/app/src/standardRelease/google-services.json --output none | ||
|
|
||
| - name: Log in to Azure | ||
| uses: bitwarden/gh-actions/azure-login@main | ||
| with: | ||
| subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
| tenant_id: ${{ secrets.AZURE_TENANT_ID }} | ||
| client_id: ${{ secrets.AZURE_CLIENT_ID }} | ||
|
|
||
| - name: Get E2E secrets from Azure | ||
| uses: bitwarden/gh-actions/get-keyvault-secrets@main | ||
| with: | ||
| keyvault: gh-android | ||
| secrets: "BWS-ACCESS-TOKEN, SAUCE-LABS-USERNAME, SAUCE-LABS-ACCESS-KEY" | ||
| id: get-e2e-secrets | ||
|
|
||
| - name: Log out from Azure | ||
| uses: bitwarden/gh-actions/azure-logout@main | ||
|
|
||
| - name: Retrieve test data | ||
| uses: bitwarden/sm-action@14f92f1d294ae3c2b6a3845d389cd2c318b0dfd8 # v2.2.0 | ||
| with: | ||
| access_token: ${{ steps.get-e2e-secrets.outputs.BWS-ACCESS-TOKEN }} | ||
| secrets: | | ||
| 63e93f73-5118-4a62-9db8-b3160176aa8a > TEST_ACCOUNT_CREDS | ||
|
|
||
| - name: Configure .json test data file | ||
| run: printf %s '${{ env.TEST_ACCOUNT_CREDS }}' > app/src/androidTest/assets/TestData.json | ||
|
|
||
| - name: Build release APK | ||
| env: | ||
| PLAY_KEYSTORE_PASSWORD: ${{ secrets.PLAY_KEYSTORE_PASSWORD }} | ||
| run: | | ||
| bundle exec fastlane assemblePlayStoreReleaseApk \ | ||
| storeFile:app_play-keystore.jks \ | ||
| storePassword:'${{ env.PLAY_KEYSTORE_PASSWORD }}' \ | ||
| keyAlias:bitwarden \ | ||
| keyPassword:'${{ env.PLAY_KEYSTORE_PASSWORD }}' | ||
|
|
||
| - name: Build test APK (espresso) | ||
| run: | | ||
| ./gradlew :app:assembleStandardReleaseAndroidTest | ||
|
|
||
| - name: Signing test APK | ||
| run: | | ||
| $ANDROID_SDK_ROOT/build-tools/34.0.0/apksigner sign \ | ||
| --ks keystores/app_play-keystore.jks \ | ||
| --ks-key-alias bitwarden \ | ||
| --ks-pass pass:${{ secrets.PLAY_KEYSTORE_PASSWORD }} \ | ||
| --key-pass pass:${{ secrets.PLAY_KEYSTORE_PASSWORD }} \ | ||
| app/build/outputs/apk/androidTest/standard/release/com.x8bit.bitwarden-standard-release-androidTest.apk | ||
|
|
||
| - name: Upload app APK to SauceLabs storage | ||
| run: | | ||
| saucectl storage upload app/build/outputs/apk/standard/release/com.x8bit.bitwarden.apk | ||
| env: | ||
| SAUCE_USERNAME: ${{ steps.get-e2e-secrets.outputs.SAUCE-LABS-USERNAME }} | ||
| SAUCE_ACCESS_KEY: ${{ steps.get-e2e-secrets.outputs.SAUCE-LABS-ACCESS-KEY }} | ||
|
|
||
| - name: Upload test APK to SauceLabs storage | ||
| run: | | ||
| saucectl storage upload app/build/outputs/apk/androidTest/standard/release/com.x8bit.bitwarden-standard-release-androidTest.apk | ||
| env: | ||
| SAUCE_USERNAME: ${{ steps.get-e2e-secrets.outputs.SAUCE-LABS-USERNAME }} | ||
| SAUCE_ACCESS_KEY: ${{ steps.get-e2e-secrets.outputs.SAUCE-LABS-ACCESS-KEY }} | ||
|
|
||
| - name: Run tests on SauceLabs | ||
| run: saucectl run --config .sauce/config.yml | ||
| env: | ||
| SAUCE_USERNAME: ${{ steps.get-e2e-secrets.outputs.SAUCE-LABS-USERNAME }} | ||
| SAUCE_ACCESS_KEY: ${{ steps.get-e2e-secrets.outputs.SAUCE-LABS-ACCESS-KEY }} | ||
|
|
||
| - name: Upload SauceLabs test report | ||
| if: always() | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| with: | ||
| name: saucectl-report | ||
| path: saucectl-report.xml | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| apiVersion: v1alpha | ||
| kind: espresso | ||
| defaults: | ||
| timeout: 10m | ||
| sauce: | ||
| region: us-west-1 | ||
| # Controls how many suites are executed at the same time (sauce test env only). | ||
| concurrency: 1 | ||
| retries: 1 | ||
| visibility: team | ||
| metadata: | ||
| tags: | ||
| - Android | ||
| - sanity-e2e | ||
| build: Sanity check on Real devices | ||
| reporters: | ||
| junit: | ||
| enabled: true | ||
| filename: saucectl-report.xml | ||
| espresso: | ||
| app: storage:filename=com.x8bit.bitwarden.apk | ||
| testApp: storage:filename=com.x8bit.bitwarden-standard-release-androidTest.apk | ||
| suites: | ||
| - name: "Android - Sanity" | ||
| devices: | ||
| - name: "Google.*" | ||
| platformVersion: "^1[3456].*" | ||
| options: | ||
| deviceType: PHONE | ||
| testOptions: | ||
| package: e2e.tests | ||
| resigningEnabled: false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,6 +47,8 @@ android { | |
| namespace = "com.x8bit.bitwarden" | ||
| compileSdk = libs.versions.compileSdk.get().toInt() | ||
|
|
||
| testBuildType = "release" | ||
ifernandezdiaz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| room { | ||
| schemaDirectory("$projectDir/schemas") | ||
| } | ||
|
|
@@ -248,6 +250,10 @@ dependencies { | |
| implementation(libs.androidx.lifecycle.runtime.compose) | ||
| implementation(libs.androidx.lifecycle.runtime.ktx) | ||
| implementation(libs.androidx.navigation.compose) | ||
| implementation(libs.androidx.uiautomator) | ||
| implementation(libs.androidx.espresso.core) | ||
| implementation(libs.androidx.junit.ktx) | ||
| implementation(libs.androidx.ui.test.junit4.android) | ||
|
Comment on lines
+259
to
+262
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we remove these as
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For some reason, the build fails if I remove those dependencies ๐ค
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think he want's them to be an
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, but those deps are already present as
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ๐ค We do not want to ship with unnecessary dependencies like this. Is there a specific error you are seeing?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't find a way to build the required testApp without those deps ๐ซค
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we need a new variant for this. |
||
| ksp(libs.androidx.room.compiler) | ||
| implementation(libs.androidx.room.ktx) | ||
| implementation(libs.androidx.room.runtime) | ||
|
|
@@ -284,7 +290,6 @@ dependencies { | |
| testImplementation(testFixtures(project(":network"))) | ||
| testImplementation(testFixtures(project(":ui"))) | ||
|
|
||
| testImplementation(libs.androidx.compose.ui.test) | ||
| testImplementation(libs.google.hilt.android.testing) | ||
| testImplementation(platform(libs.junit.bom)) | ||
| testRuntimeOnly(libs.junit.platform.launcher) | ||
|
|
@@ -294,6 +299,11 @@ dependencies { | |
| testImplementation(libs.mockk.mockk) | ||
| testImplementation(libs.robolectric.robolectric) | ||
| testImplementation(libs.square.turbine) | ||
| androidTestImplementation(libs.androidx.uiautomator) | ||
| androidTestImplementation(libs.androidx.espresso.core) | ||
| androidTestImplementation(libs.androidx.junit.ktx) | ||
| androidTestImplementation(libs.androidx.ui.test.junit4.android) | ||
| androidTestImplementation(libs.androidx.compose.ui.test) | ||
ifernandezdiaz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| tasks { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.