diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml index 353a898a941f..dacf1c9f42fa 100644 --- a/.github/workflows/platformDeploy.yml +++ b/.github/workflows/platformDeploy.yml @@ -352,6 +352,13 @@ jobs: env: CF_API_KEY: ${{ secrets.CLOUDFLARE_TOKEN }} + # Build a version of iOS and Android HybridApp if we are deploying to staging + hybridApp: + name: Deploy HybridApp + needs: validateActor + if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) && github.event_name == 'push' }} + uses: Expensify/Mobile-Deploy/.github/workflows/deploy.yml@main + postSlackMessageOnFailure: name: Post a Slack message when any platform fails to build or deploy runs-on: ubuntu-latest diff --git a/workflow_tests/assertions/platformDeployAssertions.ts b/workflow_tests/assertions/platformDeployAssertions.ts index 24bb91f001f6..fa61d4ef01ff 100644 --- a/workflow_tests/assertions/platformDeployAssertions.ts +++ b/workflow_tests/assertions/platformDeployAssertions.ts @@ -25,6 +25,18 @@ function assertDeployChecklistJobExecuted(workflowResult: Step[], didExecute = t }); } +function assertHybridAppJobExecuted(workflowResult: Step[], didExecute = true) { + const steps = [createStepAssertion('hybridApp', true, null, 'HYBRID_APP', 'Deploy HybridApp')] as const; + + steps.forEach((expectedStep) => { + if (didExecute) { + expect(workflowResult).toEqual(expect.arrayContaining([expectedStep])); + } else { + expect(workflowResult).not.toEqual(expect.arrayContaining([expectedStep])); + } + }); +} + function assertAndroidJobExecuted(workflowResult: Step[], didExecute = true, isProduction = true, isSuccessful = true) { const steps = [ createStepAssertion('Checkout', true, null, 'ANDROID', 'Checking out'), @@ -379,6 +391,7 @@ function assertPostGithubCommentJobExecuted(workflowResult: Step[], didExecute = export default { assertVerifyActorJobExecuted, assertDeployChecklistJobExecuted, + assertHybridAppJobExecuted, assertAndroidJobExecuted, assertDesktopJobExecuted, assertIOSJobExecuted, diff --git a/workflow_tests/mocks/platformDeployMocks.ts b/workflow_tests/mocks/platformDeployMocks.ts index 9d5727bbf5f5..6f2647329683 100644 --- a/workflow_tests/mocks/platformDeployMocks.ts +++ b/workflow_tests/mocks/platformDeployMocks.ts @@ -199,6 +199,10 @@ const PLATFORM_DEPLOY__WEB__STEP_MOCKS = [ PLATFORM_DEPLOY__WEB__PURGE_STAGING_CACHE__STEP_MOCK, ]; +// deploy hybridApp +const PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCK = createMockStep('hybridApp', 'Deploy HybridApp', 'HYBRID_APP'); +const PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCKS = [PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCK]; + // post slack message on failure 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', [ 'SLACK_WEBHOOK', @@ -274,6 +278,7 @@ export default { PLATFORM_DEPLOY__DESKTOP__STEP_MOCKS, PLATFORM_DEPLOY__IOS__STEP_MOCKS, PLATFORM_DEPLOY__WEB__STEP_MOCKS, + PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCKS, PLATFORM_DEPLOY__POST_SLACK_FAIL__STEP_MOCKS, PLATFORM_DEPLOY__POST_SLACK_SUCCESS__STEP_MOCKS, PLATFORM_DEPLOY__POST_GITHUB_COMMENT__STEP_MOCKS, diff --git a/workflow_tests/platformDeploy.test.ts b/workflow_tests/platformDeploy.test.ts index 0ac68eb6d55b..5199d6bd08be 100644 --- a/workflow_tests/platformDeploy.test.ts +++ b/workflow_tests/platformDeploy.test.ts @@ -110,6 +110,10 @@ describe('test workflow platformDeploy', () => { steps: mocks.PLATFORM_DEPLOY__DEPLOY_CHECKLIST__STEP_MOCKS, runsOn: 'ubuntu-latest', }, + hybridApp: { + steps: mocks.PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCKS, + runsOn: 'ubuntu-latest', + }, }; const result = await act.runEvent('push', { workflowFile: path.join(repoPath, '.github', 'workflows', 'platformDeploy.yml'), @@ -121,6 +125,7 @@ describe('test workflow platformDeploy', () => { assertions.assertVerifyActorJobExecuted(result); assertions.assertDeployChecklistJobExecuted(result, true); + assertions.assertHybridAppJobExecuted(result, true); assertions.assertAndroidJobExecuted(result, true, false, true); assertions.assertDesktopJobExecuted(result, true, false); assertions.assertIOSJobExecuted(result, true, false, true); @@ -194,6 +199,10 @@ describe('test workflow platformDeploy', () => { steps: mocks.PLATFORM_DEPLOY__DEPLOY_CHECKLIST__STEP_MOCKS, runsOn: 'ubuntu-latest', }, + hybridApp: { + steps: mocks.PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCKS, + runsOn: 'ubuntu-latest', + }, }; const result = await act.runEvent('push', { workflowFile: path.join(repoPath, '.github', 'workflows', 'platformDeploy.yml'), @@ -205,6 +214,7 @@ describe('test workflow platformDeploy', () => { assertions.assertVerifyActorJobExecuted(result); assertions.assertDeployChecklistJobExecuted(result, true); + assertions.assertHybridAppJobExecuted(result, true); assertions.assertAndroidJobExecuted(result, true, false, true); assertions.assertDesktopJobExecuted(result, true, false); assertions.assertIOSJobExecuted(result, true, false, true); @@ -278,6 +288,10 @@ describe('test workflow platformDeploy', () => { steps: mocks.PLATFORM_DEPLOY__DEPLOY_CHECKLIST__STEP_MOCKS, runsOn: 'ubuntu-latest', }, + hybridApp: { + steps: mocks.PLATFORM_DEPLOY__HYBRID_APP__STEP_MOCKS, + runsOn: 'ubuntu-latest', + }, }; const result = await act.runEvent('push', { workflowFile: path.join(repoPath, '.github', 'workflows', 'platformDeploy.yml'), @@ -289,6 +303,7 @@ describe('test workflow platformDeploy', () => { assertions.assertVerifyActorJobExecuted(result); assertions.assertDeployChecklistJobExecuted(result, true); + assertions.assertHybridAppJobExecuted(result, false); assertions.assertAndroidJobExecuted(result, false); assertions.assertDesktopJobExecuted(result, false); assertions.assertIOSJobExecuted(result, false);