Skip to content

feat: create new dev-orange variant #855

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 7 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/android-dev-orange-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Android dev-orange deploy

on:
workflow_dispatch:
pull_request:
types:
- synchronize
- labeled
schedule:
- cron: "45 16 * * MON"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
name: Check if build is necessary
runs-on: ubuntu-latest
steps:
- id: check
name: Check
run: |
if ${{ github.event_name == 'schedule' }}; then
echo "should-run=$(gh pr list --label 'deploy to android dev-orange' --json id --jq 'length == 0')" | tee -a "$GITHUB_OUTPUT"
elif ${{ github.event_name == 'pull_request' }}; then
echo "should-run=${{ contains(github.event.pull_request.labels.*.name, 'deploy to android dev-orange') }}" | tee -a "$GITHUB_OUTPUT"
else
echo "should-run=true" | tee -a "$GITHUB_OUTPUT"
fi
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
should-run: ${{ steps.check.outputs.should-run }}
build-android:
name: Build for Android
needs: check
if: ${{ needs.check.outputs.should-run == 'true' }}
permissions:
id-token: write
contents: read
pull-requests: write
uses: ./.github/workflows/build-android.yaml
with:
build-type: "Release"
deploy: true
flavor: "DevOrange"
sentry-environment: "dev-orange"
secrets:
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
FIREBASE_KEY: ${{ secrets.FIREBASE_KEY }}
GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }}
GOOGLE_APP_ID_ANDROID: ${{ secrets.GOOGLE_APP_ID_ANDROID_DEV_ORANGE }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN_ANDROID: ${{ secrets.SENTRY_DSN_ANDROID }}
12 changes: 8 additions & 4 deletions .github/workflows/build-android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
required: true
type: boolean
flavor:
description: "Android build flavor, 'Staging' or 'Prod'"
description: "Android build flavor, 'DevOrange' or 'Staging' or 'Prod'"
required: true
type: string
sentry-environment:
Expand Down Expand Up @@ -53,8 +53,11 @@ jobs:
- name: Lowercase build parameters
id: lowercase
run: |
echo "build-type=$(echo ${{ inputs.build-type }} | tr '[:upper:]' '[:lower:]')" | tee -a "$GITHUB_OUTPUT"
echo "flavor=$(echo ${{ inputs.flavor }} | tr '[:upper:]' '[:lower:]')" | tee -a "$GITHUB_OUTPUT"
# https://stackoverflow.com/a/12487455
buildType="${{ inputs.build-type }}"
echo "build-type=${buildType,}" | tee -a "$GITHUB_OUTPUT"
flavor="${{ inputs.flavor }}"
echo "flavor=${flavor,}" | tee -a "$GITHUB_OUTPUT"
- name: Build Android app
env:
FIREBASE_KEY: ${{ secrets.FIREBASE_KEY }}
Expand Down Expand Up @@ -96,7 +99,8 @@ jobs:
- name: Lowercase build parameters
id: lowercase
run: |
echo "flavor=$(echo ${{ inputs.flavor }} | tr '[:upper:]' '[:lower:]')" | tee -a "$GITHUB_OUTPUT"
flavor="${{ inputs.flavor }}"
echo "flavor=${flavor,}" | tee -a "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
name: android-aab
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-ios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
required: true
type: boolean
scheme:
description: "iOS build scheme, 'Staging' or 'Prod'"
description: "iOS build scheme, 'DevOrange' or 'Staging' or 'Prod'"
required: true
type: string
sentry-environment:
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/ios-dev-orange-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: iOS dev-orange deploy

on:
workflow_dispatch:
pull_request:
types:
- synchronize
- labeled
schedule:
- cron: "45 16 * * MON"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
name: Check if build is necessary
runs-on: ubuntu-latest
steps:
- id: check
name: Check
run: |
if ${{ github.event_name == 'schedule' }}; then
echo "should-run=$(gh pr list --label 'deploy to ios dev-orange' --json id --jq 'length == 0')" | tee -a "$GITHUB_OUTPUT"
elif ${{ github.event_name == 'pull_request' }}; then
echo "should-run=${{ contains(github.event.pull_request.labels.*.name, 'deploy to ios dev-orange') }}" | tee -a "$GITHUB_OUTPUT"
else
echo "should-run=true" | tee -a "$GITHUB_OUTPUT"
fi
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
should-run: ${{ steps.check.outputs.should-run }}
build-ios:
name: Build for iOS
needs: check
if: ${{ needs.check.outputs.should-run == 'true' }}
permissions:
id-token: write
contents: read
pull-requests: write
uses: ./.github/workflows/build-ios.yaml
with:
deploy: true
scheme: "DevOrange"
sentry-environment: "dev-orange"
secrets:
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
FIREBASE_KEY: ${{ secrets.FIREBASE_KEY }}
GOOGLE_APP_ID_IOS: ${{ secrets.GOOGLE_APP_ID_IOS_DEV_ORANGE }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_DSN_IOS: ${{ secrets.SENTRY_DSN_IOS }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ CERTID=$(aws secretsmanager get-secret-value --secret-id mobile-app-ios-codesign
aws secretsmanager get-secret-value --secret-id mobile-app-ios-codesigning-cer --output json | jq -r '.SecretBinary' | base64 --decode > iosApp/secrets/${CERTID}.cer
aws secretsmanager get-secret-value --secret-id mobile-app-ios-codesigning-p12 --output json | jq -r '.SecretBinary' | base64 --decode > iosApp/secrets/${CERTID}.p12
bundle exec fastlane ios cert_load cert_id:$CERTID
bundle exec fastlane ios cert_check scheme:DevOrange
bundle exec fastlane ios cert_check scheme:Staging
bundle exec fastlane ios cert_check scheme:Prod
```
Expand Down
20 changes: 8 additions & 12 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ android {
buildTypes { getByName("release") { isMinifyEnabled = false } }
flavorDimensions += "environment"
productFlavors {
create("devOrange") {
dimension = "environment"
applicationIdSuffix = ".devOrange"
}

create("staging") {
dimension = "environment"
applicationIdSuffix = ".staging"
Expand Down Expand Up @@ -160,21 +165,12 @@ task("envVars") {

// https://stackoverflow.com/a/53261807
val sentryEnv =
if (
gradle.startParameter.taskNames.any {
it.lowercase(Locale.getDefault()).contains("debug")
}
) {
"debug"
} else if (
listOf("debug", "dev-orange", "staging", "prod").firstOrNull { env ->
gradle.startParameter.taskNames.any {
it.lowercase(Locale.getDefault()).contains("prod")
it.lowercase(Locale.getDefault()).contains(env.replace("-", ""))
}
) {
"prod"
} else {
"staging"
}
?: "debug"

val sentryEnvOverride: String = getPropsOrEnv("SENTRY_ENVIRONMENT") ?: sentryEnv

Expand Down
6 changes: 6 additions & 0 deletions androidApp/src/devOrange/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<application
android:label="MBTA Go Dev Orange"
tools:replace="android:label" />
</manifest>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.mbta.tid.mbta_app.android

import com.mbta.tid.mbta_app.AppVariant

val appVariant = AppVariant.DevOrange
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:pathData="M0,0H108V108H0V0Z"
android:fillColor="#FFC066"/>
<path
android:pathData="M0,0H108V108H0V0Z"
android:fillColor="#ffffff"
android:fillAlpha="0.5"/>
<path
android:pathData="M0,0H108V108H0V0Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="54"
android:startY="54"
android:endX="108"
android:endY="108"
android:type="linear">
<item android:offset="0" android:color="#00ED8B00"/>
<item android:offset="0.66" android:color="#54ED8B00"/>
</gradient>
</aapt:attr>
</path>
<group>
<clip-path
android:pathData="M0,0h108v108h-108z"/>
<path
android:pathData="M0,0L108,108"
android:strokeAlpha="0.5"
android:strokeWidth="0.5"
android:fillColor="#00000000"
android:strokeColor="#ED8B00"
android:fillAlpha="0.5"/>
<path
android:pathData="M108,0L0,108"
android:strokeAlpha="0.5"
android:strokeWidth="0.5"
android:fillColor="#00000000"
android:strokeColor="#ED8B00"
android:fillAlpha="0.5"/>
<path
android:strokeWidth="1"
android:pathData="M54,54m-18.5,0a18.5,18.5 0,1 1,37 0a18.5,18.5 0,1 1,-37 0"
android:strokeAlpha="0.5"
android:fillColor="#00000000"
android:strokeColor="#ED8B00"
android:fillAlpha="0.5"/>
<path
android:strokeWidth="1"
android:pathData="M32,35.5L76,35.5A4.5,4.5 0,0 1,80.5 40L80.5,68A4.5,4.5 0,0 1,76 72.5L32,72.5A4.5,4.5 0,0 1,27.5 68L27.5,40A4.5,4.5 0,0 1,32 35.5z"
android:strokeAlpha="0.5"
android:fillColor="#00000000"
android:strokeColor="#ED8B00"
android:fillAlpha="0.5"/>
<path
android:strokeWidth="1"
android:pathData="M40,27.5L68,27.5A4.5,4.5 0,0 1,72.5 32L72.5,76A4.5,4.5 0,0 1,68 80.5L40,80.5A4.5,4.5 0,0 1,35.5 76L35.5,32A4.5,4.5 0,0 1,40 27.5z"
android:strokeAlpha="0.5"
android:fillColor="#00000000"
android:strokeColor="#ED8B00"
android:fillAlpha="0.5"/>
<path
android:strokeWidth="1"
android:pathData="M36,31.5L72,31.5A4.5,4.5 0,0 1,76.5 36L76.5,72A4.5,4.5 0,0 1,72 76.5L36,76.5A4.5,4.5 0,0 1,31.5 72L31.5,36A4.5,4.5 0,0 1,36 31.5z"
android:strokeAlpha="0.5"
android:fillColor="#00000000"
android:strokeColor="#ED8B00"
android:fillAlpha="0.5"/>
</group>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:pathData="M54,54m-26,0a26,26 0,1 1,52 0a26,26 0,1 1,-52 0"
android:fillColor="#ffffff"
android:fillAlpha="0.66"/>
<path
android:pathData="M37.75,51.4V43.6H70.25V51.4H57.9V70.9H50.1V51.4H37.75Z"
android:fillColor="#ED8B00"/>
<path
android:pathData="M80,54C80,68.36 68.36,80 54,80C39.64,80 28,68.36 28,54C28,39.64 39.64,28 54,28C68.36,28 80,39.64 80,54ZM77.4,54C77.4,66.92 66.92,77.4 54,77.4C41.08,77.4 30.6,66.92 30.6,54C30.6,41.08 41.08,30.6 54,30.6C66.92,30.6 77.4,41.08 77.4,54Z"
android:fillColor="#ED8B00"
android:fillType="evenOdd"/>
</vector>
5 changes: 5 additions & 0 deletions androidApp/src/devOrange/res/mipmap-anydpi/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fun MoreSectionView(section: MoreSection, toggleSetting: ((Settings) -> Unit)) {

val note = section.note

if (!(section.requiresStaging && appVariant != AppVariant.Staging)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion (non-blocking): Might be worth renaming requiresStaging at this point too. We could invert to requiresProd

if (!(section.hiddenOnProd && appVariant == AppVariant.Prod)) {
Column {
if (name != null) {
Column(modifier = Modifier.padding(2.dp)) {
Expand Down
2 changes: 1 addition & 1 deletion bin/android-instrumented-test-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# https://github.com/ReactiveCircus/android-emulator-runner/issues/316#issuecomment-1665866511

set +e
./gradlew connectedCheck --no-daemon
./gradlew :androidApp:connectedStagingDebugAndroidTest --no-daemon
GRADLE_EXIT_CODE=$?

if [ $GRADLE_EXIT_CODE -ne 0 ]; then
Expand Down
28 changes: 23 additions & 5 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ platform :android do
'com.mbta.tid.mbta_app'
when 'Staging'
'com.mbta.tid.mbta_app.staging'
when 'DevOrange'
'com.mbta.tid.mbta_app.devOrange'
else
raise "Unknown flavor #{flavor}"
end
Expand All @@ -34,10 +36,17 @@ platform :android do
if options[:build_type] == 'Debug'
0
else
google_play_track_version_codes(
package_name: package_name,
track: 'internal'
).max
begin
google_play_track_version_codes(
package_name: package_name,
track: 'internal'
).max
rescue Exception => e
unless e.message == "Google Api Error: Invalid request - Package not found: #{package_name}."
Copy link
Collaborator

Choose a reason for hiding this comment

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

question (non-blocking): Is this just temporary handling until the app is added?

Copy link
Member Author

Choose a reason for hiding this comment

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

This required a temporary workaround when we created the staging app, it requires a temporary workaround now, and it will require a temporary workaround in the not inconceivable future where we want dev-silver. I don’t think it increases the maintenance burden to leave it in long-term.

raise
end
0
end
end

next_version_code = last_version_code + 1
Expand Down Expand Up @@ -70,7 +79,7 @@ platform :android do
desc 'Deploy a new version to Google Play for internal testing'
lane :internal do |options|
package_name = package_name(options[:flavor])
flavor = options[:flavor].downcase
flavor = options[:flavor][0].downcase + options[:flavor][1..]
upload_to_play_store(
package_name: package_name,
track: 'internal',
Expand All @@ -86,6 +95,8 @@ platform :ios do
'com.mbta.tid.mbtaapp'
when 'Staging'
'com.mbta.tid.mbtaapp.staging'
when 'DevOrange'
'com.mbta.tid.mbtaapp.devorange'
else
raise "Unknown scheme #{scheme}"
end
Expand Down Expand Up @@ -188,6 +199,13 @@ platform :ios do
app_store_connect
begin
case options[:scheme]
when 'DevOrange'
upload_to_testflight(
ipa: 'iosApp/build/iosApp.ipa',
distribute_external: true,
changelog: '',
groups: ['Dev Orange Users']
Copy link
Collaborator

Choose a reason for hiding this comment

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

question(non-blocking): Is there a reason we'd want to manage this group separately from our existing groups? Wondering if we only need one group with access to all non-prod apps for simplicity

Copy link
Member Author

Choose a reason for hiding this comment

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

It doesn’t look like TestFlight groups carry over from one app to another.

)
when 'Staging'
upload_to_testflight(
ipa: 'iosApp/build/iosApp.ipa',
Expand Down
Loading
Loading