Skip to content

Conversation

@SaintPatrck
Copy link
Contributor

🎟️ Tracking

PM-28504

📔 Objective

Add GitHub Actions workflow for building the testharness module via manual workflow dispatch.

This PR introduces .github/workflows/build-testharness.yml to enable on-demand testharness APK builds through GitHub Actions, following the established patterns from the app and authenticator build workflows.

Key changes:

  • New workflow: build-testharness.yml with workflow_dispatch trigger for manual builds
  • Dynamic versioning: Integrates with _version.yml reusable workflow (codename: "bwth", base version: 0)
  • Fastlane integration: Uses setBuildVersionInfo for version management consistency
  • Build output: Generates com.bitwarden.testharness.dev-debug.apk with SHA256 checksum
  • Version configuration: Updated testharness/build.gradle.kts to read version from libs.versions.toml instead of hardcoded values

The workflow enables teams to build and distribute testharness artifacts for credential provider testing and validation without requiring local development environment setup.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2025

Logo
Checkmarx One – Scan Summary & Details45b7bff4-3b35-44ac-8839-fee6f8d07656

Great job! No new security vulnerabilities introduced in this pull request

@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.90%. Comparing base (a395f28) to head (e708989).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6181   +/-   ##
=======================================
  Coverage   84.90%   84.90%           
=======================================
  Files         972      972           
  Lines       57423    57423           
  Branches     7916     7916           
=======================================
  Hits        48753    48753           
  Misses       5914     5914           
  Partials     2756     2756           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Base automatically changed from testharness-app to main November 21, 2025 20:01
- 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]>
@SaintPatrck SaintPatrck force-pushed the workflow/build-testharness branch from b1abf12 to 5ee4af1 Compare November 21, 2025 20:08
@SaintPatrck SaintPatrck marked this pull request as ready for review November 21, 2025 20:09
@SaintPatrck SaintPatrck requested a review from a team as a code owner November 21, 2025 20:09
@claude
Copy link
Contributor

claude bot commented Nov 21, 2025

Claude finished @SaintPatrck's task —— View job


Final Review Assessment

Overall Assessment: APPROVE ✅

All findings have been addressed:

  • Finding 1: Regex pattern mismatch - RESOLVED in commit e708989 (now uses .+ pattern matching Fastlane)
  • Finding 2: Missing needs: version dependency - FALSE POSITIVE (correctly declared on line 40)
  • Finding 3: Quality checks before build - INTENTIONAL DESIGN (appropriate for test application)

The PR implements a clean workflow following established patterns from authenticator and app builds. The dynamic versioning integration with _version.yml is properly configured, and the workflow correctly handles version extraction from libs.versions.toml.


SaintPatrck and others added 2 commits November 21, 2025 15:20
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 = "([^"]+)"'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Regex pattern mismatch with Fastlane implementation

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]}"
fi

Fastlane (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"
Copy link
Member

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.

Suggested change
app_codename: "bwth"
app_codename: "bwpm"

@@ -0,0 +1,131 @@
name: Build Test Harness

on:
Copy link
Member

@vvolkgang vvolkgang Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could go ahead and add a push trigger with a path filtering, something like:

Suggested change
on:
on:
push:
paths:
- testharness/**

Copy link
Member

@vvolkgang vvolkgang left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants