Skip to content
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
2 changes: 1 addition & 1 deletion .github/actionlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ self-hosted-runner:
paths:
'**/*':
ignore:
# This is meant to be a temporary workaround for a bug in actionslint. Upstream:
# This is meant to be a temporary workaround for a bug in actionlint. Upstream:
# - issue: https://github.com/rhysd/actionlint/issues/511
# - PR: https://github.com/rhysd/actionlint/pull/513
- '"env" is not allowed in "runs" section because .* is a Composite action.*'
28 changes: 19 additions & 9 deletions .github/actions/javascript/postTestBuildComment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11515,11 +11515,21 @@ function getTestBuildMessage(appPr, mobileExpensifyPr) {
acc[platform] = { link: 'N/A', qrCode: 'N/A' };
return acc;
}
const isSuccess = input === 'success';
const link = isSuccess ? core.getInput(`${platform}_LINK`) : '❌ FAILED ❌';
const qrCode = isSuccess
? `![${names[platform]}](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${link})`
: `The QR code can't be generated, because the ${names[platform]} build failed`;
let link = '';
let qrCode = '';
switch (input) {
case 'success':
link = core.getInput(`${platform}_LINK`);
qrCode = `![${names[platform]}](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${link})`;
break;
case 'skipped':
link = '⏩ SKIPPED ⏩';
qrCode = `The build for ${names[platform]} was skipped`;
break;
default:
link = '❌ FAILED ❌';
qrCode = `The QR code can't be generated, because the ${names[platform]} build failed`;
}
acc[platform] = {
link,
qrCode,
Expand All @@ -11532,12 +11542,12 @@ Built from${appPr ? ` App PR Expensify/App#${appPr}` : ''}${mobileExpensifyPr ?
| ------------- | ------------- |
| ${result.ANDROID.link} | ${result.IOS.link} |
| ${result.ANDROID.qrCode} | ${result.IOS.qrCode} |
${appPr
? `\n| Desktop :computer: | Web :spider_web: |

| Desktop :computer: | Web :spider_web: |
| ------------- | ------------- |
| ${result.DESKTOP.link} | ${result.WEB.link} |
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |\n`
: ''}
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |

---

:eyes: [View the workflow run that generated this build](https://github.com/${github_1.context.repo.owner}/${github_1.context.repo.repo}/actions/runs/${github_1.context.runId}) :eyes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,21 @@ function getTestBuildMessage(appPr?: number, mobileExpensifyPr?: number): string
return acc;
}

const isSuccess = input === 'success';

const link = isSuccess ? core.getInput(`${platform}_LINK`) : '❌ FAILED ❌';
const qrCode = isSuccess
? `![${names[platform]}](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${link})`
: `The QR code can't be generated, because the ${names[platform]} build failed`;
let link = '';
let qrCode = '';
switch (input) {
case 'success':
link = core.getInput(`${platform}_LINK`);
qrCode = `![${names[platform]}](https://api.qrserver.com/v1/create-qr-code/?size=120x120&data=${link})`;
break;
case 'skipped':
link = '⏩ SKIPPED ⏩';
qrCode = `The build for ${names[platform]} was skipped`;
break;
default:
link = '❌ FAILED ❌';
qrCode = `The QR code can't be generated, because the ${names[platform]} build failed`;
}

acc[platform] = {
link,
Expand All @@ -44,14 +53,12 @@ Built from${appPr ? ` App PR Expensify/App#${appPr}` : ''}${mobileExpensifyPr ?
| ------------- | ------------- |
| ${result.ANDROID.link} | ${result.IOS.link} |
| ${result.ANDROID.qrCode} | ${result.IOS.qrCode} |
${
appPr
? `\n| Desktop :computer: | Web :spider_web: |

| Desktop :computer: | Web :spider_web: |
| ------------- | ------------- |
| ${result.DESKTOP.link} | ${result.WEB.link} |
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |\n`
: ''
}
| ${result.DESKTOP.qrCode} | ${result.WEB.qrCode} |

---

:eyes: [View the workflow run that generated this build](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) :eyes:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
outputs:
MOBILE_EXPENSIFY_PR: ${{ steps.mobileExpensifyPR.outputs.result }}
steps:
- name: Check if author specifed Expensify/Mobile-Expensify PR
- name: Check if author specified Expensify/Mobile-Expensify PR
id: mobileExpensifyPR
# v7
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
Expand Down
1 change: 1 addition & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@
"xdescribe",
"xero",
"Xfermode",
"xlarge",
"xlink",
"xmlgateway",
"Xours",
Expand Down
27 changes: 17 additions & 10 deletions tests/unit/postTestBuildComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ Built from App PR Expensify/App#12 Mobile-Expensify PR Expensify/Mobile-Expensif
:eyes: [View the workflow run that generated this build](https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/1234) :eyes:
`;

const onlyAndroidMessage = `: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:
const onlyAppMessage = `: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:
Built from App PR Expensify/App#12.
| Android :robot: | iOS :apple: |
| ------------- | ------------- |
| N/A | N/A |
| N/A | N/A |
| ${androidLink} | ⏩ SKIPPED ⏩ |
| ${androidQRCode} | The build for iOS was skipped |

| Desktop :computer: | Web :spider_web: |
| ------------- | ------------- |
| N/A | N/A |
| N/A | N/A |
| ❌ FAILED ❌ | ⏩ SKIPPED ⏩ |
| The QR code can't be generated, because the Desktop build failed | The build for Web was skipped |

---

Expand All @@ -94,6 +94,11 @@ Built from Mobile-Expensify PR Expensify/Mobile-Expensify#13.
| ${androidLink} | ${iOSLink} |
| ${androidQRCode} | ${iOSQRCode} |

| Desktop :computer: | Web :spider_web: |
| ------------- | ------------- |
| ⏩ SKIPPED ⏩ | ⏩ SKIPPED ⏩ |
| The build for Desktop was skipped | The build for Web was skipped |

---

:eyes: [View the workflow run that generated this build](https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/1234) :eyes:
Expand Down Expand Up @@ -148,10 +153,10 @@ describe('Post test build comments action tests', () => {
when(core.getInput).calledWith('REPO', {required: true}).mockReturnValue(CONST.APP_REPO);
when(core.getInput).calledWith('APP_PR_NUMBER', {required: false}).mockReturnValue('12');
when(core.getInput).calledWith('MOBILE_EXPENSIFY_PR_NUMBER', {required: false}).mockReturnValue('');
when(core.getInput).calledWith('ANDROID', {required: false}).mockReturnValue('');
when(core.getInput).calledWith('IOS', {required: false}).mockReturnValue('');
when(core.getInput).calledWith('WEB', {required: false}).mockReturnValue('');
when(core.getInput).calledWith('DESKTOP', {required: false}).mockReturnValue('');
when(core.getInput).calledWith('ANDROID', {required: false}).mockReturnValue('success');
when(core.getInput).calledWith('IOS', {required: false}).mockReturnValue('skipped');
when(core.getInput).calledWith('WEB', {required: false}).mockReturnValue('skipped');
when(core.getInput).calledWith('DESKTOP', {required: false}).mockReturnValue('failure');
when(core.getInput).calledWith('ANDROID_LINK').mockReturnValue('https://expensify.app/ANDROID_LINK');
createCommentMock.mockResolvedValue({} as CreateCommentResponse);
mockListComments.mockResolvedValue({
Expand All @@ -175,7 +180,7 @@ describe('Post test build comments action tests', () => {
}
`);
expect(createCommentMock).toBeCalledTimes(1);
expect(createCommentMock).toBeCalledWith(CONST.APP_REPO, 12, onlyAndroidMessage);
expect(createCommentMock).toBeCalledWith(CONST.APP_REPO, 12, onlyAppMessage);
});

test('Test GH action when only Mobile-Expensify PR number is provided', async () => {
Expand All @@ -186,6 +191,8 @@ describe('Post test build comments action tests', () => {
when(core.getInput).calledWith('IOS', {required: false}).mockReturnValue('success');
when(core.getInput).calledWith('ANDROID_LINK').mockReturnValue(androidLink);
when(core.getInput).calledWith('IOS_LINK').mockReturnValue(iOSLink);
when(core.getInput).calledWith('WEB', {required: false}).mockReturnValue('skipped');
when(core.getInput).calledWith('DESKTOP', {required: false}).mockReturnValue('skipped');
createCommentMock.mockResolvedValue({} as CreateCommentResponse);
mockListComments.mockResolvedValue({
data: [
Expand Down