Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HybridApp deploy to platform deploy #43046

Merged
merged 5 commits into from
Jun 4, 2024
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
7 changes: 7 additions & 0 deletions .github/workflows/platformDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions workflow_tests/assertions/platformDeployAssertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -379,6 +391,7 @@ function assertPostGithubCommentJobExecuted(workflowResult: Step[], didExecute =
export default {
assertVerifyActorJobExecuted,
assertDeployChecklistJobExecuted,
assertHybridAppJobExecuted,
assertAndroidJobExecuted,
assertDesktopJobExecuted,
assertIOSJobExecuted,
Expand Down
5 changes: 5 additions & 0 deletions workflow_tests/mocks/platformDeployMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 15 additions & 0 deletions workflow_tests/platformDeploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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);
Expand Down Expand Up @@ -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'),
Expand All @@ -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);
Expand Down Expand Up @@ -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'),
Expand All @@ -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);
Expand Down
Loading