generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 54
[PM-15905] feat: Restructure build info output #1193
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
77dabfa
Condense build info copied when user taps the version in about screen
vvolkgang a408410
Use KeyValuePair to keep the order set in ci build script
vvolkgang 5eeb1ad
Remove empty Compiler Flags by filtering empty values
vvolkgang 164c782
Add action run url var in build.yml. This link in release notes will β¦
vvolkgang 3aeb88c
Update build info script to improve readability outside of github
vvolkgang aa364bb
Update device info
vvolkgang 848f2af
Fix unit tests
vvolkgang 0056ea6
Add unit test for filtered values
vvolkgang 30b568f
Merge branch 'main' into refactor-build-info
vvolkgang fc80a0b
Fix unit tests
vvolkgang 64596e1
Add build variant to build info
vvolkgang 7da71ed
Use existing github env vars
vvolkgang 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
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
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 |
---|---|---|
@@ -1,47 +1,47 @@ | ||
#!/bin/sh | ||
# CI Build Info Updater | ||
# | ||
# Updates the CIBuildInfo.swift file to add any additional info we need from the CI build. | ||
# Updates the CIBuildInfo.swift file with additional info from the CI build. | ||
# | ||
# Usage: | ||
# | ||
# $ ./update_app_ci_build_info.sh <ci_run_id> <ci_run_number> <ci_run_attempt> "<compiler_flags>" | ||
# Prerequisites: | ||
# - Git command line tools installed | ||
# - Write access to CIBuildInfo.swift file | ||
|
||
set -euo pipefail | ||
|
||
if [ $# -lt 3 ]; then | ||
echo >&2 "Called without necessary arguments." | ||
echo >&2 "For example: \`Scripts/update_app_ci_build_info.sh 123123 111 1 \"DEBUG_MENU FEATURE1\"\`" | ||
exit 1 | ||
if [ $# -ne 6 ]; then | ||
echo >&2 "Called with $# arguments but expected 6." | ||
echo "Usage: $0 <repository> <branch> <commit_hash> <ci_run_number> <ci_run_attempt> <compiler_flags>" | ||
echo "E.g: $0 bitwarden/ios main abc123 1234567890 1 \"DEBUG_MENU FEATURE1\"" | ||
exit 1 | ||
fi | ||
|
||
ci_run_id=$1 | ||
ci_run_number=$2 | ||
ci_run_attempt=$3 | ||
compiler_flags=${4:-''} | ||
set -euo pipefail | ||
|
||
repository=$1 | ||
branch=$2 | ||
commit_hash=$3 | ||
ci_run_number=$4 | ||
ci_run_attempt=$5 | ||
compiler_flags=${6:-''} | ||
|
||
ci_build_info_file="BitwardenShared/Core/Platform/Utilities/CIBuildInfo.swift" | ||
repository=$(git config --get remote.origin.url) | ||
branch=$(git branch --show-current) | ||
commit_hash=$(git rev-parse --verify HEAD) | ||
git_source="${repository}/${branch}@${commit_hash}" | ||
ci_run_source="${repository}/actions/runs/${ci_run_number}/attempts/${ci_run_attempt}" | ||
|
||
echo "π§± Updating app CI Build info..." | ||
echo "π§± CI run ID: ${ci_run_id}" | ||
echo "π§± CI run number: ${ci_run_number}" | ||
echo "π§± CI run attempt: ${ci_run_attempt}" | ||
echo "π§± Compiler Flags: ${compiler_flags}" | ||
echo "π§± π§±${git_source}" | ||
echo "π§± π»${ci_run_source}" | ||
echo "π§± π οΈ ${compiler_flags}" | ||
|
||
|
||
cat << EOF > ${ci_build_info_file} | ||
enum CIBuildInfo { | ||
static let info: [String: String] = [ | ||
"Repository": "${repository}", | ||
"Branch": "${branch}", | ||
"Commit hash": "${commit_hash}", | ||
"CI Run ID": "${ci_run_id}", | ||
"CI Run Number": "${ci_run_number}", | ||
"CI Run Attempt": "${ci_run_attempt}", | ||
"Compiler Flags": "${compiler_flags}", | ||
static let info: KeyValuePairs<String, String> = [ | ||
"π§± commit:": "${git_source}", | ||
"π» build source:": "${ci_run_source}", | ||
"π οΈ compiler flags:": "${compiler_flags}", | ||
] | ||
} | ||
EOF | ||
|
||
echo "β CI Build info updated successfully." |
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.
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.
π€ I guess we do actually want these in a consistent order each time, huh.