-
Notifications
You must be signed in to change notification settings - Fork 912
[PM-28504] Add testharness build workflow with dynamic versioning #6181
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?
Conversation
|
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6181 +/- ##
==========================================
- Coverage 85.41% 84.89% -0.52%
==========================================
Files 755 981 +226
Lines 54105 57476 +3371
Branches 7798 7908 +110
==========================================
+ Hits 46212 48793 +2581
- Misses 5180 5930 +750
- Partials 2713 2753 +40 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
b1abf12 to
5ee4af1
Compare
|
Claude finished @SaintPatrck's task —— View job PR Review CompleteTasks
Quick Answer to SaintPatrck's QuestionQ: "We also need to add A: ✅ Yes, and it's already been added! The file Previous Feedback StatusAll previously requested changes have been addressed:
Comprehensive Review Findings
|
Corrects regex pattern in build-testharness.yml to match the pattern used in build-authenticator.yml. The previous regex captured the closing quote as part of the version name, which would result in malformed version strings. Before: regex='appVersionName = "([^"]+")' → captures "2025.11.1" After: regex='appVersionName = "([^"]+)"' → captures "2025.11.1" Addresses Finding 2 from code review of PR #6181. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Changes testharness module to read versionCode and versionName from libs.versions.toml instead of using hardcoded values. This aligns with the pattern used by app and authenticator modules and ensures the setBuildVersionInfo Fastlane task in the workflow actually updates the testharness build version. Before: versionCode = 1 versionName = "1.0.0" After: versionCode = libs.versions.appVersionCode.get().toInt() versionName = libs.versions.appVersionName.get() Addresses Finding 3 from code review of PR #6181. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
| versionCode:"$VERSION_CODE" \ | ||
| versionName:"$VERSION_NAME_INPUT" | ||
|
|
||
| regex='appVersionName = "([^"]+)"' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Details
The regex pattern here differs from the Fastlane setBuildVersionInfo implementation:
Workflow (line 104-107):
regex='appVersionName = "([^"]+)"'
if [[ "$(cat gradle/libs.versions.toml)" =~ $regex ]]; then
VERSION_NAME="${BASH_REMATCH[1]}"
fiFastlane (Fastfile:136):
currentVersionName = tomlLibraryText.match(/appVersionName = "(.+)"/).captures[0]The workflow pattern uses [^"]+ while Fastlane uses .+. While functionally similar for valid version strings, this inconsistency could cause subtle differences in edge cases (e.g., if version contains escaped quotes).
Recommendation: Use the same pattern as Fastlane for consistency:
regex='appVersionName = "(.+)"'This also resolves the "trailing quote" fix mentioned in commit 98dc73b more elegantly.
Updates workflow regex to match the pattern used in Fastlane's setBuildVersionInfo lane for consistency across the codebase. Before: regex='appVersionName = "([^"]+)"' After: regex='appVersionName = "(.+)"' Both patterns work correctly for standard version strings, but using the same pattern as Fastlane improves maintainability and reduces potential confusion. Addresses Finding 1 from code review of PR #6181. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
| name: Calculate Version Name and Number | ||
| uses: bitwarden/android/.github/workflows/_version.yml@main | ||
| with: | ||
| app_codename: "bwth" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 This will trigger a missing tag warning (code), given the purpose of it having the same version of Password Manager would help also.
| app_codename: "bwth" | |
| app_codename: "bwpm" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to add testharness/ to label-pr.json, right?
vvolkgang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, left some comments.
Corrects regex pattern in build-testharness.yml to match the pattern used in build-authenticator.yml. The previous regex captured the closing quote as part of the version name, which would result in malformed version strings. Before: regex='appVersionName = "([^"]+")' → captures "2025.11.1" After: regex='appVersionName = "([^"]+)"' → captures "2025.11.1" Addresses Finding 2 from code review of PR #6181. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Changes testharness module to read versionCode and versionName from libs.versions.toml instead of using hardcoded values. This aligns with the pattern used by app and authenticator modules and ensures the setBuildVersionInfo Fastlane task in the workflow actually updates the testharness build version. Before: versionCode = 1 versionName = "1.0.0" After: versionCode = libs.versions.appVersionCode.get().toInt() versionName = libs.versions.appVersionName.get() Addresses Finding 3 from code review of PR #6181. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Updates workflow regex to match the pattern used in Fastlane's setBuildVersionInfo lane for consistency across the codebase. Before: regex='appVersionName = "([^"]+)"' After: regex='appVersionName = "(.+)"' Both patterns work correctly for standard version strings, but using the same pattern as Fastlane improves maintainability and reduces potential confusion. Addresses Finding 1 from code review of PR #6181. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
e708989 to
824dcbb
Compare
- Create .github/workflows/build-testharness.yml for manual workflow dispatch - Configure testharness module to read version from libs.versions.toml - Implement Fastlane-based version management for consistency with other build workflows - Build debug APK (com.bitwarden.testharness.dev-debug.apk) with SHA256 checksum - Use _version.yml reusable workflow with codename "bwth" and base version 0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Corrects regex pattern in build-testharness.yml to match the pattern used in build-authenticator.yml. The previous regex captured the closing quote as part of the version name, which would result in malformed version strings. Before: regex='appVersionName = "([^"]+")' → captures "2025.11.1" After: regex='appVersionName = "([^"]+)"' → captures "2025.11.1" Addresses Finding 2 from code review of PR #6181. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Changes testharness module to read versionCode and versionName from libs.versions.toml instead of using hardcoded values. This aligns with the pattern used by app and authenticator modules and ensures the setBuildVersionInfo Fastlane task in the workflow actually updates the testharness build version. Before: versionCode = 1 versionName = "1.0.0" After: versionCode = libs.versions.appVersionCode.get().toInt() versionName = libs.versions.appVersionName.get() Addresses Finding 3 from code review of PR #6181. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Updates workflow regex to match the pattern used in Fastlane's setBuildVersionInfo lane for consistency across the codebase. Before: regex='appVersionName = "([^"]+)"' After: regex='appVersionName = "(.+)"' Both patterns work correctly for standard version strings, but using the same pattern as Fastlane improves maintainability and reduces potential confusion. Addresses Finding 1 from code review of PR #6181. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Adjust the CI/CD configuration for the `testharness` module to ensure proper build triggering and PR labeling.
- **Update `.github/label-pr.json`**: Associate changes in the `testharness/` directory with the `app:password-manager` label, ensuring pull requests touching this module are categorized correctly.
- **Update `.github/workflows/build-testharness.yml`**:
- Add a `push` trigger restricted to paths within `testharness/**`, enabling automatic builds when relevant files change.
- Change the `app_codename` passed to the version calculation workflow from `"bwth"` to `"bwpm"` to align with the Password Manager application context.
Customize the output filename for the test harness APK to match the application ID, ensuring a predictable and consistent naming convention. This change simplifies artifact handling in CI workflows by removing variable build type suffixes from the filename. Specific changes include: * Update `testharness/build.gradle.kts` to iterate through `applicationVariants` and explicitly set the `outputFileName` of each output to `$applicationId.apk`. * Import `BaseVariantOutputImpl` to support the casting required for modifying the output filename. * Update `.github/workflows/build-testharness.yml` to reflect the new APK filename (`com.bitwarden.testharness.dev.apk` instead of `com.bitwarden.testharness.dev-debug.apk`) in both the artifact upload step and the checksum generation step. * Rename the uploaded checksum artifact from `com.bitwarden.testharness.dev-debug.apk-sha256.txt` to `com.bitwarden.testharness.dev.apk-sha256.txt`.
Update the `build-testharness.yml` workflow to use the correct filename when generating the SHA256 checksum for the Test Harness APK. The previous command outputted the checksum to `com.bitwarden.testharness.dev-debug.apk-sha256.txt`, which included an extraneous `-debug` suffix that did not match the expected artifact naming convention. The output file is now correctly named `com.bitwarden.testharness.dev.apk-sha256.txt`.
f96ece5 to
0f5ae6b
Compare

🎟️ Tracking
PM-28504
📔 Objective
Add GitHub Actions workflow for building the testharness module via manual workflow dispatch.
This PR introduces
.github/workflows/build-testharness.ymlto enable on-demand testharness APK builds through GitHub Actions, following the established patterns from the app and authenticator build workflows.Key changes:
build-testharness.ymlwith workflow_dispatch trigger for manual builds_version.ymlreusable workflow (codename: "bwth", base version: 0)setBuildVersionInfofor version management consistencycom.bitwarden.testharness.dev-debug.apkwith SHA256 checksumtestharness/build.gradle.ktsto read version fromlibs.versions.tomlinstead of hardcoded valuesThe workflow enables teams to build and distribute testharness artifacts for credential provider testing and validation without requiring local development environment setup.
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes