Skip to content

Commit 0fcef73

Browse files
committed
Merge branch 'main' of https://github.com/rezkiy37/Expensify into feature/202-eslint-rule-stop-usage-init-function-use-state
2 parents 7d0f8a3 + 00f0dee commit 0fcef73

File tree

99 files changed

+1387
-498
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1387
-498
lines changed

.github/actions/javascript/postTestBuildComment/action.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ description: "Mark pull requests as deployed on production or staging"
33
inputs:
44
PR_NUMBER:
55
description: "Pull request number"
6-
required: true
6+
required: false
77
GITHUB_TOKEN:
88
description: "Github token for authentication"
99
default: "${{ github.token }}"
1010
ANDROID:
1111
description: "Android job result ('success', 'failure', 'cancelled', or 'skipped')"
12-
required: true
12+
required: false
1313
DESKTOP:
1414
description: "Desktop job result ('success', 'failure', 'cancelled', or 'skipped')"
15-
required: true
15+
required: false
1616
IOS:
1717
description: "iOS job result ('success', 'failure', 'cancelled', or 'skipped')"
18-
required: true
18+
required: false
1919
WEB:
2020
description: "Web job result ('success', 'failure', 'cancelled', or 'skipped')"
21-
required: true
21+
required: false
2222
ANDROID_LINK:
2323
description: "Link for the Android build"
2424
required: false

.github/actions/javascript/postTestBuildComment/index.js

