diff --git a/.codebuild/e2e_workflow.yml b/.codebuild/e2e_workflow.yml index 1c420534c..9db86c9b6 100644 --- a/.codebuild/e2e_workflow.yml +++ b/.codebuild/e2e_workflow.yml @@ -63,7 +63,7 @@ batch: depend-on: - publish_to_local_registry - identifier: >- - add_codegen_ios_configure_codegen_android_configure_codegen_js_graphql_codegen_android + l-add_codegen_ios_configure_codegen_android_configure_codegen_js_graphql_codegen_android buildspec: .codebuild/run_e2e_tests.yml env: compute-type: BUILD_GENERAL1_LARGE @@ -74,7 +74,7 @@ batch: depend-on: - publish_to_local_registry - identifier: >- - graphql_codegen_js_remove_codegen_android_remove_codegen_ios_add_codegen_android + l-graphql_codegen_js_remove_codegen_android_remove_codegen_ios_add_codegen_android buildspec: .codebuild/run_e2e_tests.yml env: compute-type: BUILD_GENERAL1_LARGE @@ -85,7 +85,7 @@ batch: depend-on: - publish_to_local_registry - identifier: >- - configure_codegen_ios_datastore_modelgen_android_datastore_modelgen_js_feature_flags + l-configure_codegen_ios_datastore_modelgen_android_datastore_modelgen_js_feature_flags buildspec: .codebuild/run_e2e_tests.yml env: compute-type: BUILD_GENERAL1_LARGE @@ -96,7 +96,7 @@ batch: depend-on: - publish_to_local_registry - identifier: >- - graphql_codegen_ios_add_codegen_js_datastore_modelgen_ios_remove_codegen_js + l-graphql_codegen_ios_add_codegen_js_datastore_modelgen_ios_remove_codegen_js buildspec: .codebuild/run_e2e_tests.yml env: compute-type: BUILD_GENERAL1_LARGE @@ -107,7 +107,7 @@ batch: depend-on: - publish_to_local_registry - identifier: >- - datastore_modelgen_flutter_env_codegen_model_introspection_codegen_pull_codegen + l-datastore_modelgen_flutter_env_codegen_model_introspection_codegen_pull_codegen buildspec: .codebuild/run_e2e_tests.yml env: compute-type: BUILD_GENERAL1_LARGE @@ -118,7 +118,7 @@ batch: depend-on: - publish_to_local_registry - identifier: >- - push_codegen_ios_push_codegen_android_graphql_documents_generator_push_codegen_js + l-push_codegen_ios_push_codegen_android_graphql_documents_generator_push_codegen_js buildspec: .codebuild/run_e2e_tests.yml env: compute-type: BUILD_GENERAL1_LARGE @@ -129,7 +129,7 @@ batch: depend-on: - publish_to_local_registry - identifier: >- - build_app_ts_uninitialized_project_codegen_js_uninitialized_project_modelgen_android_uninitialized_project_modelgen_flutter + l-build_app_ts_uninitialized_project_codegen_js_uninitialized_project_modelgen_android_uninitialized_project_modelgen_flutter buildspec: .codebuild/run_e2e_tests.yml env: compute-type: BUILD_GENERAL1_LARGE @@ -139,7 +139,94 @@ batch: CLI_REGION: ap-southeast-1 depend-on: - publish_to_local_registry - - identifier: uninitialized_project_modelgen_ios_uninitialized_project_modelgen_js + - identifier: l-uninitialized_project_modelgen_ios_uninitialized_project_modelgen_js + buildspec: .codebuild/run_e2e_tests.yml + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + TEST_SUITE: >- + src/__tests__/uninitialized-project-modelgen-ios.test.ts|src/__tests__/uninitialized-project-modelgen-js.test.ts + CLI_REGION: ap-southeast-2 + depend-on: + - publish_to_local_registry + - identifier: >- + w-add_codegen_ios_configure_codegen_android_configure_codegen_js_graphql_codegen_android + buildspec: .codebuild/run_e2e_tests.yml + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + TEST_SUITE: >- + src/__tests__/add-codegen-ios.test.ts|src/__tests__/configure-codegen-android.test.ts|src/__tests__/configure-codegen-js.test.ts|src/__tests__/graphql-codegen-android.test.ts + CLI_REGION: us-east-1 + depend-on: + - publish_to_local_registry + - identifier: >- + w-graphql_codegen_js_remove_codegen_android_remove_codegen_ios_add_codegen_android + buildspec: .codebuild/run_e2e_tests.yml + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + TEST_SUITE: >- + src/__tests__/graphql-codegen-js.test.ts|src/__tests__/remove-codegen-android.test.ts|src/__tests__/remove-codegen-ios.test.ts|src/__tests__/add-codegen-android.test.ts + CLI_REGION: us-east-2 + depend-on: + - publish_to_local_registry + - identifier: >- + w-configure_codegen_ios_datastore_modelgen_android_datastore_modelgen_js_feature_flags + buildspec: .codebuild/run_e2e_tests.yml + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + TEST_SUITE: >- + src/__tests__/configure-codegen-ios.test.ts|src/__tests__/datastore-modelgen-android.test.ts|src/__tests__/datastore-modelgen-js.test.ts|src/__tests__/feature-flags.test.ts + CLI_REGION: us-west-2 + depend-on: + - publish_to_local_registry + - identifier: >- + w-graphql_codegen_ios_add_codegen_js_datastore_modelgen_ios_remove_codegen_js + buildspec: .codebuild/run_e2e_tests.yml + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + TEST_SUITE: >- + src/__tests__/graphql-codegen-ios.test.ts|src/__tests__/add-codegen-js.test.ts|src/__tests__/datastore-modelgen-ios.test.ts|src/__tests__/remove-codegen-js.test.ts + CLI_REGION: eu-west-2 + depend-on: + - publish_to_local_registry + - identifier: >- + w-datastore_modelgen_flutter_env_codegen_model_introspection_codegen_pull_codegen + buildspec: .codebuild/run_e2e_tests.yml + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + TEST_SUITE: >- + src/__tests__/datastore-modelgen-flutter.test.ts|src/__tests__/env-codegen.test.ts|src/__tests__/model-introspection-codegen.test.ts|src/__tests__/pull-codegen.test.ts + CLI_REGION: eu-central-1 + depend-on: + - publish_to_local_registry + - identifier: >- + w-push_codegen_ios_push_codegen_android_graphql_documents_generator_push_codegen_js + buildspec: .codebuild/run_e2e_tests.yml + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + TEST_SUITE: >- + src/__tests__/push-codegen-ios.test.ts|src/__tests__/push-codegen-android.test.ts|src/__tests__/graphql-documents-generator.test.ts|src/__tests__/push-codegen-js.test.ts + CLI_REGION: ap-northeast-1 + depend-on: + - publish_to_local_registry + - identifier: >- + w-build_app_ts_uninitialized_project_codegen_js_uninitialized_project_modelgen_android_uninitialized_project_modelgen_flutter + buildspec: .codebuild/run_e2e_tests.yml + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + TEST_SUITE: >- + src/__tests__/build-app-ts.test.ts|src/__tests__/uninitialized-project-codegen-js.test.ts|src/__tests__/uninitialized-project-modelgen-android.test.ts|src/__tests__/uninitialized-project-modelgen-flutter.test.ts + CLI_REGION: ap-southeast-1 + depend-on: + - publish_to_local_registry + - identifier: w-uninitialized_project_modelgen_ios_uninitialized_project_modelgen_js buildspec: .codebuild/run_e2e_tests.yml env: compute-type: BUILD_GENERAL1_LARGE @@ -155,4 +242,4 @@ batch: compute-type: BUILD_GENERAL1_MEDIUM depend-on: - >- - add_codegen_ios_configure_codegen_android_configure_codegen_js_graphql_codegen_android + l-add_codegen_ios_configure_codegen_android_configure_codegen_js_graphql_codegen_android diff --git a/.codebuild/run_e2e_tests_windows.yml b/.codebuild/run_e2e_tests_windows.yml new file mode 100644 index 000000000..2729883c0 --- /dev/null +++ b/.codebuild/run_e2e_tests_windows.yml @@ -0,0 +1,24 @@ +version: 0.2 +env: + shell: powershell.exe + shell: bash + variables: + AMPLIFY_DIR: /root/.npm-global/lib/node_modules/@aws-amplify/cli-internal/bin + AMPLIFY_PATH: /root/.npm-global/lib/node_modules/@aws-amplify/cli-internal/bin/amplify + CI: true + CODEBUILD: true + NODE_OPTIONS: --max-old-space-size=8096 +phases: + build: + commands: + # commands need to be run in stand-alone bash scripts so that bash can be used on windows + - bash ./.codebuild/scripts/e2e_test_windows.sh + post_build: + commands: + # commands need to be run in stand-alone bash scripts so that bash can be used on windows + - bash ./.codebuild/scripts/post_e2e_test.sh + +artifacts: + files: + - '**/*' + base-directory: $CODEBUILD_SRC_DIR/packages/amplify-codegen-e2e-tests/amplify-e2e-reports diff --git a/.codebuild/scripts/e2e_test_windows.sh b/.codebuild/scripts/e2e_test_windows.sh new file mode 100755 index 000000000..1cdcee9fb --- /dev/null +++ b/.codebuild/scripts/e2e_test_windows.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# set exit on error to true +set -e + +source ./shared-scripts.sh && _setupE2ETestsWindows +codebuild-breakpoint +source ./shared-scripts.sh && _runE2ETestsWindows diff --git a/.codebuild/scripts/post_e2e_test.sh b/.codebuild/scripts/post_e2e_test.sh new file mode 100755 index 000000000..a9dd7a490 --- /dev/null +++ b/.codebuild/scripts/post_e2e_test.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# set exit on error to true +set -e + +source ./shared-scripts.sh && _unassumeTestAccountCredentials +aws sts get-caller-identity +source ./shared-scripts.sh && _scanArtifacts diff --git a/scripts/split-e2e-tests.ts b/scripts/split-e2e-tests.ts index 445ecebdd..ef8db1c86 100644 --- a/scripts/split-e2e-tests.ts +++ b/scripts/split-e2e-tests.ts @@ -148,12 +148,13 @@ const splitTests = ( return [...osJobs, ...soloJobs]; }; const linuxJobs = generateJobsForOS('l'); + const windowsJobs = generateJobsForOS('w'); const getIdentifier = (os: string, names: string) => { - const jobName = `${names.replace(/-/g, '_')}`.substring(0, 127); + const jobName = `${os}-${names.replace(/-/g, '_')}`.substring(0, 127); return jobName; }; const result: any[] = []; - linuxJobs.forEach((j) => { + [...linuxJobs, ...windowsJobs].forEach((j) => { if (j.tests.length !== 0) { const names = j.tests.map((tn) => getTestNameFromPath(tn)).join('_'); const tmp = { diff --git a/shared-scripts.sh b/shared-scripts.sh index 78f7f9eec..7c1ee855e 100644 --- a/shared-scripts.sh +++ b/shared-scripts.sh @@ -235,16 +235,31 @@ function _setupE2ETestsLinux { echo "Setup E2E Tests Linux" loadCacheFromLinuxBuildJob loadCache verdaccio-cache $CODEBUILD_SRC_DIR/../verdaccio-cache + _installCLIFromLocalRegistry + _loadTestAccountCredentials + _setShell +} + +function _setupE2ETestsWindows { + echo "Setup E2E Tests Linux" + loadCacheFromWindowsBuildJob + loadCache verdaccio-cache $CODEBUILD_SRC_DIR/../verdaccio-cache _installCLIFromLocalRegistry _loadTestAccountCredentials _setShell } + function _runE2ETestsLinux { echo "RUN E2E Tests Linux" retry runE2eTest } +function _runE2ETestsWindows { + echo "RUN E2E Tests Windows" + retry runE2eTest +} + function _scanArtifacts { if ! yarn ts-node .codebuild/scripts/scan_artifacts.ts; then echo "Cleaning the repository"