-
Notifications
You must be signed in to change notification settings - Fork 27
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
[PM-9375] Build a debug-for-simulator version of the app for easier automated testing #1151
base: main
Are you sure you want to change the base?
Changes from all commits
505678c
da86f7a
445bdf8
ae5e2fd
0bab9cd
e3d7e04
2108361
815b690
47896a5
9bdb6f6
3a1ee75
718287b
0e6502b
43cf693
d9577a3
b9e1802
d7aac49
c3d4098
6b7a638
fb6019b
8b619af
6941e77
9289566
8768c8d
460d931
b5acb08
a62d201
ab2431f
3956e3d
5ca715c
f6c06fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,14 @@ on: | |
options: | ||
- Beta | ||
- Production | ||
build-mode: | ||
description: "Build Mode" | ||
required: true | ||
default: "Device" | ||
type: choice | ||
options: | ||
- Device | ||
- Simulator | ||
vvolkgang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
build-version: | ||
description: "Version Name Override - e.g. '2024.8.1'" | ||
type: string | ||
|
@@ -39,6 +47,9 @@ on: | |
build-variant: | ||
description: "Build Variant" | ||
type: string | ||
build-mode: | ||
description: "Build Mode" | ||
type: string | ||
build-version: | ||
description: "Version Name Override - e.g. '2024.8.1'" | ||
type: string | ||
|
@@ -66,6 +77,7 @@ on: | |
type: boolean | ||
env: | ||
BUILD_VARIANT: ${{ inputs.build-variant || 'Beta' }} | ||
BUILD_MODE: ${{ inputs.build-mode || 'Device' }} | ||
XCODE_VERSION: ${{ inputs.xcode-version }} | ||
|
||
jobs: | ||
|
@@ -152,18 +164,20 @@ jobs: | |
${{ runner.os }}-mint- | ||
|
||
- name: Log in to Azure | ||
if: env.BUILD_MODE == 'Device' | ||
uses: Azure/login@cb79c773a3cfa27f31f25eb3f677781210c9ce3d # v1.6.1 | ||
with: | ||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} | ||
|
||
- name: Retrieve secrets | ||
if: env.BUILD_MODE == 'Device' | ||
uses: bitwarden/gh-actions/get-keyvault-secrets@main | ||
with: | ||
keyvault: "bitwarden-ci" | ||
secrets: "appcenter-ios-token" | ||
|
||
- name: Retrieve production provisioning profiles | ||
if: env.BUILD_VARIANT == 'Production' | ||
if: env.BUILD_VARIANT == 'Production' && env.BUILD_MODE == 'Device' | ||
env: | ||
ACCOUNT_NAME: bitwardenci | ||
CONTAINER_NAME: profiles | ||
|
@@ -186,7 +200,7 @@ jobs: | |
done | ||
|
||
- name: Retrieve beta provisioning profiles | ||
if: env.BUILD_VARIANT == 'Beta' | ||
if: env.BUILD_VARIANT == 'Beta' && env.BUILD_MODE == 'Device' | ||
env: | ||
ACCOUNT_NAME: bitwardenci | ||
CONTAINER_NAME: profiles | ||
|
@@ -209,7 +223,7 @@ jobs: | |
done | ||
|
||
- name: Retrieve production Google Services secret | ||
if: env.BUILD_VARIANT == 'Production' | ||
if: env.BUILD_VARIANT == 'Production' && env.BUILD_MODE == 'Device' | ||
env: | ||
ACCOUNT_NAME: bitwardenci | ||
CONTAINER_NAME: mobile | ||
|
@@ -221,7 +235,7 @@ jobs: | |
--file Bitwarden/Application/Support/$TARGET_FILE --output none | ||
|
||
- name: Retrieve watch production Google Services secret | ||
if: env.BUILD_VARIANT == 'Production' | ||
if: env.BUILD_VARIANT == 'Production' && env.BUILD_MODE == 'Device' | ||
env: | ||
ACCOUNT_NAME: bitwardenci | ||
CONTAINER_NAME: mobile | ||
|
@@ -234,7 +248,7 @@ jobs: | |
plutil -replace BUNDLE_ID -string com.8bit.bitwarden.watchkitapp BitwardenWatchApp/$TARGET_FILE | ||
|
||
- name: Retrieve beta Google Services secret | ||
if: env.BUILD_VARIANT == 'Beta' | ||
if: env.BUILD_VARIANT == 'Beta' && env.BUILD_MODE == 'Device' | ||
env: | ||
ACCOUNT_NAME: bitwardenci | ||
CONTAINER_NAME: mobile | ||
|
@@ -246,7 +260,7 @@ jobs: | |
--file Bitwarden/Application/Support/$TARGET_FILE --output none | ||
|
||
- name: Retrieve watch beta Google Services secret | ||
if: env.BUILD_VARIANT == 'Beta' | ||
if: env.BUILD_VARIANT == 'Beta' && env.BUILD_MODE == 'Device' | ||
env: | ||
ACCOUNT_NAME: bitwardenci | ||
CONTAINER_NAME: mobile | ||
|
@@ -259,12 +273,14 @@ jobs: | |
plutil -replace BUNDLE_ID -string com.8bit.bitwarden.beta.watchkitapp BitwardenWatchApp/$TARGET_FILE | ||
|
||
- name: Retrieve certificates | ||
if: env.BUILD_MODE == 'Device' | ||
run: | | ||
mkdir -p $HOME/certificates | ||
az keyvault secret show --id https://bitwarden-ci.vault.azure.net/certificates/ios-distribution | | ||
jq -r .value | base64 -d > $HOME/certificates/ios-distribution.p12 | ||
|
||
- name: Download Fastlane credentials | ||
if: env.BUILD_MODE == 'Device' | ||
env: | ||
ACCOUNT_NAME: bitwardenci | ||
CONTAINER_NAME: mobile | ||
|
@@ -275,6 +291,7 @@ jobs: | |
--file $HOME/secrets/$FILE --output none | ||
|
||
- name: Configure Keychain Access | ||
if: env.BUILD_MODE == 'Device' | ||
env: | ||
KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }} | ||
run: | | ||
|
@@ -288,6 +305,7 @@ jobs: | |
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain | ||
|
||
- name: Configure provisioning profiles | ||
if: env.BUILD_MODE != 'Simulator' | ||
run: | | ||
./Scripts/configure_provisioning_profiles.sh ${{ env.BUILD_VARIANT }} | ||
|
||
|
@@ -302,6 +320,7 @@ jobs: | |
echo 'app_identifier "com.8bit.bitwarden.beta"' > fastlane/Appfile | ||
|
||
- name: Update APNS entitlements | ||
if: env.BUILD_MODE != 'Simulator' | ||
run: | | ||
plutil -replace aps-environment -string production Bitwarden/Application/Support/Bitwarden.entitlements | ||
|
||
|
@@ -310,10 +329,18 @@ jobs: | |
with: | ||
bundler-cache: true | ||
|
||
- name: Install Fastlane, Mint | ||
- name: Update homebrew | ||
run: | | ||
brew update | ||
brew install fastlane mint | ||
|
||
- name: Install Fastlane | ||
if: env.BUILD_MODE != 'Simulator' | ||
run: | | ||
brew install fastlane | ||
|
||
- name: Install Mint | ||
run: | | ||
brew install mint | ||
|
||
- name: Install Mint packages | ||
if: steps.mint-cache.outputs.cache-hit != 'true' | ||
|
@@ -335,29 +362,50 @@ jobs: | |
|
||
- name: Build iOS app | ||
run: | | ||
./Scripts/build.sh | ||
./Scripts/build.sh ${{ env.BUILD_MODE }} | ||
|
||
- name: Prepare IPA & dSYM files for upload to GitHub | ||
- name: Prepare artifacts for upload to GitHub | ||
run: | | ||
if [ "$BUILD_MODE" == "Simulator" ]; then | ||
app_path="build/DerivedData/Build/Products/Debug-iphonesimulator/Bitwarden.app" | ||
watchapp_path="build/DerivedData/Build/Products/Debug-watchsimulator/BitwardenWatchApp.app" | ||
#dsym_path="build/DerivedData/Build/Products/Debug-iphonesimulator/Bitwarden.app/dSYMs/*.dSYM" | ||
else | ||
app_path="build/Bitwarden/Bitwarden.ipa" | ||
dsym_path="build/Bitwarden.xcarchive/dSYMs/*.dSYM" | ||
fi | ||
|
||
mkdir -p export | ||
mkdir -p export/dSYMs | ||
cp build/Bitwarden/Bitwarden.ipa export | ||
cp -rv build/Bitwarden.xcarchive/dSYMs/*.dSYM export/dSYMs | ||
|
||
- name: Upload IPA & dSYM files | ||
zip -r "export/$(basename "$app_path").zip" "$app_path" | ||
cp $dsym_path export/dSYMs | ||
zip -r "export/dSYMs.zip" "export/dSYMs" | ||
|
||
if [ "$BUILD_MODE" == "Simulator" ]; then | ||
zip -r "export/$(basename "$watchapp_path").zip" "$watchapp_path" | ||
else | ||
# Copy uncompressed .ipa file.Required for App Store Connect upload step | ||
cp $app_path export/ | ||
fi | ||
|
||
- name: Upload artifacts to GitHub | ||
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | ||
with: | ||
name: Bitwarden iOS ${{ steps.version_info.outputs.version_name }} (${{ steps.version_info.outputs.version_number }}) ${{ env.BUILD_VARIANT }} ${{ env.XCODE_VERSION || env.DEFAULT_XCODE_VERSION }} | ||
path: export | ||
if-no-files-found: error | ||
|
||
- name: Set up private auth key | ||
if: env.BUILD_MODE != 'Simulator' | ||
run: | | ||
mkdir ~/private_keys | ||
cat << EOF > ~/private_keys/AuthKey_J46C83CB96.p8 | ||
${{ secrets.APP_STORE_CONNECT_AUTH_KEY }} | ||
EOF | ||
|
||
- name: Validate app with App Store Connect | ||
if: env.BUILD_MODE != 'Simulator' | ||
run: | | ||
xcrun altool --validate-app \ | ||
--type ios \ | ||
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 can't add a comment in the right place but, in the "Upload app to Testflight" step, we need to gate it behind BUILD_MODE too for manually triggered builds ๐ข |
||
|
@@ -366,7 +414,7 @@ jobs: | |
--apiIssuer "${{ secrets.APP_STORE_CONNECT_TEAM_ISSUER }}" | ||
|
||
- name: Upload app to TestFlight with Fastlane | ||
if: ${{ inputs.distribute }} | ||
if: ${{ inputs.distribute && env.BUILD_MODE == 'Device' }} | ||
run: | | ||
CHANGELOG="$(git show -s --format=%s) | ||
$GITHUB_REPOSITORY/$GITHUB_REF_NAME @ $GITHUB_SHA | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,83 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Builds the beta Bitwarden iOS app, and outputs an IPA file that can be uploaded to TestFlight. | ||
# Builds the Bitwarden iOS app. | ||
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. ๐ค This probably needs to be updated to remove references to build variants, and add the expected values for Build Mode (device / simulator). E.g.
|
||
# If run in Simulator mode, produces an APP file for the iOS Simulator for ease of automated testing. | ||
# If run in Device mode, produces an IPA file that can be uploaded to Testflight. | ||
# | ||
# Usage: | ||
# | ||
# $ ./build.sh | ||
# $ ./build.sh <build_mode> | ||
# | ||
# Where mode is one of: | ||
# - Device: Build for physical iOS devices | ||
# - Simulator: Build for iOS Simulator | ||
|
||
set -euo pipefail | ||
|
||
bold=$(tput -T ansi bold) | ||
normal=$(tput -T ansi sgr0) | ||
|
||
BUILD_DIR="build" | ||
if [ $# -lt 1 ]; then | ||
echo >&2 "Called without necessary arguments: ${bold}mode${normal}" | ||
echo >&2 "For example: \`Scripts/build.sh Simulator" | ||
exit 1 | ||
fi | ||
|
||
MODE=$1 | ||
|
||
BUILD_DIR="build" | ||
DERIVED_DATA_PATH="${BUILD_DIR}/DerivedData" | ||
ARCHIVE_PATH="${BUILD_DIR}/Bitwarden.xcarchive" | ||
EXPORT_PATH="${BUILD_DIR}/Bitwarden" | ||
|
||
echo "๐งฑ Building in $(pwd)" | ||
echo "๐งฑ Building in ${bold}$(pwd)${normal}" | ||
echo "๐งฑ Using build mode of ${bold}${MODE}${normal}." | ||
echo "๐งฑ Derived Data path ${bold}${DERIVED_DATA_PATH}${normal}" | ||
echo "๐งฑ Archive path ${bold}${ARCHIVE_PATH}${normal}" | ||
echo "๐งฑ Export path ${bold}${EXPORT_PATH}${normal}" | ||
echo "" | ||
|
||
echo "๐ฑ Generating xcode project" | ||
echo "๐ฑ Generating Xcode project" | ||
mint run xcodegen | ||
echo "" | ||
|
||
mkdir -p "${BUILD_DIR}" | ||
|
||
echo "๐จ Performing Xcode archive" | ||
xcrun xcodebuild archive \ | ||
-project Bitwarden.xcodeproj \ | ||
-scheme Bitwarden \ | ||
-configuration Release \ | ||
-archivePath "${ARCHIVE_PATH}" \ | ||
| xcbeautify --renderer github-actions | ||
echo "" | ||
case "$MODE" in | ||
"Simulator") | ||
echo "๐จ Performing Xcode build" | ||
xcrun xcodebuild \ | ||
-project Bitwarden.xcodeproj \ | ||
-scheme Bitwarden \ | ||
-configuration Debug \ | ||
-destination "generic/platform=iOS Simulator" \ | ||
-derivedDataPath "${DERIVED_DATA_PATH}" \ | ||
| xcbeautify --renderer github-actions | ||
;; | ||
"Device") | ||
echo "๐ฆ Performing Xcode archive" | ||
xcrun xcodebuild archive \ | ||
-project Bitwarden.xcodeproj \ | ||
-scheme Bitwarden \ | ||
-configuration Release \ | ||
-derivedDataPath "${DERIVED_DATA_PATH}" \ | ||
-archivePath "${ARCHIVE_PATH}" \ | ||
| xcbeautify --renderer github-actions | ||
|
||
echo "๐ฆ Performing Xcode archive export" | ||
xcrun xcodebuild -exportArchive \ | ||
-archivePath "${ARCHIVE_PATH}" \ | ||
-exportPath "${EXPORT_PATH}" \ | ||
-exportOptionsPlist "Configs/export_options.plist" \ | ||
| xcbeautify --renderer github-actions | ||
echo "๐ Performing Xcode archive export" | ||
xcrun xcodebuild -exportArchive \ | ||
-archivePath "${ARCHIVE_PATH}" \ | ||
-derivedDataPath "${DERIVED_DATA_PATH}" \ | ||
-exportPath "${EXPORT_PATH}" \ | ||
-exportOptionsPlist "Configs/export_options.plist" \ | ||
| xcbeautify --renderer github-actions | ||
;; | ||
*) | ||
echo >&2 "Invalid build mode: ${bold}${MODE}${normal}" | ||
echo >&2 "Must be one of: Simulator, Device" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
echo "" | ||
echo "๐ Build complete" |
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.
Simulator builds shouldn't be distributed to testflight.
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.
Ah, good call. Might as well hard code that.