+28-21
Original file line numberDiff line numberDiff line change
@@ -11502,31 +11502,38 @@ const github_1 = __nccwpck_require__(5438);
1150211502
const CONST_1 = __importDefault(__nccwpck_require__(9873));
1150311503
const GithubUtils_1 = __importDefault(__nccwpck_require__(9296));
1150411504
function getTestBuildMessage() {
11505-
console.log('Input for android', core.getInput('ANDROID', { required: true }));
11506-
const androidSuccess = core.getInput('ANDROID', { required: true }) === 'success';
11507-
const desktopSuccess = core.getInput('DESKTOP', { required: true }) === 'success';
11508-
const iOSSuccess = core.getInput('IOS', { required: true }) === 'success';
11509-
const webSuccess = core.getInput('WEB', { required: true }) === 'success';
11510-
const androidLink = androidSuccess ? core.getInput('ANDROID_LINK') : '❌ FAILED ❌';
11511-
const desktopLink = desktopSuccess ? core.getInput('DESKTOP_LINK') : '❌ FAILED ❌';
11512-
const iOSLink = iOSSuccess ? core.getInput('IOS_LINK') : '❌ FAILED ❌';
11513-
const webLink = webSuccess ? core.getInput('WEB_LINK') : '❌ FAILED ❌';
11514-
const androidQRCode = androidSuccess
11515-
? `![Android](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${androidLink})`
11516-
: "The QR code can't be generated, because the android build failed";
11517-
const desktopQRCode = desktopSuccess
11518-
? `![Desktop](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${desktopLink})`
11519-
: "The QR code can't be generated, because the Desktop build failed";
11520-
const iOSQRCode = iOSSuccess ? `![iOS](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${iOSLink})` : "The QR code can't be generated, because the iOS build failed";
11521-
const webQRCode = webSuccess ? `![Web](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${webLink})` : "The QR code can't be generated, because the web build failed";
11505+
const inputs = ['ANDROID', 'DESKTOP', 'IOS', 'WEB'];
11506+
const names = {
11507+
[inputs[0]]: 'Android',
11508+
[inputs[1]]: 'Desktop',
11509+
[inputs[2]]: 'iOS',
11510+
[inputs[3]]: 'Web',
11511+
};
11512+
const result = inputs.reduce((acc, platform) => {
11513+
const input = core.getInput(platform, { required: false });
11514+
if (!input) {
11515+
acc[platform] = { link: 'N/A', qrCode: 'N/A' };
11516+
return acc;
11517+
}
11518+
const isSuccess = input === 'success';
11519+
const link = isSuccess ? core.getInput(`${platform}_LINK`) : '❌ FAILED ❌';
11520+
const qrCode = isSuccess
11521+
? `![${names[platform]}](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${link})`
11522+
: `The QR code can't be generated, because the ${names[platform]} build failed`;
11523+
acc[platform] = {
11524+
link,
11525+
qrCode,
11526+
};
11527+
return acc;
11528+
}, {});
1152211529
const message = `:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube:
1152311530
| Android :robot: | iOS :apple: |
1152411531
| ------------- | ------------- |
11525-
| ${androidLink} | ${iOSLink} |
11526-
| ${androidQRCode} | ${iOSQRCode} |
11532+
| ${result.ANDROID.link} | ${result.IOS.link} |
11533+
| ${result.ANDROID.qrCode} | ${result.IOS.qrCode} |
1152711534
| Desktop :computer: | Web :spider_web: |
11528-
| ${desktopLink} | ${webLink} |
11529-
| ${desktopQRCode} | ${webQRCode} |
11535+
| ${result.DESKTOP.link} | ${result.WEB.link} |
11536+
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |
1153011537

1153111538
---
1153211539

.github/actions/javascript/postTestBuildComment/postTestBuildComment.ts

+32-21
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,48 @@
11
import * as core from '@actions/core';
22
import {context} from '@actions/github';
3+
import type {TupleToUnion} from 'type-fest';
34
import CONST from '@github/libs/CONST';
45
import GithubUtils from '@github/libs/GithubUtils';
56

67
function getTestBuildMessage(): string {
7-
console.log('Input for android', core.getInput('ANDROID', {required: true}));
8-
const androidSuccess = core.getInput('ANDROID', {required: true}) === 'success';
9-
const desktopSuccess = core.getInput('DESKTOP', {required: true}) === 'success';
10-
const iOSSuccess = core.getInput('IOS', {required: true}) === 'success';
11-
const webSuccess = core.getInput('WEB', {required: true}) === 'success';
8+
const inputs = ['ANDROID', 'DESKTOP', 'IOS', 'WEB'] as const;
9+
const names = {
10+
[inputs[0]]: 'Android',
11+
[inputs[1]]: 'Desktop',
12+
[inputs[2]]: 'iOS',
13+
[inputs[3]]: 'Web',
14+
};
1215

13-
const androidLink = androidSuccess ? core.getInput('ANDROID_LINK') : '❌ FAILED ❌';
14-
const desktopLink = desktopSuccess ? core.getInput('DESKTOP_LINK') : '❌ FAILED ❌';
15-
const iOSLink = iOSSuccess ? core.getInput('IOS_LINK') : '❌ FAILED ❌';
16-
const webLink = webSuccess ? core.getInput('WEB_LINK') : '❌ FAILED ❌';
16+
const result = inputs.reduce((acc, platform) => {
17+
const input = core.getInput(platform, {required: false});
1718

18-
const androidQRCode = androidSuccess
19-
? `![Android](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${androidLink})`
20-
: "The QR code can't be generated, because the android build failed";
21-
const desktopQRCode = desktopSuccess
22-
? `![Desktop](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${desktopLink})`
23-
: "The QR code can't be generated, because the Desktop build failed";
24-
const iOSQRCode = iOSSuccess ? `![iOS](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${iOSLink})` : "The QR code can't be generated, because the iOS build failed";
25-
const webQRCode = webSuccess ? `![Web](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${webLink})` : "The QR code can't be generated, because the web build failed";
19+
if (!input) {
20+
acc[platform] = {link: 'N/A', qrCode: 'N/A'};
21+
return acc;
22+
}
23+
24+
const isSuccess = input === 'success';
25+
26+
const link = isSuccess ? core.getInput(`${platform}_LINK`) : '❌ FAILED ❌';
27+
const qrCode = isSuccess
28+
? `![${names[platform]}](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${link})`
29+
: `The QR code can't be generated, because the ${names[platform]} build failed`;
30+
31+
acc[platform] = {
32+
link,
33+
qrCode,
34+
};
35+
return acc;
36+
}, {} as Record<TupleToUnion<typeof inputs>, {link: string; qrCode: string}>);
2637

