Skip to content

Commit

Permalink
ci: e2e tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch committed Oct 23, 2023
1 parent f84e1c6 commit 708cb79
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 11 deletions.
105 changes: 96 additions & 9 deletions .codebuild/e2e_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
24 changes: 24 additions & 0 deletions .codebuild/run_e2e_tests_windows.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .codebuild/scripts/e2e_test_windows.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions .codebuild/scripts/post_e2e_test.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 3 additions & 2 deletions scripts/split-e2e-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
15 changes: 15 additions & 0 deletions shared-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 708cb79

Please sign in to comment.