Skip to content

Commit 8498e71

Browse files
authored
Merge pull request #53214 from software-mansion-labs/hybrid-adhoc-update-build-gradle
[NO QA] Update build.gradle for hybrid app adhoc builds
2 parents 2337870 + b15d24c commit 8498e71

File tree

7 files changed

+393
-52
lines changed

7 files changed

+393
-52
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

0 commit comments

Comments
 (0)