2738
const message = `:test_tube::test_tube: Use the links below to test this adhoc build on Android, iOS, Desktop, and Web. Happy testing! :test_tube::test_tube:
2839
| Android :robot: | iOS :apple: |
2940
| ------------- | ------------- |
30-
| ${androidLink} | ${iOSLink} |
31-
| ${androidQRCode} | ${iOSQRCode} |
41+
| ${result.ANDROID.link} | ${result.IOS.link} |
42+
| ${result.ANDROID.qrCode} | ${result.IOS.qrCode} |
3243
| Desktop :computer: | Web :spider_web: |
33-
| ${desktopLink} | ${webLink} |
34-
| ${desktopQRCode} | ${webQRCode} |
44+
| ${result.DESKTOP.link} | ${result.WEB.link} |
45+
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |
3546
3647
---
3748

.github/workflows/deploy.yml

+73-9
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,51 @@ jobs:
114114
env:
115115
BROWSERSTACK: ${{ secrets.BROWSERSTACK }}
116116

117+
submitAndroid:
118+
name: Submit Android app for production review
119+
needs: prep
120+
if: ${{ github.ref == 'refs/heads/production' }}
121+
runs-on: ubuntu-latest
122+
steps:
123+
- name: Checkout
124+
uses: actions/checkout@v4
125+
126+
- name: Setup Ruby
127+
uses: ruby/setup-ruby@v1.190.0
128+
with:
129+
bundler-cache: true
130+
131+
- name: Get Android native version
132+
id: getAndroidVersion
133+
run: echo "VERSION_CODE=$(grep -o 'versionCode\s\+[0-9]\+' android/app/build.gradle | awk '{ print $2 }')" >> "$GITHUB_OUTPUT"
134+
135+
- name: Decrypt json w/ Google Play credentials
136+
run: gpg --batch --yes --decrypt --passphrase="${{ secrets.LARGE_SECRET_PASSPHRASE }}" --output android-fastlane-json-key.json android-fastlane-json-key.json.gpg
137+
working-directory: android/app
138+
139+
- name: Submit Android build for review
140+
run: bundle exec fastlane android upload_google_play_production
141+
env:
142+
VERSION: ${{ steps.getAndroidVersion.outputs.VERSION_CODE }}
143+
144+
- name: Warn deployers if Android production deploy failed
145+
if: ${{ failure() }}
146+
uses: 8398a7/action-slack@v3
147+
with:
148+
status: custom
149+
custom_payload: |
150+
{
151+
channel: '#deployer',
152+
attachments: [{
153+
color: "#DB4545",
154+
pretext: `<!subteam^S4TJJ3PSL>`,
155+
text: `💥 Android production deploy failed. Please manually submit ${{ needs.prep.outputs.APP_VERSION }} in the <https://play.google.com/console/u/0/developers/8765590895836334604/app/4973041797096886180/releases/overview|Google Play Store>. 💥`,
156+
}]
157+
}
158+
env:
159+
GITHUB_TOKEN: ${{ github.token }}
160+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
161+
117162
android_hybrid:
118163
name: Build and deploy Android HybridApp
119164
needs: prep
@@ -386,6 +431,12 @@ jobs:
386431
APPLE_DEMO_EMAIL: ${{ secrets.APPLE_DEMO_EMAIL }}
387432
APPLE_DEMO_PASSWORD: ${{ secrets.APPLE_DEMO_PASSWORD }}
388433

