-
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
Open
SaintPatrck
wants to merge
7
commits into
main
Choose a base branch
from
workflow/build-testharness
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
812288b
[PM-28504] Add testharness build workflow with dynamic versioning
SaintPatrck 7446c89
Fix version extraction regex to exclude trailing quote
SaintPatrck d87c403
Update testharness to read version from libs.versions.toml
SaintPatrck 70747c3
Align version extraction regex with Fastlane pattern
SaintPatrck a36f801
Update testharness build triggers and labeling configuration
SaintPatrck fbc3a31
Update test harness APK filename generation and artifact paths
SaintPatrck 0f5ae6b
Fix checksum filename for Test Harness APK
SaintPatrck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| name: Build Test Harness | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - testharness/** | ||
| workflow_dispatch: | ||
| inputs: | ||
| version-name: | ||
| description: "Optional. Version string to use, in X.Y.Z format. Overrides default in the project." | ||
| required: false | ||
| type: string | ||
| version-code: | ||
| description: "Optional. Build number to use. Overrides default of GitHub run number." | ||
| required: false | ||
| type: number | ||
| patch_version: | ||
| description: "Order 999 - Overrides Patch version" | ||
| type: boolean | ||
|
|
||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| JAVA_VERSION: 21 | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: read | ||
|
|
||
| jobs: | ||
| version: | ||
| name: Calculate Version Name and Number | ||
| uses: bitwarden/android/.github/workflows/_version.yml@main | ||
| with: | ||
| app_codename: "bwpm" | ||
| base_version_number: 0 | ||
| version_name: ${{ inputs.version-name }} | ||
| version_number: ${{ inputs.version-code }} | ||
| patch_version: ${{ inputs.patch_version && '999' || '' }} | ||
|
|
||
| build: | ||
SaintPatrck marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| name: Build Test Harness | ||
| runs-on: ubuntu-24.04 | ||
| needs: version | ||
SaintPatrck marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| steps: | ||
| - name: Log inputs to job summary | ||
| uses: bitwarden/android/.github/actions/log-inputs@main | ||
| with: | ||
| inputs: "${{ toJson(inputs) }}" | ||
|
|
||
| - name: Check out repo | ||
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Validate Gradle wrapper | ||
| uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 | ||
|
|
||
| - name: Cache Gradle files | ||
| uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | ||
| 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@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4 | ||
| 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@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 | ||
| with: | ||
| distribution: "temurin" | ||
| java-version: ${{ env.JAVA_VERSION }} | ||
|
|
||
| - name: Configure Ruby | ||
| uses: ruby/setup-ruby@44511735964dcb71245e7e55f72539531f7bc0eb # v1.257.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: Increment version | ||
| env: | ||
| DEFAULT_VERSION_CODE: ${{ github.run_number }} | ||
| INPUT_VERSION_CODE: "${{ needs.version.outputs.version_number }}" | ||
| INPUT_VERSION_NAME: ${{ needs.version.outputs.version_name }} | ||
| run: | | ||
| VERSION_CODE="${INPUT_VERSION_CODE:-$DEFAULT_VERSION_CODE}" | ||
| VERSION_NAME_INPUT="${INPUT_VERSION_NAME:-}" | ||
| bundle exec fastlane setBuildVersionInfo \ | ||
| versionCode:"$VERSION_CODE" \ | ||
| versionName:"$VERSION_NAME_INPUT" | ||
|
|
||
| regex='appVersionName = "(.+)"' | ||
| if [[ "$(cat gradle/libs.versions.toml)" =~ $regex ]]; then | ||
| VERSION_NAME="${BASH_REMATCH[1]}" | ||
| fi | ||
| echo "Version Name: ${VERSION_NAME}" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "Version Number: $VERSION_CODE" >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| - name: Build Test Harness Debug APK | ||
| run: ./gradlew :testharness:assembleDebug | ||
SaintPatrck marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Upload Test Harness APK | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| with: | ||
| name: com.bitwarden.testharness.dev-debug.apk | ||
| path: testharness/build/outputs/apk/debug/com.bitwarden.testharness.dev.apk | ||
| if-no-files-found: error | ||
|
|
||
| - name: Create checksum for Test Harness APK | ||
| run: | | ||
| sha256sum "testharness/build/outputs/apk/debug/com.bitwarden.testharness.dev.apk" \ | ||
| > ./com.bitwarden.testharness.dev.apk-sha256.txt | ||
|
|
||
| - name: Upload Test Harness SHA file | ||
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | ||
| with: | ||
| name: com.bitwarden.testharness.dev.apk-sha256.txt | ||
| path: ./com.bitwarden.testharness.dev.apk-sha256.txt | ||
| if-no-files-found: error | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.