From 1f37901b9db16b31ecf0638754c7186dc3fef320 Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 29 Nov 2023 10:51:07 +0100 Subject: [PATCH 1/2] update java for GitHub Actions --- .github/workflows/platformDeploy.yml | 6 ++++++ .github/workflows/testBuild.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/platformDeploy.yml b/.github/workflows/platformDeploy.yml index 291bd80816b9..bf27006e34a2 100644 --- a/.github/workflows/platformDeploy.yml +++ b/.github/workflows/platformDeploy.yml @@ -56,6 +56,12 @@ jobs: - name: Setup Node uses: ./.github/actions/composite/setupNode + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'oracle' + java-version: '17' + - name: Setup Ruby uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011 with: diff --git a/.github/workflows/testBuild.yml b/.github/workflows/testBuild.yml index 6f222398d04b..94a51a2d11bd 100644 --- a/.github/workflows/testBuild.yml +++ b/.github/workflows/testBuild.yml @@ -84,6 +84,12 @@ jobs: - name: Setup Node uses: ./.github/actions/composite/setupNode + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'oracle' + java-version: '17' + - name: Setup Ruby uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011 with: From 527f01c274d8e751e29808dedaff46150b74039e Mon Sep 17 00:00:00 2001 From: staszekscp Date: Wed, 29 Nov 2023 12:27:09 +0100 Subject: [PATCH 2/2] update tests --- .../assertions/platformDeployAssertions.js | 12 ++++++++++++ workflow_tests/assertions/testBuildAssertions.js | 12 ++++++++++++ workflow_tests/mocks/platformDeployMocks.js | 2 ++ workflow_tests/mocks/testBuildMocks.js | 2 ++ workflow_tests/testBuild.test.js | 4 ++-- 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/workflow_tests/assertions/platformDeployAssertions.js b/workflow_tests/assertions/platformDeployAssertions.js index d398bbf07fdd..458899581687 100644 --- a/workflow_tests/assertions/platformDeployAssertions.js +++ b/workflow_tests/assertions/platformDeployAssertions.js @@ -29,6 +29,18 @@ const assertAndroidJobExecuted = (workflowResult, didExecute = true, isProductio utils.createStepAssertion('Checkout', true, null, 'ANDROID', 'Checking out'), utils.createStepAssertion('Configure MapBox SDK', true, null, 'ANDROID', 'Configure MapBox SDK'), utils.createStepAssertion('Setup Node', true, null, 'ANDROID', 'Setting up Node'), + utils.createStepAssertion( + 'Setup Java', + true, + null, + 'ANDROID', + 'Setup Java', + [ + {key: 'distribution', value: 'oracle'}, + {key: 'java-version', value: '17'}, + ], + [], + ), utils.createStepAssertion('Setup Ruby', true, null, 'ANDROID', 'Setting up Ruby', [ {key: 'ruby-version', value: '2.7'}, {key: 'bundler-cache', value: 'true'}, diff --git a/workflow_tests/assertions/testBuildAssertions.js b/workflow_tests/assertions/testBuildAssertions.js index f65349593faa..781e6bac20a2 100644 --- a/workflow_tests/assertions/testBuildAssertions.js +++ b/workflow_tests/assertions/testBuildAssertions.js @@ -60,6 +60,18 @@ const assertAndroidJobExecuted = (workflowResult, ref = '', didExecute = true, f [], ), utils.createStepAssertion('Setup Node', true, null, 'ANDROID', 'Setup Node', [], []), + utils.createStepAssertion( + 'Setup Java', + true, + null, + 'ANDROID', + 'Setup Java', + [ + {key: 'distribution', value: 'oracle'}, + {key: 'java-version', value: '17'}, + ], + [], + ), utils.createStepAssertion( 'Setup Ruby', true, diff --git a/workflow_tests/mocks/platformDeployMocks.js b/workflow_tests/mocks/platformDeployMocks.js index 2de982dfc731..0d75a5fd74ee 100644 --- a/workflow_tests/mocks/platformDeployMocks.js +++ b/workflow_tests/mocks/platformDeployMocks.js @@ -28,6 +28,7 @@ const PLATFORM_DEPLOY__DEPLOY_CHECKLIST__STEP_MOCKS = [PLATFORM_DEPLOY__DEPLOY_C const PLATFORM_DEPLOY__ANDROID__CHECKOUT__STEP_MOCK = utils.createMockStep('Checkout', 'Checking out', 'ANDROID'); const PLATFORM_DEPLOY__ANDROID__CONFIGURE_MAPBOX_SDK__STEP_MOCK = utils.createMockStep('Configure MapBox SDK', 'Configure MapBox SDK', 'ANDROID'); const PLATFORM_DEPLOY__ANDROID__SETUP_NODE__STEP_MOCK = utils.createMockStep('Setup Node', 'Setting up Node', 'ANDROID'); +const PLATFORM_DEPLOY__ANDROID__SETUP_JAVA__STEP_MOCK = utils.createMockStep('Setup Java', 'Setup Java', 'ANDROID', ['distribution', 'java-version'], []); const PLATFORM_DEPLOY__ANDROID__SETUP_RUBY__STEP_MOCK = utils.createMockStep('Setup Ruby', 'Setting up Ruby', 'ANDROID', ['ruby-version', 'bundler-cache']); const PLATFORM_DEPLOY__ANDROID__DECRYPT_KEYSTORE__STEP_MOCK = utils.createMockStep('Decrypt keystore', 'Decrypting keystore', 'ANDROID', null, ['LARGE_SECRET_PASSPHRASE']); const PLATFORM_DEPLOY__ANDROID__DECRYPT_JSON_KEY__STEP_MOCK = utils.createMockStep('Decrypt json key', 'Decrypting JSON key', 'ANDROID', null, ['LARGE_SECRET_PASSPHRASE']); @@ -62,6 +63,7 @@ const PLATFORM_DEPLOY__ANDROID__STEP_MOCKS = [ PLATFORM_DEPLOY__ANDROID__CHECKOUT__STEP_MOCK, PLATFORM_DEPLOY__ANDROID__CONFIGURE_MAPBOX_SDK__STEP_MOCK, PLATFORM_DEPLOY__ANDROID__SETUP_NODE__STEP_MOCK, + PLATFORM_DEPLOY__ANDROID__SETUP_JAVA__STEP_MOCK, PLATFORM_DEPLOY__ANDROID__SETUP_RUBY__STEP_MOCK, PLATFORM_DEPLOY__ANDROID__DECRYPT_KEYSTORE__STEP_MOCK, PLATFORM_DEPLOY__ANDROID__DECRYPT_JSON_KEY__STEP_MOCK, diff --git a/workflow_tests/mocks/testBuildMocks.js b/workflow_tests/mocks/testBuildMocks.js index bdff0ac57ae1..d7ae9abdb8e7 100644 --- a/workflow_tests/mocks/testBuildMocks.js +++ b/workflow_tests/mocks/testBuildMocks.js @@ -62,6 +62,7 @@ const TESTBUILD__ANDROID__CREATE_ENV_ADHOC__STEP_MOCK = utils.createMockStep( [], ); const TESTBUILD__ANDROID__SETUP_NODE__STEP_MOCK = utils.createMockStep('Setup Node', 'Setup Node', 'ANDROID', [], []); +const TESTBUILD__ANDROID__SETUP_JAVA__STEP_MOCK = utils.createMockStep('Setup Java', 'Setup Java', 'ANDROID', ['distribution', 'java-version'], []); const TESTBUILD__ANDROID__SETUP_RUBY__STEP_MOCK = utils.createMockStep('Setup Ruby', 'Setup Ruby', 'ANDROID', ['ruby-version', 'bundler-cache'], []); const TESTBUILD__ANDROID__DECRYPT_KEYSTORE__STEP_MOCK = utils.createMockStep('Decrypt keystore', 'Decrypt keystore', 'ANDROID', [], ['LARGE_SECRET_PASSPHRASE']); const TESTBUILD__ANDROID__DECRYPT_JSON_KEY__STEP_MOCK = utils.createMockStep('Decrypt json key', 'Decrypt json key', 'ANDROID', [], ['LARGE_SECRET_PASSPHRASE']); @@ -85,6 +86,7 @@ const TESTBUILD__ANDROID__STEP_MOCKS = [ TESTBUILD__ANDROID__CHECKOUT__STEP_MOCK, TESTBUILD__ANDROID__CREATE_ENV_ADHOC__STEP_MOCK, TESTBUILD__ANDROID__SETUP_NODE__STEP_MOCK, + TESTBUILD__ANDROID__SETUP_JAVA__STEP_MOCK, TESTBUILD__ANDROID__SETUP_RUBY__STEP_MOCK, TESTBUILD__ANDROID__DECRYPT_KEYSTORE__STEP_MOCK, TESTBUILD__ANDROID__DECRYPT_JSON_KEY__STEP_MOCK, diff --git a/workflow_tests/testBuild.test.js b/workflow_tests/testBuild.test.js index 4288ea236ab2..f50032f0c54a 100644 --- a/workflow_tests/testBuild.test.js +++ b/workflow_tests/testBuild.test.js @@ -201,7 +201,7 @@ describe('test workflow testBuild', () => { web: mocks.TESTBUILD__WEB__STEP_MOCKS, postGithubComment: mocks.TESTBUILD__POSTGITHUBCOMMENT__STEP_MOCKS, }; - testMockSteps.android[4] = utils.createMockStep('Decrypt keystore', 'Decrypt keystore', 'ANDROID', [], ['LARGE_SECRET_PASSPHRASE'], {}, {}, false); + testMockSteps.android[5] = utils.createMockStep('Decrypt keystore', 'Decrypt keystore', 'ANDROID', [], ['LARGE_SECRET_PASSPHRASE'], {}, {}, false); const result = await act.runEvent(event, { workflowFile: path.join(repoPath, '.github', 'workflows', 'testBuild.yml'), mockSteps: testMockSteps, @@ -211,7 +211,7 @@ describe('test workflow testBuild', () => { assertions.assertValidateActorJobExecuted(result, '1234'); assertions.assertGetBranchRefJobExecuted(result); - assertions.assertAndroidJobExecuted(result, 'test-ref', true, 4); + assertions.assertAndroidJobExecuted(result, 'test-ref', true, 5); assertions.assertIOSJobExecuted(result, 'test-ref'); assertions.assertDesktopJobExecuted(result, 'test-ref'); assertions.assertWebJobExecuted(result, 'test-ref');