434+
- name: Submit build for App Store review
435+
if: ${{ fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
436+
run: bundle exec fastlane ios submit_for_review
437+
env:
438+
VERSION: ${{ steps.getIOSVersion.outputs.IOS_VERSION }}
439+
389440
- name: Upload iOS build to Browser Stack
390441
if: ${{ !fromJSON(env.SHOULD_DEPLOY_PRODUCTION) }}
391442
run: curl -u "$BROWSERSTACK" -X POST "https://api-cloud.browserstack.com/app-live/upload" -F "file=@/Users/runner/work/App/App/New Expensify.ipa"
@@ -503,6 +554,7 @@ jobs:
503554
run: |
504555
op document get --output ./OldApp_AppStore.mobileprovision OldApp_AppStore
505556
op document get --output ./OldApp_AppStore_Share_Extension.mobileprovision OldApp_AppStore_Share_Extension
557+
op document get --output ./OldApp_AppStore_Notification_Service.mobileprovision OldApp_AppStore_Notification_Service
506558
507559
- name: Decrypt AppStore profile
508560
run: cd ios && gpg --quiet --batch --yes --decrypt --passphrase="$LARGE_SECRET_PASSPHRASE" --output NewApp_AppStore.mobileprovision NewApp_AppStore.mobileprovision.gpg
@@ -679,7 +731,7 @@ jobs:
679731
name: Post a Slack message when any platform fails to build or deploy
680732
runs-on: ubuntu-latest
681733
if: ${{ failure() }}
682-
needs: [buildAndroid, uploadAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web]
734+
needs: [buildAndroid, uploadAndroid, submitAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web]
683735
steps:
684736
- name: Checkout
685737
uses: actions/checkout@v4
@@ -694,15 +746,21 @@ jobs:
694746
outputs:
695747
IS_AT_LEAST_ONE_PLATFORM_DEPLOYED: ${{ steps.checkDeploymentSuccessOnAtLeastOnePlatform.outputs.IS_AT_LEAST_ONE_PLATFORM_DEPLOYED }}
696748
IS_ALL_PLATFORMS_DEPLOYED: ${{ steps.checkDeploymentSuccessOnAllPlatforms.outputs.IS_ALL_PLATFORMS_DEPLOYED }}
697-
needs: [buildAndroid, uploadAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web]
749+
needs: [buildAndroid, uploadAndroid, submitAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web]
698750
if: ${{ always() }}
699751
steps:
700752
- name: Check deployment success on at least one platform
701753
id: checkDeploymentSuccessOnAtLeastOnePlatform
702754
run: |
703755
isAtLeastOnePlatformDeployed="false"
704-
if [ "${{ needs.uploadAndroid.result }}" == "success" ]; then
705-
isAtLeastOnePlatformDeployed="true"
756+
if [ ${{ github.ref }} == 'refs/heads/production' ]; then
757+
if [ "${{ needs.submitAndroid.result }}" == "success" ]; then
758+
isAtLeastOnePlatformDeployed="true"
759+
fi
760+
else
761+
if [ "${{ needs.uploadAndroid.result }}" == "success" ]; then
762+
isAtLeastOnePlatformDeployed="true"
763+
fi
706764
fi
707765
708766
if [ "${{ needs.iOS.result }}" == "success" ] || \
@@ -727,8 +785,14 @@ jobs:
727785
isAllPlatformsDeployed="true"
728786
fi
729787
730-
if [ "${{ needs.uploadAndroid.result }}" != "success" ]; then
731-
isAllPlatformsDeployed="false"
788+
if [ ${{ github.ref }} == 'refs/heads/production' ]; then
789+
if [ "${{ needs.submitAndroid.result }}" != "success" ]; then
790+
isAllPlatformsDeployed="false"
791+
fi
792+
else
793+
if [ "${{ needs.uploadAndroid.result }}" != "success" ]; then
794+
isAllPlatformsDeployed="false"
795+
fi
732796
fi
733797
734798
echo "IS_ALL_PLATFORMS_DEPLOYED=$isAllPlatformsDeployed" >> "$GITHUB_OUTPUT"
@@ -876,7 +940,7 @@ jobs:
876940
name: Post a Slack message when all platforms deploy successfully
877941
runs-on: ubuntu-latest
878942
if: ${{ always() && fromJSON(needs.checkDeploymentSuccess.outputs.IS_ALL_PLATFORMS_DEPLOYED) }}
879-
needs: [prep, buildAndroid, uploadAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web, checkDeploymentSuccess, createPrerelease, finalizeRelease]
943+
needs: [prep, buildAndroid, uploadAndroid, submitAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web, checkDeploymentSuccess, createPrerelease, finalizeRelease]
880944
steps:
881945
- name: 'Announces the deploy in the #announce Slack room'
882946
uses: 8398a7/action-slack@v3
@@ -930,11 +994,11 @@ jobs:
930994
postGithubComments:
931995
uses: ./.github/workflows/postDeployComments.yml
932996
if: ${{ always() && fromJSON(needs.checkDeploymentSuccess.outputs.IS_AT_LEAST_ONE_PLATFORM_DEPLOYED) }}
933-
needs: [prep, buildAndroid, uploadAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web, checkDeploymentSuccess, createPrerelease, finalizeRelease]
997+
needs: [prep, buildAndroid, uploadAndroid, submitAndroid, android_hybrid, desktop, iOS, iOS_hybrid, web, checkDeploymentSuccess, createPrerelease, finalizeRelease]
934998
with:
935999
version: ${{ needs.prep.outputs.APP_VERSION }}
9361000
env: ${{ github.ref == 'refs/heads/production' && 'production' || 'staging' }}
937-
android: ${{ github.ref == 'refs/heads/production' && needs.uploadAndroid.result }}
1001+
android: ${{ github.ref == 'refs/heads/production' && needs.submitAndroid.result || needs.uploadAndroid.result }}
9381002
android_hybrid: ${{ needs.android_hybrid.result }}
9391003
ios: ${{ needs.iOS.result }}
9401004
ios_hybrid: ${{ needs.iOS_hybrid.result }}

0 commit comments

Comments
 (0)