Skip to content

Commit 87efc85

Browse files
authored
Merge pull request #43046 from Expensify/andrew-hybrid-deploy-2
Add HybridApp deploy to platform deploy
2 parents 594ae48 + 732a375 commit 87efc85

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

.github/workflows/platformDeploy.yml

+7
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,13 @@ jobs:
352352
env:
353353
CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }}
354354

355+
# Build a version of iOS and Android HybridApp if we are deploying to staging
356+
hybridApp:
357+
name: Deploy HybridApp
358+
needs: validateActor
359+
if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) && github.event_name == 'push' }}
360+
uses: Expensify/Mobile-Deploy/.github/workflows/deploy.yml@main
361+
355362
postSlackMessageOnFailure:
356363
name: Post a Slack message when any platform fails to build or deploy
357364
runs-on: ubuntu-latest

workflow_tests/assertions/platformDeployAssertions.ts

+13
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ function assertDeployChecklistJobExecuted(workflowResult: Step[], didExecute = t
2525
});
2626
}
2727

28+
function assertHybridAppJobExecuted(workflowResult: Step[], didExecute = true) {
29+
const steps = [createStepAssertion('hybridApp', true, null, 'HYBRID_APP', 'Deploy HybridApp')] as const;
30+
31+
steps.forEach((expectedStep) => {
32+
if (didExecute) {
33+
expect(workflowResult).toEqual(expect.arrayContaining([expectedStep]));
34+
} else {
35+
expect(workflowResult).not.toEqual(expect.arrayContaining([expectedStep]));
36+
}
37+
});
38+
}
39+
2840
function assertAndroidJobExecuted(workflowResult: Step[], didExecute = true, isProduction = true, isSuccessful = true) {
2941
const steps = [
3042
createStepAssertion('Checkout', true, null, 'ANDROID', 'Checking out'),
@@ -379,6 +391,7 @@ function assertPostGithubCommentJobExecuted(workflowResult: Step[], didExecute =
379391
export default {
380392
assertVerifyActorJobExecuted,
381393
assertDeployChecklistJobExecuted,
394+
assertHybridAppJobExecuted,
382395
assertAndroidJobExecuted,
383396
assertDesktopJobExecuted,
384397
assertIOSJobExecuted,

workflow_tests/mocks/platformDeployMocks.ts

+5
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ const PLATFORM_DEPLOY__WEB__STEP_MOCKS = [
199199
PLATFORM_DEPLOY__WEB__PURGE_STAGING_CACHE__STEP_MOCK,
200200
];
201201

202+
// deploy hybridApp
203+
const PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCK = createMockStep('hybridApp', 'Deploy HybridApp', 'HYBRID_APP');
204+
const PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCKS = [PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCK];
205+
202206
// post slack message on failure
203207
const PLATFORM_DEPLOY__POST_SLACK_FAIL__POST_SLACK__STEP_MOCK = createMockStep('Post Slack message on failure', 'Posting Slack message on platform deploy failure', 'POST_SLACK_FAIL', [
204208
'SLACK_WEBHOOK',
@@ -274,6 +278,7 @@ export default {
274278
PLATFORM_DEPLOY__DESKTOP__STEP_MOCKS,
275279
PLATFORM_DEPLOY__IOS__STEP_MOCKS,
276280
PLATFORM_DEPLOY__WEB__STEP_MOCKS,
281+
PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCKS,
277282
PLATFORM_DEPLOY__POST_SLACK_FAIL__STEP_MOCKS,
278283
PLATFORM_DEPLOY__POST_SLACK_SUCCESS__STEP_MOCKS,
279284
PLATFORM_DEPLOY__POST_GITHUB_COMMENT__STEP_MOCKS,

workflow_tests/platformDeploy.test.ts

+15
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ describe('test workflow platformDeploy', () => {
110110
steps: mocks.PLATFORM_DEPLOY__DEPLOY_CHECKLIST__STEP_MOCKS,
111111
runsOn: 'ubuntu-latest',
112112
},
113+
hybridApp: {
114+
steps: mocks.PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCKS,
115+
runsOn: 'ubuntu-latest',
116+
},
113117
};
114118
const result = await act.runEvent('push', {
115119
workflowFile: path.join(repoPath, '.github', 'workflows', 'platformDeploy.yml'),
@@ -121,6 +125,7 @@ describe('test workflow platformDeploy', () => {
121125

122126
assertions.assertVerifyActorJobExecuted(result);
123127
assertions.assertDeployChecklistJobExecuted(result, true);
128+
assertions.assertHybridAppJobExecuted(result, true);
124129
assertions.assertAndroidJobExecuted(result, true, false, true);
125130
assertions.assertDesktopJobExecuted(result, true, false);
126131
assertions.assertIOSJobExecuted(result, true, false, true);
@@ -194,6 +199,10 @@ describe('test workflow platformDeploy', () => {
194199
steps: mocks.PLATFORM_DEPLOY__DEPLOY_CHECKLIST__STEP_MOCKS,
195200
runsOn: 'ubuntu-latest',
196201
},
202+
hybridApp: {
203+
steps: mocks.PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCKS,
204+
runsOn: 'ubuntu-latest',
205+
},
197206
};
198207
const result = await act.runEvent('push', {
199208
workflowFile: path.join(repoPath, '.github', 'workflows', 'platformDeploy.yml'),
@@ -205,6 +214,7 @@ describe('test workflow platformDeploy', () => {
205214

206215
assertions.assertVerifyActorJobExecuted(result);
207216
assertions.assertDeployChecklistJobExecuted(result, true);
217+
assertions.assertHybridAppJobExecuted(result, true);
208218
assertions.assertAndroidJobExecuted(result, true, false, true);
209219
assertions.assertDesktopJobExecuted(result, true, false);
210220
assertions.assertIOSJobExecuted(result, true, false, true);
@@ -278,6 +288,10 @@ describe('test workflow platformDeploy', () => {
278288
steps: mocks.PLATFORM_DEPLOY__DEPLOY_CHECKLIST__STEP_MOCKS,
279289
runsOn: 'ubuntu-latest',
280290
},
291+
hybridApp: {
292+
steps: mocks.PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCKS,
293+
runsOn: 'ubuntu-latest',
294+
},
281295
};
282296
const result = await act.runEvent('push', {
283297
workflowFile: path.join(repoPath, '.github', 'workflows', 'platformDeploy.yml'),
@@ -289,6 +303,7 @@ describe('test workflow platformDeploy', () => {
289303

290304
assertions.assertVerifyActorJobExecuted(result);
291305
assertions.assertDeployChecklistJobExecuted(result, true);
306+
assertions.assertHybridAppJobExecuted(result, false);
292307
assertions.assertAndroidJobExecuted(result, false);
293308
assertions.assertDesktopJobExecuted(result, false);
294309
assertions.assertIOSJobExecuted(result, false);

0 commit comments

Comments
 (0)