From 922654f5e4f040a7bce7920f2c210dbbb733b2e2 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Wed, 1 Mar 2023 10:57:41 -0500 Subject: [PATCH 001/107] feat: adding codebuild specs --- codebuild_specs/config.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 codebuild_specs/config.yml diff --git a/codebuild_specs/config.yml b/codebuild_specs/config.yml new file mode 100644 index 00000000000..c57bb9877fa --- /dev/null +++ b/codebuild_specs/config.yml @@ -0,0 +1,16 @@ +version: 0.1 +phases: + install: + runtime-versions: + nodejs: 16 + pre_build: + commands: + - yarn production-build + - yarn build-tests + - echo 'Pre-Build phase completed!' + build: + commands: + - echo 'Build phase completed!' +artifacts: + files: + - '**/*' From b3bbe2e8d8c6cbd3b660a324ec26f72f4068916c Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Fri, 3 Mar 2023 15:52:07 -0500 Subject: [PATCH 002/107] Update config.yml --- codebuild_specs/config.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/codebuild_specs/config.yml b/codebuild_specs/config.yml index c57bb9877fa..4040c79c8dc 100644 --- a/codebuild_specs/config.yml +++ b/codebuild_specs/config.yml @@ -1,4 +1,4 @@ -version: 0.1 +version: 0.2 phases: install: runtime-versions: @@ -11,6 +11,8 @@ phases: build: commands: - echo 'Build phase completed!' +batch: + fast-fail: true artifacts: files: - '**/*' From 8b42fbbf6c8bbead45a85f4cc1ef9ad3fa566f41 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Fri, 3 Mar 2023 16:00:01 -0500 Subject: [PATCH 003/107] get npm version installed --- codebuild_specs/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/codebuild_specs/config.yml b/codebuild_specs/config.yml index 4040c79c8dc..e6445ef3d90 100644 --- a/codebuild_specs/config.yml +++ b/codebuild_specs/config.yml @@ -5,8 +5,7 @@ phases: nodejs: 16 pre_build: commands: - - yarn production-build - - yarn build-tests + - npm --version - echo 'Pre-Build phase completed!' build: commands: From f1a081af0130704c62ed98203ffca32da390950c Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Fri, 3 Mar 2023 16:15:55 -0500 Subject: [PATCH 004/107] installing deps --- codebuild_specs/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codebuild_specs/config.yml b/codebuild_specs/config.yml index e6445ef3d90..d299bdaf5c9 100644 --- a/codebuild_specs/config.yml +++ b/codebuild_specs/config.yml @@ -3,6 +3,8 @@ phases: install: runtime-versions: nodejs: 16 + commands: + - npm install pre_build: commands: - npm --version From b254165d86aaa87e61822d079a1c6252c8b89625 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Fri, 3 Mar 2023 16:43:02 -0500 Subject: [PATCH 005/107] Update config.yml --- codebuild_specs/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/codebuild_specs/config.yml b/codebuild_specs/config.yml index d299bdaf5c9..90a3b707f32 100644 --- a/codebuild_specs/config.yml +++ b/codebuild_specs/config.yml @@ -5,6 +5,7 @@ phases: nodejs: 16 commands: - npm install + - echo "Install phase" pre_build: commands: - npm --version From 4c69bc0aa3386ee0189d9647ee69a97d088f7515 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Sun, 5 Mar 2023 11:10:56 -0500 Subject: [PATCH 006/107] change version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a4cec2bdcff..45c1c7e0747 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amplify-cli", - "version": "0.1.0", + "version": "0.2.0", "description": "amplify-cli", "scripts": { "addwords": "node ./scripts/add-to-dict.js", From 312df6ae053d4b8c7a74e1df5dde68ef1d30bb72 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Sun, 5 Mar 2023 11:12:53 -0500 Subject: [PATCH 007/107] revert change --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 45c1c7e0747..a4cec2bdcff 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amplify-cli", - "version": "0.2.0", + "version": "0.1.0", "description": "amplify-cli", "scripts": { "addwords": "node ./scripts/add-to-dict.js", From 001e17b6e2935e62a07b1e946a2ffe1360c86b4b Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 6 Mar 2023 15:22:58 -0500 Subject: [PATCH 008/107] Rename config.yml to demo.yml --- codebuild_specs/{config.yml => demo.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename codebuild_specs/{config.yml => demo.yml} (100%) diff --git a/codebuild_specs/config.yml b/codebuild_specs/demo.yml similarity index 100% rename from codebuild_specs/config.yml rename to codebuild_specs/demo.yml From 0ff62e18a02a85eb1b723e7d2a60bad74c0c87a6 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 6 Mar 2023 16:15:57 -0500 Subject: [PATCH 009/107] Create buildspec.yml --- buildspec.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 buildspec.yml diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 00000000000..0d3adaff424 --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,15 @@ +version: 0.2 + +phases: + install: + runtime-versions: + java: node16 + pre_build: + commands: + - echo Nothing to do in the pre_build phase... + build: + commands: + - echo Build started on `date` + post_build: + commands: + - echo Build completed on `date` From 008922c4866fcf4964a40ccfeb0e8092400efdb5 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 6 Mar 2023 16:21:35 -0500 Subject: [PATCH 010/107] Update buildspec.yml --- buildspec.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/buildspec.yml b/buildspec.yml index 0d3adaff424..db20d54cf3d 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -1,9 +1,12 @@ version: 0.2 +batch: + fast-fail: false + phases: install: runtime-versions: - java: node16 + nodejs: 16 pre_build: commands: - echo Nothing to do in the pre_build phase... From b9c1126723cc4bc8942ad3add6354cdfc655fe17 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 6 Mar 2023 17:13:01 -0500 Subject: [PATCH 011/107] Update buildspec.yml --- buildspec.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/buildspec.yml b/buildspec.yml index db20d54cf3d..1d3fa5c7f37 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -1,8 +1,5 @@ version: 0.2 -batch: - fast-fail: false - phases: install: runtime-versions: From 40364aa60a00fc22143236d942fed37d9b7e1746 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 7 Mar 2023 03:22:34 -0500 Subject: [PATCH 012/107] Rename buildspec.yml to buildspec.yaml --- buildspec.yml => buildspec.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename buildspec.yml => buildspec.yaml (100%) diff --git a/buildspec.yml b/buildspec.yaml similarity index 100% rename from buildspec.yml rename to buildspec.yaml From df1bf25f00fe30e2cf59f50d70e320378ddda5a0 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 7 Mar 2023 22:13:02 -0500 Subject: [PATCH 013/107] Update demo.yml removing quotes --- codebuild_specs/demo.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index 90a3b707f32..5b0c8b8f226 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -5,14 +5,14 @@ phases: nodejs: 16 commands: - npm install - - echo "Install phase" + - echo Install phase pre_build: commands: - npm --version - - echo 'Pre-Build phase completed!' + - echo Pre-Build phase completed! build: commands: - - echo 'Build phase completed!' + - echo Build phase completed! batch: fast-fail: true artifacts: From 8903877a9b5bff4f7369275af4dcd23411cb392c Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 7 Mar 2023 22:18:20 -0500 Subject: [PATCH 014/107] Update demo.yml --- codebuild_specs/demo.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index 5b0c8b8f226..9cee21977d1 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -2,19 +2,25 @@ version: 0.2 phases: install: runtime-versions: - nodejs: 16 - commands: - - npm install - - echo Install phase + nodejs: 14 pre_build: commands: - - npm --version + - yarn production-build + - yarn build-tests - echo Pre-Build phase completed! build: - commands: + commands: + - echo Unit tests + - echo Verify API extract - echo Build phase completed! -batch: - fast-fail: true + - echo ${S3_BUILD_CACHE:-'undefined'} + post_build: + commands: + - echo Yarn cache directory + - yarn cache dir artifacts: files: - '**/*' +cache: + paths: + - '~/.cache/yarn/**/*' From 87b10e7f52ed08a26f208428d4bbfa4305c0d0c6 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 7 Mar 2023 22:20:26 -0500 Subject: [PATCH 015/107] Update demo.yml --- codebuild_specs/demo.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index 9cee21977d1..fb1a1e2cd99 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -21,6 +21,8 @@ phases: artifacts: files: - '**/*' +batch: + fast-fail: false cache: paths: - '~/.cache/yarn/**/*' From 75a5471e8abade560cb6dff20398c8bf658b2a5e Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 7 Mar 2023 22:22:12 -0500 Subject: [PATCH 016/107] Update demo.yml --- codebuild_specs/demo.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index fb1a1e2cd99..d156722627b 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -23,6 +23,9 @@ artifacts: - '**/*' batch: fast-fail: false + build-list: + - identifier: build1 + cache: paths: - '~/.cache/yarn/**/*' From 691f43588a9f9251d24cfc54ade42db9ab99263e Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 7 Mar 2023 22:24:34 -0500 Subject: [PATCH 017/107] Update demo.yml --- codebuild_specs/demo.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index d156722627b..740a71165c5 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -23,8 +23,8 @@ artifacts: - '**/*' batch: fast-fail: false - build-list: - - identifier: build1 + build-list: + - identifier: build1 cache: paths: From 634b09554c9db7a0118b9f99a52ed1a6d7cc0f32 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Wed, 8 Mar 2023 11:39:42 -0500 Subject: [PATCH 018/107] Update demo.yml --- codebuild_specs/demo.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index 740a71165c5..fac264aabf1 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -5,19 +5,16 @@ phases: nodejs: 14 pre_build: commands: - - yarn production-build - - yarn build-tests + - yarn install + - yarn config set script-shell $(which bash) - echo Pre-Build phase completed! build: commands: - - echo Unit tests - - echo Verify API extract - - echo Build phase completed! - - echo ${S3_BUILD_CACHE:-'undefined'} + - yarn production-build + - yarn build-tests post_build: commands: - - echo Yarn cache directory - - yarn cache dir + - yarn test artifacts: files: - '**/*' From ad259db70ff2c75eaab3e6913b7b47403d2066f6 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Wed, 8 Mar 2023 12:32:03 -0500 Subject: [PATCH 019/107] Update demo.yml --- codebuild_specs/demo.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index fac264aabf1..7222ae9efc7 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -3,26 +3,29 @@ phases: install: runtime-versions: nodejs: 14 - pre_build: commands: - yarn install + pre_build: + commands: - yarn config set script-shell $(which bash) - - echo Pre-Build phase completed! + - echo Pre-build completed build: - commands: - - yarn production-build - - yarn build-tests + commands: + - yarn run production-build post_build: commands: - - yarn test + - yarn lint-check + - yarn test-ci + - yarn verify-api-extract + - yarn verify-yarn-lock + - echo Post build complete artifacts: files: - '**/*' batch: - fast-fail: false + fast-fail: true build-list: - identifier: build1 - cache: paths: - '~/.cache/yarn/**/*' From a673ba11e5d764d436f769ee99c8857d3df10df2 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Thu, 9 Mar 2023 11:15:28 -0500 Subject: [PATCH 020/107] limit old space size within node options --- codebuild_specs/demo.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index 7222ae9efc7..6aa039b9911 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -26,6 +26,9 @@ batch: fast-fail: true build-list: - identifier: build1 + env: + variables: + NODE_OPTIONS: --max-old-space-size=4096 cache: paths: - '~/.cache/yarn/**/*' From a0509e2eb9ff5a4f457e0932be436ec118b67e3c Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Thu, 9 Mar 2023 11:18:27 -0500 Subject: [PATCH 021/107] typo --- codebuild_specs/demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index 6aa039b9911..c2f12621d31 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -28,7 +28,7 @@ batch: - identifier: build1 env: variables: - NODE_OPTIONS: --max-old-space-size=4096 + - NODE_OPTIONS: --max-old-space-size=4096 cache: paths: - '~/.cache/yarn/**/*' From c0f7dfc4edc6f7fda03b3c209e8d01bd44102eb6 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Thu, 9 Mar 2023 11:21:55 -0500 Subject: [PATCH 022/107] Update demo.yml --- codebuild_specs/demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index c2f12621d31..12cf3274152 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -26,7 +26,7 @@ batch: fast-fail: true build-list: - identifier: build1 - env: + env: variables: - NODE_OPTIONS: --max-old-space-size=4096 cache: From e471db97addb7c62f55e7c94ad83dce17b0a2829 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Thu, 9 Mar 2023 11:24:06 -0500 Subject: [PATCH 023/107] Update demo.yml --- codebuild_specs/demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index 12cf3274152..4d869b6ef8d 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -28,7 +28,7 @@ batch: - identifier: build1 env: variables: - - NODE_OPTIONS: --max-old-space-size=4096 + - NODE_OPTIONS: `--max-old-space-size=4096` cache: paths: - '~/.cache/yarn/**/*' From 16833f399ff462177fd9a0e52117fb9766e62d26 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Thu, 9 Mar 2023 11:25:43 -0500 Subject: [PATCH 024/107] Update demo.yml --- codebuild_specs/demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index 4d869b6ef8d..52a68a7c749 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -28,7 +28,7 @@ batch: - identifier: build1 env: variables: - - NODE_OPTIONS: `--max-old-space-size=4096` + - NODE_OPTIONS: '--max-old-space-size=4096' cache: paths: - '~/.cache/yarn/**/*' From cedd6b415ec77da5e11b57d2af0f00550e4bb887 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Thu, 9 Mar 2023 11:58:23 -0500 Subject: [PATCH 025/107] Update demo.yml --- codebuild_specs/demo.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index 52a68a7c749..d3d047ec322 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -1,3 +1,4 @@ +--- version: 0.2 phases: install: @@ -21,14 +22,14 @@ phases: - echo Post build complete artifacts: files: - - '**/*' + - "**/*" batch: fast-fail: true build-list: - identifier: build1 env: variables: - - NODE_OPTIONS: '--max-old-space-size=4096' + - NODE_OPTIONS: --max-old-space-size=4096 cache: paths: - - '~/.cache/yarn/**/*' + - ~/.cache/yarn/**/* From 6b9588a00120dd9558514537520ac2384eb9ca8b Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Thu, 9 Mar 2023 12:02:21 -0500 Subject: [PATCH 026/107] Update demo.yml --- codebuild_specs/demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index d3d047ec322..3ae7534d04f 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -29,7 +29,7 @@ batch: - identifier: build1 env: variables: - - NODE_OPTIONS: --max-old-space-size=4096 + - NODE_OPTIONS: "--max-old-space-size=4096" cache: paths: - ~/.cache/yarn/**/* From 51e5d7bc4901f274d1a31c4e14d679f5ff700365 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Thu, 9 Mar 2023 12:06:28 -0500 Subject: [PATCH 027/107] Update demo.yml --- codebuild_specs/demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index 3ae7534d04f..5331195da79 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -29,7 +29,7 @@ batch: - identifier: build1 env: variables: - - NODE_OPTIONS: "--max-old-space-size=4096" + NODE_OPTIONS: "--max-old-space-size=4096" cache: paths: - ~/.cache/yarn/**/* From 59a15390902bb65327c0dd85705b5b322bc960d5 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Thu, 9 Mar 2023 12:40:58 -0500 Subject: [PATCH 028/107] Update demo.yml --- codebuild_specs/demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml index 5331195da79..ec18344d96e 100644 --- a/codebuild_specs/demo.yml +++ b/codebuild_specs/demo.yml @@ -29,7 +29,7 @@ batch: - identifier: build1 env: variables: - NODE_OPTIONS: "--max-old-space-size=4096" + NODE_OPTIONS: --max-old-space-size=4096 cache: paths: - ~/.cache/yarn/**/* From eeeff676e07a909d29bc12c119fb241476f5d77f Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Sat, 11 Mar 2023 15:37:53 -0500 Subject: [PATCH 029/107] chore: cleaning up repo --- buildspec.yaml | 15 ------------ codebuild_specs/base.yml | 23 ++++++++++++++++++ codebuild_specs/demo.yml | 35 --------------------------- codebuild_specs/prepare-build.yml | 13 ++++++++++ codebuild_specs/validate-packages.yml | 12 +++++++++ 5 files changed, 48 insertions(+), 50 deletions(-) delete mode 100644 buildspec.yaml create mode 100644 codebuild_specs/base.yml delete mode 100644 codebuild_specs/demo.yml create mode 100644 codebuild_specs/prepare-build.yml create mode 100644 codebuild_specs/validate-packages.yml diff --git a/buildspec.yaml b/buildspec.yaml deleted file mode 100644 index 1d3fa5c7f37..00000000000 --- a/buildspec.yaml +++ /dev/null @@ -1,15 +0,0 @@ -version: 0.2 - -phases: - install: - runtime-versions: - nodejs: 16 - pre_build: - commands: - - echo Nothing to do in the pre_build phase... - build: - commands: - - echo Build started on `date` - post_build: - commands: - - echo Build completed on `date` diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml new file mode 100644 index 00000000000..bd91f8c651a --- /dev/null +++ b/codebuild_specs/base.yml @@ -0,0 +1,23 @@ +--- +version: 0.2 +phases: + install: + runtime-versions: + nodejs: 14 + commands: + - yarn install +artifacts: + files: + - '**/*' +batch: + fast-fail: true + build-graph: + - identifier: prepare-build + buildspec: prepare-build.yml + - identifier: validate-packages + buildspec: validate-packages.yml + depend-on: + - prepare-build +cache: + paths: + - ~/.cache/yarn/**/* diff --git a/codebuild_specs/demo.yml b/codebuild_specs/demo.yml deleted file mode 100644 index ec18344d96e..00000000000 --- a/codebuild_specs/demo.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -version: 0.2 -phases: - install: - runtime-versions: - nodejs: 14 - commands: - - yarn install - pre_build: - commands: - - yarn config set script-shell $(which bash) - - echo Pre-build completed - build: - commands: - - yarn run production-build - post_build: - commands: - - yarn lint-check - - yarn test-ci - - yarn verify-api-extract - - yarn verify-yarn-lock - - echo Post build complete -artifacts: - files: - - "**/*" -batch: - fast-fail: true - build-list: - - identifier: build1 - env: - variables: - NODE_OPTIONS: --max-old-space-size=4096 -cache: - paths: - - ~/.cache/yarn/**/* diff --git a/codebuild_specs/prepare-build.yml b/codebuild_specs/prepare-build.yml new file mode 100644 index 00000000000..cb462c1a0e3 --- /dev/null +++ b/codebuild_specs/prepare-build.yml @@ -0,0 +1,13 @@ +--- +version: 0.2 +phases: + set-shell: + commands: + - yarn config set script-shell $(which bash) + - echo setting shell complete + build: + commands: + - yarn run production-build + build-tests: + commands: + - yarn build-tests diff --git a/codebuild_specs/validate-packages.yml b/codebuild_specs/validate-packages.yml new file mode 100644 index 00000000000..6e86ed8b63d --- /dev/null +++ b/codebuild_specs/validate-packages.yml @@ -0,0 +1,12 @@ +version: 0.2 +batch: + fast-fail: false + build-list: +phases: + post_build: + commands: + - yarn lint-check + - yarn test-ci + - yarn verify-api-extract + - yarn verify-yarn-lock + - echo Post build complete From b95d4ab945f6bd5b558c69cc1fdfd38ec75e21eb Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Sat, 11 Mar 2023 15:41:01 -0500 Subject: [PATCH 030/107] chore: fixing file names --- codebuild_specs/base.yml | 8 ++++---- codebuild_specs/{prepare-build.yml => prepare_build.yml} | 0 .../{validate-packages.yml => validate_packages.yml} | 0 3 files changed, 4 insertions(+), 4 deletions(-) rename codebuild_specs/{prepare-build.yml => prepare_build.yml} (100%) rename codebuild_specs/{validate-packages.yml => validate_packages.yml} (100%) diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml index bd91f8c651a..1d233abe45a 100644 --- a/codebuild_specs/base.yml +++ b/codebuild_specs/base.yml @@ -12,10 +12,10 @@ artifacts: batch: fast-fail: true build-graph: - - identifier: prepare-build - buildspec: prepare-build.yml - - identifier: validate-packages - buildspec: validate-packages.yml + - identifier: prepare_build + buildspec: prepare_build.yml + - identifier: validate_packages + buildspec: validate_packages.yml depend-on: - prepare-build cache: diff --git a/codebuild_specs/prepare-build.yml b/codebuild_specs/prepare_build.yml similarity index 100% rename from codebuild_specs/prepare-build.yml rename to codebuild_specs/prepare_build.yml diff --git a/codebuild_specs/validate-packages.yml b/codebuild_specs/validate_packages.yml similarity index 100% rename from codebuild_specs/validate-packages.yml rename to codebuild_specs/validate_packages.yml From b0803cb0a3cdae3e157325fb5b201876acb0c306 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Sat, 11 Mar 2023 15:43:16 -0500 Subject: [PATCH 031/107] chore: dependency name --- codebuild_specs/base.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml index 1d233abe45a..15332449640 100644 --- a/codebuild_specs/base.yml +++ b/codebuild_specs/base.yml @@ -17,7 +17,7 @@ batch: - identifier: validate_packages buildspec: validate_packages.yml depend-on: - - prepare-build + - prepare_build cache: paths: - ~/.cache/yarn/**/* From bae95c9542747d93485bed7f939a58641eab1bc2 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Sat, 11 Mar 2023 15:48:37 -0500 Subject: [PATCH 032/107] chore: fixing file paths --- codebuild_specs/base.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml index 15332449640..0a838aff437 100644 --- a/codebuild_specs/base.yml +++ b/codebuild_specs/base.yml @@ -13,9 +13,9 @@ batch: fast-fail: true build-graph: - identifier: prepare_build - buildspec: prepare_build.yml + buildspec: codebuild_specs/prepare_build.yml - identifier: validate_packages - buildspec: validate_packages.yml + buildspec: codebuild_specs/validate_packages.yml depend-on: - prepare_build cache: From 57a28518003bdc874b81f1afab0b6c70e891a6c0 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Sun, 12 Mar 2023 23:45:55 -0400 Subject: [PATCH 033/107] chore: making changes to buildspec file --- codebuild_specs/base.yml | 12 ------------ codebuild_specs/prepare_build.yml | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml index 0a838aff437..db07210c995 100644 --- a/codebuild_specs/base.yml +++ b/codebuild_specs/base.yml @@ -1,14 +1,5 @@ --- version: 0.2 -phases: - install: - runtime-versions: - nodejs: 14 - commands: - - yarn install -artifacts: - files: - - '**/*' batch: fast-fail: true build-graph: @@ -18,6 +9,3 @@ batch: buildspec: codebuild_specs/validate_packages.yml depend-on: - prepare_build -cache: - paths: - - ~/.cache/yarn/**/* diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index cb462c1a0e3..fa88cc057e9 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -1,13 +1,22 @@ --- version: 0.2 +artifacts: + files: + - '**/*' phases: - set-shell: + install: + runtime-versions: + nodejs: 14 commands: - - yarn config set script-shell $(which bash) - - echo setting shell complete + - yarn install + pre_build: build: commands: - yarn run production-build - build-tests: - commands: - yarn build-tests + post_build: + commands: + - +cache: + paths: + - ~/.cache/yarn/**/* From 30ad0a0f61e9b1b308ed0b824d7c34785de09d0c Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 09:41:55 -0400 Subject: [PATCH 034/107] chore: adding steps to pre-build --- codebuild_specs/prepare_build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index fa88cc057e9..efb844e8331 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -10,6 +10,8 @@ phases: commands: - yarn install pre_build: + commands: + - echo running prebuild build: commands: - yarn run production-build From ee400c9fbe66e44baac4c08f7b976b14a7bf4c33 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 10:18:15 -0400 Subject: [PATCH 035/107] chore: commenting out cruft --- codebuild_specs/prepare_build.yml | 1 + codebuild_specs/validate_packages.yml | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index efb844e8331..16060520381 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -8,6 +8,7 @@ phases: runtime-versions: nodejs: 14 commands: + - yarn config set script-shell $(which bash) - yarn install pre_build: commands: diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 6e86ed8b63d..7f29562e8f4 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,7 +1,10 @@ version: 0.2 -batch: - fast-fail: false - build-list: +artifacts: + files: + - '**/*' +# batch: +# fast-fail: false +# build-list: phases: post_build: commands: From 66cc13d50f647860285c2ed182fba396af7a70bc Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 11:18:40 -0400 Subject: [PATCH 036/107] chore: adding cache --- codebuild_specs/prepare_build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 16060520381..c9499123176 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -19,7 +19,8 @@ phases: - yarn build-tests post_build: commands: - - + - ls cache: paths: - - ~/.cache/yarn/**/* + - ~/.cache + - ~/.ssh From dfab20e787891fc95661fd0c0e1251c4ab62f28b Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 11:23:01 -0400 Subject: [PATCH 037/107] chore: removing artifacts and adding cache to validate packages --- codebuild_specs/prepare_build.yml | 3 --- codebuild_specs/validate_packages.yml | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index c9499123176..f39386baa46 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -1,8 +1,5 @@ --- version: 0.2 -artifacts: - files: - - '**/*' phases: install: runtime-versions: diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 7f29562e8f4..114b8906a32 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,7 +1,7 @@ version: 0.2 -artifacts: - files: - - '**/*' +cache: + paths: + - ~/.cache # batch: # fast-fail: false # build-list: From 73adf99e7ad5a86ed2fdfef06c6a1de662f8e0a0 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 11:54:28 -0400 Subject: [PATCH 038/107] chore: adding yarn deps --- codebuild_specs/prepare_build.yml | 2 +- codebuild_specs/validate_packages.yml | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index f39386baa46..958535b2bb0 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -19,5 +19,5 @@ phases: - ls cache: paths: - - ~/.cache + - ~/.cache/yarn - ~/.ssh diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 114b8906a32..10251bb3176 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,10 +1,7 @@ version: 0.2 cache: paths: - - ~/.cache -# batch: -# fast-fail: false -# build-list: + - ~/.cache/yarn phases: post_build: commands: From 7d84a1876f36a1bf39d563d406800b72c121425a Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 12:13:24 -0400 Subject: [PATCH 039/107] chore: going into yarn folder --- codebuild_specs/validate_packages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 10251bb3176..8a44d382af3 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -5,6 +5,8 @@ cache: phases: post_build: commands: + - ls + - cd ~/.cache/yarn - yarn lint-check - yarn test-ci - yarn verify-api-extract From fd43403a48dab3ac2fc4f4b54bc34b35b5ff122a Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 12:28:21 -0400 Subject: [PATCH 040/107] chore: going into yarn folder --- codebuild_specs/validate_packages.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 8a44d382af3..3c5bfa6eac0 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,12 +1,11 @@ version: 0.2 cache: paths: - - ~/.cache/yarn + - /root/yarn/**/* + - build/**/* phases: post_build: commands: - - ls - - cd ~/.cache/yarn - yarn lint-check - yarn test-ci - yarn verify-api-extract From e75a0a32d8d3b93d26357254a43906138a3167d8 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 12:29:15 -0400 Subject: [PATCH 041/107] chore: going into yarn folder --- codebuild_specs/validate_packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 3c5bfa6eac0..227c64c17bc 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,7 +1,7 @@ version: 0.2 cache: paths: - - /root/yarn/**/* + - /root/.yarn/**/* - build/**/* phases: post_build: From 0b342a5d9cb238d0284156387606dd4b5f429235 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 12:39:15 -0400 Subject: [PATCH 042/107] chore: reading into cache --- codebuild_specs/prepare_build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 958535b2bb0..5711d183a5e 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -17,6 +17,7 @@ phases: post_build: commands: - ls + - ls ~/.cache cache: paths: - ~/.cache/yarn From cc5481ac4dd69204db5abb5e5ef0f370d7defadb Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 12:49:48 -0400 Subject: [PATCH 043/107] chore: adding all files within yarn and reading from those files in next step --- codebuild_specs/prepare_build.yml | 3 ++- codebuild_specs/validate_packages.yml | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 5711d183a5e..e86b0aa0acd 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -18,7 +18,8 @@ phases: commands: - ls - ls ~/.cache + - ls ~/.ssh cache: paths: - - ~/.cache/yarn + - ~/.cache/yarn/**/* - ~/.ssh diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 227c64c17bc..f70fbc947d4 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,12 +1,13 @@ version: 0.2 cache: paths: - - /root/.yarn/**/* - - build/**/* + - ~/.cache/yarn/**/* phases: post_build: commands: + - cd packages/amplify-e2e-tests && yarn clean-e2e-resources - yarn lint-check + - cd packages/amplify-util-mock && yarn e2e - yarn test-ci - yarn verify-api-extract - yarn verify-yarn-lock From b2674b850763ca1391a14a059d17c3acdcada6a9 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 13:13:57 -0400 Subject: [PATCH 044/107] chore: adding all files within yarn and reading from those files in next step --- codebuild_specs/prepare_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index e86b0aa0acd..79ccac9ef72 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -21,5 +21,5 @@ phases: - ls ~/.ssh cache: paths: - - ~/.cache/yarn/**/* + - ~/.cache/**/* - ~/.ssh From 9c2c03eee0a1cbe07e866b2a5bddb8fef18f5d54 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 13:15:38 -0400 Subject: [PATCH 045/107] chore: reading all cache files --- codebuild_specs/validate_packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index f70fbc947d4..17d149f9b9a 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,7 +1,7 @@ version: 0.2 cache: paths: - - ~/.cache/yarn/**/* + - ~/.cache/**/* phases: post_build: commands: From 49af6a54ae970dc617dcb552ff7be5176a236992 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 13:22:54 -0400 Subject: [PATCH 046/107] chore: reading all cache files --- codebuild_specs/validate_packages.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 17d149f9b9a..1428f753b43 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -5,7 +5,6 @@ cache: phases: post_build: commands: - - cd packages/amplify-e2e-tests && yarn clean-e2e-resources - yarn lint-check - cd packages/amplify-util-mock && yarn e2e - yarn test-ci From 07af9c07f70707e4ae1dc574d0b7e79ca85cabca Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 13:36:46 -0400 Subject: [PATCH 047/107] chore: fixing paths --- codebuild_specs/prepare_build.yml | 4 ++-- codebuild_specs/validate_packages.yml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 79ccac9ef72..6fe6fc0bae7 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -21,5 +21,5 @@ phases: - ls ~/.ssh cache: paths: - - ~/.cache/**/* - - ~/.ssh + - /root/.cache/**/* + - /root/.ssh/**/* diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 1428f753b43..87533c74bb2 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,7 +1,8 @@ version: 0.2 cache: paths: - - ~/.cache/**/* + - /root/.cache/**/* + - /root/.ssh/**/* phases: post_build: commands: From 6b6d1880be928cad0177cf85c13b7434c5d97730 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 13:55:10 -0400 Subject: [PATCH 048/107] chore: path names --- codebuild_specs/prepare_build.yml | 3 +-- codebuild_specs/validate_packages.yml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 6fe6fc0bae7..bcf7f300bdc 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -21,5 +21,4 @@ phases: - ls ~/.ssh cache: paths: - - /root/.cache/**/* - - /root/.ssh/**/* + - ~/.cache/**/* diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 87533c74bb2..1428f753b43 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,8 +1,7 @@ version: 0.2 cache: paths: - - /root/.cache/**/* - - /root/.ssh/**/* + - ~/.cache/**/* phases: post_build: commands: From a8cf4e3b7343c9fd160f4f47e2f5e45e37a38bb7 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 14:28:18 -0400 Subject: [PATCH 049/107] chore: caching yarn --- codebuild_specs/prepare_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index bcf7f300bdc..ff39d992c89 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -21,4 +21,4 @@ phases: - ls ~/.ssh cache: paths: - - ~/.cache/**/* + - ~/.cache/yarn/* From 68c5cea8bc3c20453388a2aa561c831dae95c660 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 14:40:43 -0400 Subject: [PATCH 050/107] chore: reading deps --- codebuild_specs/prepare_build.yml | 2 +- codebuild_specs/validate_packages.yml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index ff39d992c89..bcf7f300bdc 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -21,4 +21,4 @@ phases: - ls ~/.ssh cache: paths: - - ~/.cache/yarn/* + - ~/.cache/**/* diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 1428f753b43..50ea125866c 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -3,6 +3,9 @@ cache: paths: - ~/.cache/**/* phases: + pre_build: + commands: + - ls ~/.cache post_build: commands: - yarn lint-check From 7334281e744ec93e08f390fc2efcc32bf57ef48f Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 15:54:21 -0400 Subject: [PATCH 051/107] chore: speeding up build --- codebuild_specs/prepare_build.yml | 8 +++++++- codebuild_specs/validate_packages.yml | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index bcf7f300bdc..1098104e194 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -19,6 +19,12 @@ phases: - ls - ls ~/.cache - ls ~/.ssh + - ls ~/. + - ls ~ + - ls . + - ls /root cache: paths: - - ~/.cache/**/* + - '~/.cache/**/*' + - '~/.repo/' + - '**/*' diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 50ea125866c..37584ede37d 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,10 +1,16 @@ version: 0.2 cache: paths: - - ~/.cache/**/* + - '~/.cache/**/*' + - '~/.repo/' + - '**/*' phases: pre_build: commands: + - ls ~/. + - ls ~ + - ls . + - ls /root - ls ~/.cache post_build: commands: From eac00effa52ece1fb1292594693ff310c80c09b5 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 13 Mar 2023 15:54:47 -0400 Subject: [PATCH 052/107] chore: remove tests --- codebuild_specs/prepare_build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 1098104e194..f7e313bd332 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -13,7 +13,6 @@ phases: build: commands: - yarn run production-build - - yarn build-tests post_build: commands: - ls From 3bd1196b67ad95a5e4b0bcd1b8d4dc9b00e5c1b8 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 11:47:46 -0400 Subject: [PATCH 053/107] chore: changing buildspec --- codebuild_specs/prepare_build.yml | 4 ++-- codebuild_specs/validate_packages.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index f7e313bd332..0d9ff15ed94 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -25,5 +25,5 @@ phases: cache: paths: - '~/.cache/**/*' - - '~/.repo/' - - '**/*' + - '~/.ssh/' + - '.' diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 37584ede37d..dc22b6aa19a 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -2,8 +2,8 @@ version: 0.2 cache: paths: - '~/.cache/**/*' - - '~/.repo/' - - '**/*' + - '~/.ssh/' + - '.' phases: pre_build: commands: From 8db577ec427b2c3873d76c513b0af7d36c5ea32a Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 15:33:19 -0400 Subject: [PATCH 054/107] chore: adding node modules to cache --- codebuild_specs/prepare_build.yml | 5 ++--- codebuild_specs/validate_packages.yml | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 0d9ff15ed94..a3ca026ebe1 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -24,6 +24,5 @@ phases: - ls /root cache: paths: - - '~/.cache/**/*' - - '~/.ssh/' - - '.' + - '/root/.yarn-cache/**/*' + - 'node_modules/**/*' diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index dc22b6aa19a..2f0156a7621 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,9 +1,8 @@ version: 0.2 cache: paths: - - '~/.cache/**/*' - - '~/.ssh/' - - '.' + - '/root/.yarn-cache/**/*' + - 'node_modules/**/*' phases: pre_build: commands: From b0b1ceeaa1341d9f3132c84dde9e1aedaf3ba1db Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 17:03:43 -0400 Subject: [PATCH 055/107] chore: using npm and configuring cache differently --- codebuild_specs/prepare_build.yml | 9 ++++++--- codebuild_specs/validate_packages.yml | 12 ++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index a3ca026ebe1..7ac0743ec52 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -10,9 +10,13 @@ phases: pre_build: commands: - echo running prebuild + - npm config -g set prefer-offline true + - npm config -g set cache /root/.npm + - npm config get cache build: commands: - - yarn run production-build + - npm install + - npm run production-build post_build: commands: - ls @@ -24,5 +28,4 @@ phases: - ls /root cache: paths: - - '/root/.yarn-cache/**/*' - - 'node_modules/**/*' + - /root/.npm/**/* diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 2f0156a7621..dd3d0822dca 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,8 +1,8 @@ version: 0.2 cache: paths: - - '/root/.yarn-cache/**/*' - - 'node_modules/**/*' + - /root/.npm/**/* + phases: pre_build: commands: @@ -13,9 +13,9 @@ phases: - ls ~/.cache post_build: commands: - - yarn lint-check + - npm run lint-check - cd packages/amplify-util-mock && yarn e2e - - yarn test-ci - - yarn verify-api-extract - - yarn verify-yarn-lock + - npm run test-ci + - npm run verify-api-extract + - npm run verify-yarn-lock - echo Post build complete From 0e4ba0a2dd60bf62d3ead97ea4dc2b0cdf53c445 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 17:06:50 -0400 Subject: [PATCH 056/107] chore: using npm --- codebuild_specs/prepare_build.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 7ac0743ec52..d55142be197 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -5,8 +5,8 @@ phases: runtime-versions: nodejs: 14 commands: - - yarn config set script-shell $(which bash) - - yarn install + - npm config set script-shell $(which bash) + - npm install pre_build: commands: - echo running prebuild @@ -15,8 +15,7 @@ phases: - npm config get cache build: commands: - - npm install - - npm run production-build + - npm production-build post_build: commands: - ls From 2c22257f69e978285e6e25ad603a01c8cadbf655 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 17:10:18 -0400 Subject: [PATCH 057/107] removing run keyword for npm --- codebuild_specs/validate_packages.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index dd3d0822dca..b65762b3cd8 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -13,9 +13,9 @@ phases: - ls ~/.cache post_build: commands: - - npm run lint-check + - npm lint-check - cd packages/amplify-util-mock && yarn e2e - - npm run test-ci - - npm run verify-api-extract - - npm run verify-yarn-lock + - npm test-ci + - npm verify-api-extract + - npm verify-yarn-lock - echo Post build complete From f3cd26192eab7d914beed96ee0476d984a527e24 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 17:20:14 -0400 Subject: [PATCH 058/107] have to run production build --- codebuild_specs/prepare_build.yml | 2 +- codebuild_specs/validate_packages.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index d55142be197..f50083816e7 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -15,7 +15,7 @@ phases: - npm config get cache build: commands: - - npm production-build + - npm run production-build post_build: commands: - ls diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index b65762b3cd8..4f5b2b6df94 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -13,8 +13,8 @@ phases: - ls ~/.cache post_build: commands: - - npm lint-check - - cd packages/amplify-util-mock && yarn e2e + - npm run lint-check + - cd packages/amplify-util-mock && npm e2e - npm test-ci - npm verify-api-extract - npm verify-yarn-lock From d1169cc637ad93b0e88ec585312f08cc3746234c Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 17:32:45 -0400 Subject: [PATCH 059/107] back to yarn --- codebuild_specs/prepare_build.yml | 14 +++++++------- codebuild_specs/validate_packages.yml | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index f50083816e7..30a3c8879e5 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -5,17 +5,17 @@ phases: runtime-versions: nodejs: 14 commands: - - npm config set script-shell $(which bash) - - npm install + - yarn config set script-shell $(which bash) + - yarn pre_build: commands: - echo running prebuild - - npm config -g set prefer-offline true - - npm config -g set cache /root/.npm - - npm config get cache + - yarn config -g set prefer-offline true + - yarn config -g set cache /root/.yarn + - yarn config get cache build: commands: - - npm run production-build + # - yarn production-build post_build: commands: - ls @@ -27,4 +27,4 @@ phases: - ls /root cache: paths: - - /root/.npm/**/* + - ~/.cache/yarn/**/* diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 4f5b2b6df94..cd25002df97 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,7 +1,7 @@ version: 0.2 cache: paths: - - /root/.npm/**/* + - ~/.cache/yarn/*/** phases: pre_build: @@ -13,9 +13,9 @@ phases: - ls ~/.cache post_build: commands: - - npm run lint-check + - yarn lint-check - cd packages/amplify-util-mock && npm e2e - - npm test-ci - - npm verify-api-extract - - npm verify-yarn-lock + - yarn test-ci + - yarn verify-api-extract + - yarn verify-yarn-lock - echo Post build complete From af7a653b7718a24252f11a3b0c78c6e22c01060e Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 17:38:31 -0400 Subject: [PATCH 060/107] fixing yarn commands --- codebuild_specs/prepare_build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 30a3c8879e5..090289d1dfb 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -10,8 +10,8 @@ phases: pre_build: commands: - echo running prebuild - - yarn config -g set prefer-offline true - - yarn config -g set cache /root/.yarn + - yarn config set prefer-offline true -g + - yarn config set cache /root/.yarn -g - yarn config get cache build: commands: @@ -25,6 +25,7 @@ phases: - ls ~ - ls . - ls /root + - ls ~/.cache/yarn cache: paths: - ~/.cache/yarn/**/* From 673e875ed90e96e60124129b326889fddbd72f99 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 17:50:31 -0400 Subject: [PATCH 061/107] chore: trying again --- codebuild_specs/prepare_build.yml | 12 +++++------- codebuild_specs/validate_packages.yml | 4 +++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 090289d1dfb..e05e2d498fb 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -6,13 +6,11 @@ phases: nodejs: 14 commands: - yarn config set script-shell $(which bash) - - yarn pre_build: commands: - echo running prebuild - - yarn config set prefer-offline true -g - - yarn config set cache /root/.yarn -g - - yarn config get cache + - yarn config set cache-folder /root/.yarn-cache -g + - yarn install --frozen-lockfile build: commands: # - yarn production-build @@ -24,8 +22,8 @@ phases: - ls ~/. - ls ~ - ls . - - ls /root - - ls ~/.cache/yarn cache: paths: - - ~/.cache/yarn/**/* + - '/root/.yarn-cache/**/*' + - 'node_modules/**/*' + - 'packages/**/node_modules/**/*' diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index cd25002df97..96de26c6086 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,7 +1,9 @@ version: 0.2 cache: paths: - - ~/.cache/yarn/*/** + - '/root/.yarn-cache/**/*' + - 'node_modules/**/*' + - 'packages/**/node_modules/**/*' phases: pre_build: From 96ed2b64b5b28f98f403b12a1587aa0a70b0ea43 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 18:01:42 -0400 Subject: [PATCH 062/107] chore: more deps --- codebuild_specs/prepare_build.yml | 2 +- codebuild_specs/validate_packages.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index e05e2d498fb..d8302ebf4cb 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -13,7 +13,7 @@ phases: - yarn install --frozen-lockfile build: commands: - # - yarn production-build + - yarn production-build post_build: commands: - ls diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 96de26c6086..1c8abeeb8fd 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -13,6 +13,8 @@ phases: - ls . - ls /root - ls ~/.cache + - ls node_modules/ + - ls /root/.yarn-cache/**/* post_build: commands: - yarn lint-check From 1a08b9fa7dd8e586fde4a14121c865f9b607ad3c Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 22:15:23 -0400 Subject: [PATCH 063/107] chore: adding cache loading --- codebuild_specs/cache-load.sh | 20 ++++++++++++++++++++ codebuild_specs/prepare_build.yml | 1 + 2 files changed, 21 insertions(+) create mode 100644 codebuild_specs/cache-load.sh diff --git a/codebuild_specs/cache-load.sh b/codebuild_specs/cache-load.sh new file mode 100644 index 00000000000..f112c70920d --- /dev/null +++ b/codebuild_specs/cache-load.sh @@ -0,0 +1,20 @@ +set -e + +cachedir = $HOME/.s3buildcache + +# creates directory only if it doesn't exist already +mkdir -p $cachedir + +if [[ "${S3_BUILD_CACHE:-}" = "" ]]; then + exit 0 +fi + +echo "🧳 Build cache enabled: ${S3_BUILD_CACHE}" +if ! aws s3 ls ${S3_BUILD_CACHE} > /dev/null; then + echo "🧳⚠️ Cache not found." + exit 0 +fi + +if ! (cd $cachedir && aws s3 cp ${S3_BUILD_CACHE} - | tar xzv); then + echo "🧳⚠️ Something went wrong fetching the cache. Continuing anyway." +fi diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index d8302ebf4cb..ff4c95b8cc5 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -8,6 +8,7 @@ phases: - yarn config set script-shell $(which bash) pre_build: commands: + - /bin/bash ./codebuild_specs/cache-load.sh - echo running prebuild - yarn config set cache-folder /root/.yarn-cache -g - yarn install --frozen-lockfile From a87818ff18fbb3cc58e40396a1860e829cc9c6fd Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 22:19:22 -0400 Subject: [PATCH 064/107] chore: storing cache capability --- codebuild_specs/cache-load.sh | 8 ++++---- codebuild_specs/cache-store.sh | 16 ++++++++++++++++ codebuild_specs/prepare_build.yml | 2 ++ 3 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 codebuild_specs/cache-store.sh diff --git a/codebuild_specs/cache-load.sh b/codebuild_specs/cache-load.sh index f112c70920d..b7e1884ac84 100644 --- a/codebuild_specs/cache-load.sh +++ b/codebuild_specs/cache-load.sh @@ -5,16 +5,16 @@ cachedir = $HOME/.s3buildcache # creates directory only if it doesn't exist already mkdir -p $cachedir -if [[ "${S3_BUILD_CACHE:-}" = "" ]]; then +if [[ "/root/myCache/" = "" ]]; then exit 0 fi -echo "🧳 Build cache enabled: ${S3_BUILD_CACHE}" -if ! aws s3 ls ${S3_BUILD_CACHE} > /dev/null; then +echo "🧳 Build cache enabled: /root/myCache/" +if ! aws s3 ls /root/myCache/ > /dev/null; then echo "🧳⚠️ Cache not found." exit 0 fi -if ! (cd $cachedir && aws s3 cp ${S3_BUILD_CACHE} - | tar xzv); then +if ! (cd $cachedir && aws s3 cp /root/myCache/ - | tar xzv); then echo "🧳⚠️ Something went wrong fetching the cache. Continuing anyway." fi diff --git a/codebuild_specs/cache-store.sh b/codebuild_specs/cache-store.sh new file mode 100644 index 00000000000..92279b7aa61 --- /dev/null +++ b/codebuild_specs/cache-store.sh @@ -0,0 +1,16 @@ +set -eu + +cachedir=$HOME/.s3buildcache +mkdir -p $cachedir + +if [[ "${S3_BUILD_CACHE:-}" = "" ]]; then + exit 0 +fi + +echo "🧳 Storing build cache at: /root/myCache/}" + +if ! (cd $cachedir && tar czv . | aws s3 cp - /root/myCache/}); then + echo "🧳⚠️ Something went wrong storing the cache." +fi + +echo "🧳 Finished." diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index ff4c95b8cc5..ff861ac2b9f 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -23,6 +23,8 @@ phases: - ls ~/. - ls ~ - ls . + - /bin/bash ./scripts/cache-store.sh + - ls /root/myCache cache: paths: - '/root/.yarn-cache/**/*' From 29f375d1e5abd3c99da8842cc5c0df6fec2cdfb0 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 22:41:48 -0400 Subject: [PATCH 065/107] chore: removing spacing so bash is happy --- codebuild_specs/cache-load.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/cache-load.sh b/codebuild_specs/cache-load.sh index b7e1884ac84..7ccfa1745af 100644 --- a/codebuild_specs/cache-load.sh +++ b/codebuild_specs/cache-load.sh @@ -1,6 +1,6 @@ -set -e +set -eu -cachedir = $HOME/.s3buildcache +cachedir=$HOME/.s3buildcache # creates directory only if it doesn't exist already mkdir -p $cachedir From 6840057cc9a59a036e3044f5ac5c206438e579ed Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 22:50:14 -0400 Subject: [PATCH 066/107] path was wrong --- codebuild_specs/prepare_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index ff861ac2b9f..1df99551ad4 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -23,7 +23,7 @@ phases: - ls ~/. - ls ~ - ls . - - /bin/bash ./scripts/cache-store.sh + - /bin/bash ./codebuild_specs/cache-store.sh - ls /root/myCache cache: paths: From 7037d6489752b2935ff50d0b2e518718a5a8b312 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 22:58:15 -0400 Subject: [PATCH 067/107] chore: fixing bash script to fail more vigorously --- codebuild_specs/cache-store.sh | 1 + codebuild_specs/prepare_build.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/cache-store.sh b/codebuild_specs/cache-store.sh index 92279b7aa61..297782a5f7f 100644 --- a/codebuild_specs/cache-store.sh +++ b/codebuild_specs/cache-store.sh @@ -4,6 +4,7 @@ cachedir=$HOME/.s3buildcache mkdir -p $cachedir if [[ "${S3_BUILD_CACHE:-}" = "" ]]; then + echo "Something failed, S3_BUILD_CACHE PHASE" exit 0 fi diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 1df99551ad4..2362eebec75 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -14,7 +14,7 @@ phases: - yarn install --frozen-lockfile build: commands: - - yarn production-build + # - yarn production-build post_build: commands: - ls @@ -24,7 +24,7 @@ phases: - ls ~ - ls . - /bin/bash ./codebuild_specs/cache-store.sh - - ls /root/myCache + cache: paths: - '/root/.yarn-cache/**/*' From 342d34a1969c88f911a4efded65b320c9e77e38d Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 23:04:46 -0400 Subject: [PATCH 068/107] removing everything so tests run faster --- codebuild_specs/prepare_build.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 2362eebec75..c3566d89708 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -17,14 +17,7 @@ phases: # - yarn production-build post_build: commands: - - ls - - ls ~/.cache - - ls ~/.ssh - - ls ~/. - - ls ~ - - ls . - /bin/bash ./codebuild_specs/cache-store.sh - cache: paths: - '/root/.yarn-cache/**/*' From 3b6b5d9308bedb61e5a33022643cb1c128601d2c Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 23:12:40 -0400 Subject: [PATCH 069/107] failed to load cache --- codebuild_specs/cache-load.sh | 2 +- codebuild_specs/prepare_build.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/codebuild_specs/cache-load.sh b/codebuild_specs/cache-load.sh index 7ccfa1745af..47678331339 100644 --- a/codebuild_specs/cache-load.sh +++ b/codebuild_specs/cache-load.sh @@ -15,6 +15,6 @@ if ! aws s3 ls /root/myCache/ > /dev/null; then exit 0 fi -if ! (cd $cachedir && aws s3 cp /root/myCache/ - | tar xzv); then +if ! (cd $cachedir && aws s3 cp /root/myCache/ . | tar xzv); then echo "🧳⚠️ Something went wrong fetching the cache. Continuing anyway." fi diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index c3566d89708..7d261094805 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -5,7 +5,9 @@ phases: runtime-versions: nodejs: 14 commands: + - ls /root/.yarn-cache - yarn config set script-shell $(which bash) + - yarn pre_build: commands: - /bin/bash ./codebuild_specs/cache-load.sh From f431beb2d275e4f53e1737963f56d5b48e31eced Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 23:16:52 -0400 Subject: [PATCH 070/107] chore: printing out what's in cache --- codebuild_specs/prepare_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 7d261094805..91a4986c5bd 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -5,7 +5,7 @@ phases: runtime-versions: nodejs: 14 commands: - - ls /root/.yarn-cache + - ls /root/myCache - yarn config set script-shell $(which bash) - yarn pre_build: From ae4b0ce36519fe91b7ded9845a4247fd6d46d38c Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 23:25:44 -0400 Subject: [PATCH 071/107] fix --- codebuild_specs/prepare_build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 91a4986c5bd..73d7a4fae71 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -5,7 +5,6 @@ phases: runtime-versions: nodejs: 14 commands: - - ls /root/myCache - yarn config set script-shell $(which bash) - yarn pre_build: From f69db4a7fc369834595f00fb6129569d4aade1e0 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 23:40:19 -0400 Subject: [PATCH 072/107] testing if cache is actually working --- codebuild_specs/prepare_build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 73d7a4fae71..4af4641e31d 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -6,19 +6,19 @@ phases: nodejs: 14 commands: - yarn config set script-shell $(which bash) - - yarn pre_build: commands: - - /bin/bash ./codebuild_specs/cache-load.sh - - echo running prebuild - - yarn config set cache-folder /root/.yarn-cache -g - - yarn install --frozen-lockfile + # - /bin/bash ./codebuild_specs/cache-load.sh + # - echo running prebuild + # - yarn config set cache-folder /root/.yarn-cache -g + # - yarn install --frozen-lockfile + - yarn lint-check build: commands: # - yarn production-build post_build: commands: - - /bin/bash ./codebuild_specs/cache-store.sh + # - /bin/bash ./codebuild_specs/cache-store.sh cache: paths: - '/root/.yarn-cache/**/*' From 6c085487447278c467b4c82b98c2588ec4f79c0e Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 23:45:46 -0400 Subject: [PATCH 073/107] cache dependencies --- codebuild_specs/prepare_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 4af4641e31d..d69c76b4093 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -21,6 +21,6 @@ phases: # - /bin/bash ./codebuild_specs/cache-store.sh cache: paths: - - '/root/.yarn-cache/**/*' + - '/root/.cache/yarn/**/*' - 'node_modules/**/*' - 'packages/**/node_modules/**/*' From 586012b3eff20171860229f1f305d42284edf6f3 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 23:46:14 -0400 Subject: [PATCH 074/107] cache dependencies --- codebuild_specs/prepare_build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index d69c76b4093..28174dfc8a9 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -8,6 +8,7 @@ phases: - yarn config set script-shell $(which bash) pre_build: commands: + - yarn # - /bin/bash ./codebuild_specs/cache-load.sh # - echo running prebuild # - yarn config set cache-folder /root/.yarn-cache -g From 882003c6086c736aabe8151278847afa6f07cac2 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 14 Mar 2023 23:55:45 -0400 Subject: [PATCH 075/107] removing install --- codebuild_specs/prepare_build.yml | 2 +- codebuild_specs/validate_packages.yml | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 28174dfc8a9..d00bded5cc1 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -8,7 +8,7 @@ phases: - yarn config set script-shell $(which bash) pre_build: commands: - - yarn + # - yarn # - /bin/bash ./codebuild_specs/cache-load.sh # - echo running prebuild # - yarn config set cache-folder /root/.yarn-cache -g diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 1c8abeeb8fd..f06e29806ef 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,20 +1,9 @@ version: 0.2 cache: paths: - - '/root/.yarn-cache/**/*' - - 'node_modules/**/*' - - 'packages/**/node_modules/**/*' + - '/root/.cache/yarn/**/*' phases: - pre_build: - commands: - - ls ~/. - - ls ~ - - ls . - - ls /root - - ls ~/.cache - - ls node_modules/ - - ls /root/.yarn-cache/**/* post_build: commands: - yarn lint-check From 0269bec3a7fb6a2747c30c44baafba3f9fb891f5 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Wed, 15 Mar 2023 00:17:37 -0400 Subject: [PATCH 076/107] installing dependencies --- codebuild_specs/prepare_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index d00bded5cc1..28174dfc8a9 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -8,7 +8,7 @@ phases: - yarn config set script-shell $(which bash) pre_build: commands: - # - yarn + - yarn # - /bin/bash ./codebuild_specs/cache-load.sh # - echo running prebuild # - yarn config set cache-folder /root/.yarn-cache -g From f4a895df148c6a78f543f59602f3e377a602fe73 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Wed, 15 Mar 2023 00:23:37 -0400 Subject: [PATCH 077/107] installing dependencies --- codebuild_specs/prepare_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 28174dfc8a9..d00bded5cc1 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -8,7 +8,7 @@ phases: - yarn config set script-shell $(which bash) pre_build: commands: - - yarn + # - yarn # - /bin/bash ./codebuild_specs/cache-load.sh # - echo running prebuild # - yarn config set cache-folder /root/.yarn-cache -g From b8eebf88dcb42fcb32f3cb015272077ff57adf87 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Wed, 15 Mar 2023 00:28:23 -0400 Subject: [PATCH 078/107] preparing build --- codebuild_specs/prepare_build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index d00bded5cc1..8fb46b80c71 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -13,6 +13,9 @@ phases: # - echo running prebuild # - yarn config set cache-folder /root/.yarn-cache -g # - yarn install --frozen-lockfile + - ls /root/.cache/yarn + - ls node_modules + - ./ - yarn lint-check build: commands: From e5c83ef4c9e42781444d9c378b813c3857366948 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 11:52:19 -0400 Subject: [PATCH 079/107] using shared scripts --- codebuild_specs/base.yml | 6 + codebuild_specs/prepare_build.yml | 18 +- .../amplify-cli-core-vNext/lib/index.d.ts | 2 + .../amplify-cli-core-vNext/lib/index.d.ts.map | 1 + packages/amplify-cli-core-vNext/lib/index.js | 18 ++ .../amplify-cli-core-vNext/lib/index.js.map | 1 + packages/amplify-prompts-vNext/lib/index.d.ts | 2 + .../amplify-prompts-vNext/lib/index.d.ts.map | 1 + packages/amplify-prompts-vNext/lib/index.js | 18 ++ .../amplify-prompts-vNext/lib/index.js.map | 1 + shared_scripts.sh | 155 ++++++++++++++++++ 11 files changed, 211 insertions(+), 12 deletions(-) create mode 100644 packages/amplify-cli-core-vNext/lib/index.d.ts create mode 100644 packages/amplify-cli-core-vNext/lib/index.d.ts.map create mode 100644 packages/amplify-cli-core-vNext/lib/index.js create mode 100644 packages/amplify-cli-core-vNext/lib/index.js.map create mode 100644 packages/amplify-prompts-vNext/lib/index.d.ts create mode 100644 packages/amplify-prompts-vNext/lib/index.d.ts.map create mode 100644 packages/amplify-prompts-vNext/lib/index.js create mode 100644 packages/amplify-prompts-vNext/lib/index.js.map create mode 100644 shared_scripts.sh diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml index db07210c995..914ec27d83b 100644 --- a/codebuild_specs/base.yml +++ b/codebuild_specs/base.yml @@ -5,7 +5,13 @@ batch: build-graph: - identifier: prepare_build buildspec: codebuild_specs/prepare_build.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true - identifier: validate_packages buildspec: codebuild_specs/validate_packages.yml + debug-session: true depend-on: - prepare_build diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 8fb46b80c71..cc7a20d49a2 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -5,24 +5,18 @@ phases: runtime-versions: nodejs: 14 commands: - - yarn config set script-shell $(which bash) pre_build: commands: - # - yarn - # - /bin/bash ./codebuild_specs/cache-load.sh - # - echo running prebuild - # - yarn config set cache-folder /root/.yarn-cache -g - # - yarn install --frozen-lockfile - - ls /root/.cache/yarn - - ls node_modules - - ./ - - yarn lint-check + - source ./shared_scripts.sh && _setShell + - yarn build: commands: - # - yarn production-build + - yarn production-build + - yarn build-tests + # Save cache after these are build in post build step post_build: commands: - # - /bin/bash ./codebuild_specs/cache-store.sh + # - source ./shared_scripts.sh && storeCache cache: paths: - '/root/.cache/yarn/**/*' diff --git a/packages/amplify-cli-core-vNext/lib/index.d.ts b/packages/amplify-cli-core-vNext/lib/index.d.ts new file mode 100644 index 00000000000..cc0254f358d --- /dev/null +++ b/packages/amplify-cli-core-vNext/lib/index.d.ts @@ -0,0 +1,2 @@ +export * from 'amplify-cli-core'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/packages/amplify-cli-core-vNext/lib/index.d.ts.map b/packages/amplify-cli-core-vNext/lib/index.d.ts.map new file mode 100644 index 00000000000..c55e43f7f21 --- /dev/null +++ b/packages/amplify-cli-core-vNext/lib/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"} \ No newline at end of file diff --git a/packages/amplify-cli-core-vNext/lib/index.js b/packages/amplify-cli-core-vNext/lib/index.js new file mode 100644 index 00000000000..ba37c35f17c --- /dev/null +++ b/packages/amplify-cli-core-vNext/lib/index.js @@ -0,0 +1,18 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("amplify-cli-core"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/amplify-cli-core-vNext/lib/index.js.map b/packages/amplify-cli-core-vNext/lib/index.js.map new file mode 100644 index 00000000000..b212ac377d1 --- /dev/null +++ b/packages/amplify-cli-core-vNext/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC"} \ No newline at end of file diff --git a/packages/amplify-prompts-vNext/lib/index.d.ts b/packages/amplify-prompts-vNext/lib/index.d.ts new file mode 100644 index 00000000000..4d3a46d82f7 --- /dev/null +++ b/packages/amplify-prompts-vNext/lib/index.d.ts @@ -0,0 +1,2 @@ +export * from 'amplify-prompts'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/packages/amplify-prompts-vNext/lib/index.d.ts.map b/packages/amplify-prompts-vNext/lib/index.d.ts.map new file mode 100644 index 00000000000..98659b5710a --- /dev/null +++ b/packages/amplify-prompts-vNext/lib/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"} \ No newline at end of file diff --git a/packages/amplify-prompts-vNext/lib/index.js b/packages/amplify-prompts-vNext/lib/index.js new file mode 100644 index 00000000000..2c07092c762 --- /dev/null +++ b/packages/amplify-prompts-vNext/lib/index.js @@ -0,0 +1,18 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("amplify-prompts"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/amplify-prompts-vNext/lib/index.js.map b/packages/amplify-prompts-vNext/lib/index.js.map new file mode 100644 index 00000000000..88112f77cee --- /dev/null +++ b/packages/amplify-prompts-vNext/lib/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC"} \ No newline at end of file diff --git a/shared_scripts.sh b/shared_scripts.sh new file mode 100644 index 00000000000..aa62ef83a3a --- /dev/null +++ b/shared_scripts.sh @@ -0,0 +1,155 @@ +#!/bin/bash + +# set exit on error to true +set -e +function test { + localPath="$1" + echo hi $1 +} +# We have custom caching for our CodeBuild pipelines +# which allows us to share caches with jobs in the same batch +function storeCache { + localPath="$1" + s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$localPath" + echo writing cache to $s3Path + # zip contents and upload to s3 + if ! (cd $localPath && tar cz . | aws s3 cp - $s3Path); then + echo Something went wrong storing the cache. + fi + echo done writing cache + cd $CODEBUILD_SRC_DIR +} +function loadCache { + localPath="$1" + s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$localPath" + echo loading cache from $s3Path + # create directory if it doesn't exist yet + mkdir -p $localPath + # check if cache exists in s3 + if ! aws s3 ls $s3Path > /dev/null; then + echo "Cache not found." + exit 0 + fi + # load cache and unzip it + if ! (cd $localPath && aws s3 cp $s3Path - | tar xz); then + echo "Something went wrong fetching the cache. Continuing anyway." + fi + echo done loading cache + cd $CODEBUILD_SRC_DIR +} +function _setShell { + echo Setting Shell + yarn config set script-shell $(which bash) +} +function _buildLinux { + _setShell + echo Linux Build + # yarn run production-build + # copy [repo, ~/.cache, and .ssh to s3] + storeCache $CODEBUILD_SRC_DIR + storeCache $HOME/.cache +} +function _buildWindows { + _setShell + echo Windows Build + yarn run production-build + # copy [repo, .cache, and .ssh to s3] +} +function _test { + echo Run Test + # download [repo, .cache from s3] + loadCache $CODEBUILD_SRC_DIR + loadCache $HOME/.cache + # run tests + yarn test-ci + echo collecting coverage + yarn coverage +} +function _validateCDKVersion { + echo Validate CDK Version + # download [repo, .cache from s3] + yarn ts-node .circleci/validate_cdk_version.ts +} +function _lint { + # download [repo, .cache from s3] + echo Linting + yarn lint-check + yarn lint-check-package-json + yarn prettier-check +} +function _verifyAPIExtract { + # download [repo, .cache from s3] + echo Verify API Extract + yarn verify-api-extract +} +function _verifyYarnLock { + # download [repo, .cache from s3] + echo "Verify Yarn Lock" + yarn verify-yarn-lock +} +function _verifyVersionsMatch { + # download [repo, .cache, verdaccio-cache from s3] + echo Verify Versions Match + source .circleci/local_publish_helpers.sh + startLocalRegistry "$(pwd)/.circleci/verdaccio.yaml" + setNpmRegistryUrlToLocal + changeNpmGlobalPath + checkPackageVersionsInLocalNpmRegistry +} +function _mockE2ETests { + # download [repo, .cache from s3] + source .circleci/local_publish_helpers.sh + cd packages/amplify-util-mock/ + yarn e2e +} +function _publishToLocalRegistry { + # download [repo, .cache from s3] + echo "Publish To Local Registry" + source .circleci/local_publish_helpers.sh + startLocalRegistry "$(pwd)/.circleci/verdaccio.yaml" + setNpmRegistryUrlToLocal + export LOCAL_PUBLISH_TO_LATEST=true + ./.circleci/publish.sh + unsetNpmRegistryUrl + + echo Generate Change Log + git reset --soft HEAD~1 + yarn ts-node scripts/unified-changelog.ts + cat UNIFIED_CHANGELOG.md + + echo Save new amplify Github tag + node scripts/echo-current-cli-version.js > .amplify-pkg-version + # copy [verdaccio-cache, changelog, pkgtag to s3] +} +function _uploadPkgBinaries { + # download [repo, pkg-binaries, from s3] + echo Consolidate binaries cache and upload + source .circleci/local_publish_helpers.sh + uploadPkgCli + # copy [repo/out to s3] +} +function _buildBinaries { + # download [repo, yarn, verdaccio from s3] + echo Start verdaccio and package CLI + source .circleci/local_publish_helpers.sh + startLocalRegistry "$(pwd)/.circleci/verdaccio.yaml" + setNpmRegistryUrlToLocal + changeNpmGlobalPath + generatePkgCli linux + # generatePkgCli macos + # generatePkgCli win + # generatePkgCli arm + + unsetNpmRegistryUrl + # copy [repo/out to s3] +} +function _runE2ETestsLinux { + source .circleci/local_publish_helpers.sh + source $BASH_ENV + startLocalRegistry "$(pwd)/.circleci/verdaccio.yaml" + setNpmRegistryUrlToLocal + changeNpmGlobalPath + amplify version + cd packages/amplify-e2e-tests + retry runE2eTest +} From 0799a6b124c73a016619c9ed75bec4ef845427c5 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 11:56:43 -0400 Subject: [PATCH 080/107] using shared scripts --- codebuild_specs/prepare_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index cc7a20d49a2..64b8ab4887e 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -7,8 +7,8 @@ phases: commands: pre_build: commands: - - source ./shared_scripts.sh && _setShell - - yarn + # - source ./shared_scripts.sh && _setShell + - yarn test build: commands: - yarn production-build From 87b22068e11acda93961639ffe54a1ccf92e456a Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 12:01:25 -0400 Subject: [PATCH 081/107] using shared scripts --- codebuild_specs/prepare_build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 64b8ab4887e..b23bf40e37d 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -1,5 +1,7 @@ --- version: 0.2 +env: + shell: bash phases: install: runtime-versions: @@ -7,8 +9,8 @@ phases: commands: pre_build: commands: - # - source ./shared_scripts.sh && _setShell - - yarn test + - source ./shared_scripts.sh && _setShell + - yarn build: commands: - yarn production-build From 8fdb272bcdce72911aa96a331a8674cd769d8681 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 12:14:11 -0400 Subject: [PATCH 082/107] chore: removing tradition cache --- codebuild_specs/prepare_build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index b23bf40e37d..6e2c0746a36 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -10,7 +10,7 @@ phases: pre_build: commands: - source ./shared_scripts.sh && _setShell - - yarn + - yarn test build: commands: - yarn production-build @@ -21,6 +21,6 @@ phases: # - source ./shared_scripts.sh && storeCache cache: paths: - - '/root/.cache/yarn/**/*' - - 'node_modules/**/*' - - 'packages/**/node_modules/**/*' + # - '/root/.cache/yarn/**/*' + # - 'node_modules/**/*' + # - 'packages/**/node_modules/**/*' From dfec4d178c5819aab88f0ca3c2381780879cb1e9 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 12:18:05 -0400 Subject: [PATCH 083/107] chore: install deps --- codebuild_specs/prepare_build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 6e2c0746a36..e5d6f1acf8c 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -7,6 +7,7 @@ phases: runtime-versions: nodejs: 14 commands: + - yarn pre_build: commands: - source ./shared_scripts.sh && _setShell From d54f5663bf84d32efc8ae2c18bd1400050addc72 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 12:53:06 -0400 Subject: [PATCH 084/107] build test before running them --- codebuild_specs/prepare_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index e5d6f1acf8c..1f9d8c850d2 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -11,14 +11,14 @@ phases: pre_build: commands: - source ./shared_scripts.sh && _setShell - - yarn test build: commands: - - yarn production-build - yarn build-tests + - yarn production-build # Save cache after these are build in post build step post_build: commands: + - yarn test # - source ./shared_scripts.sh && storeCache cache: paths: From 7b3aab0b3e7e58ad7d1af9b9f34ca8edf1e1d839 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 13:10:55 -0400 Subject: [PATCH 085/107] attempt to store cache --- codebuild_specs/prepare_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 1f9d8c850d2..2107725e5ab 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -19,7 +19,7 @@ phases: post_build: commands: - yarn test - # - source ./shared_scripts.sh && storeCache + - source ./shared_scripts.sh && storeCache cache: paths: # - '/root/.cache/yarn/**/*' From 3fbbfa3f5bccfac231e9b315d1b5fdcf9fc29751 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 13:56:44 -0400 Subject: [PATCH 086/107] empty commity --- codebuild_specs/prepare_build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 2107725e5ab..5be74c6afea 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -25,3 +25,4 @@ cache: # - '/root/.cache/yarn/**/*' # - 'node_modules/**/*' # - 'packages/**/node_modules/**/*' + From 36fb1a871b5dd62d6ca262c605b4daa0b39a4ef6 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 15:05:46 -0400 Subject: [PATCH 087/107] Update shared_scripts.sh --- shared_scripts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared_scripts.sh b/shared_scripts.sh index aa62ef83a3a..9327102b2ca 100644 --- a/shared_scripts.sh +++ b/shared_scripts.sh @@ -10,7 +10,7 @@ function test { # which allows us to share caches with jobs in the same batch function storeCache { localPath="$1" - s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$localPath" + s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$CODEBUILD_BUILD_ID" echo writing cache to $s3Path # zip contents and upload to s3 if ! (cd $localPath && tar cz . | aws s3 cp - $s3Path); then From 2bf6395cde9c3c834bc04f8099a3af194051b3a9 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 15:06:37 -0400 Subject: [PATCH 088/107] Update prepare_build.yml --- codebuild_specs/prepare_build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 5be74c6afea..c291e56d407 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -11,6 +11,7 @@ phases: pre_build: commands: - source ./shared_scripts.sh && _setShell + - echo $CODEBUILD_BUILD_ID build: commands: - yarn build-tests From df4038e6a24d1e55df2cf8b440e4fdb0c78645a3 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 15:21:46 -0400 Subject: [PATCH 089/107] Update prepare_build.yml --- codebuild_specs/prepare_build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index c291e56d407..6e499abbde5 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -11,7 +11,6 @@ phases: pre_build: commands: - source ./shared_scripts.sh && _setShell - - echo $CODEBUILD_BUILD_ID build: commands: - yarn build-tests @@ -20,7 +19,7 @@ phases: post_build: commands: - yarn test - - source ./shared_scripts.sh && storeCache + - source ./shared_scripts.sh && _buildLinux cache: paths: # - '/root/.cache/yarn/**/*' From 52d7144241aabca4e201379904c91e8f4eb4b79b Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 15:22:55 -0400 Subject: [PATCH 090/107] Update shared_scripts.sh --- shared_scripts.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared_scripts.sh b/shared_scripts.sh index 9327102b2ca..aa62ef83a3a 100644 --- a/shared_scripts.sh +++ b/shared_scripts.sh @@ -10,7 +10,7 @@ function test { # which allows us to share caches with jobs in the same batch function storeCache { localPath="$1" - s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$CODEBUILD_BUILD_ID" + s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$localPath" echo writing cache to $s3Path # zip contents and upload to s3 if ! (cd $localPath && tar cz . | aws s3 cp - $s3Path); then From cac849d9355d223d2e63fc1dc24244a1c2397e4f Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 15:42:29 -0400 Subject: [PATCH 091/107] chore: storing information shorter path --- shared_scripts.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shared_scripts.sh b/shared_scripts.sh index aa62ef83a3a..20d480b069f 100644 --- a/shared_scripts.sh +++ b/shared_scripts.sh @@ -46,7 +46,10 @@ function _buildLinux { echo Linux Build # yarn run production-build # copy [repo, ~/.cache, and .ssh to s3] - storeCache $CODEBUILD_SRC_DIR + + #last 11 characters amplify-cli + truncatedPath= ${CODEBUILD_SRC_DIR:(-11)} + storeCache $truncatedPath storeCache $HOME/.cache } function _buildWindows { From 9ed666e9ffb0b75f78ae9ab63de6ce0ef1294d71 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 15:55:17 -0400 Subject: [PATCH 092/107] chore: modifying shared scripts --- codebuild_specs/validate_packages.yml | 12 +++++++++--- shared_scripts.sh | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index f06e29806ef..d483c382c4c 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,9 +1,15 @@ version: 0.2 -cache: - paths: - - '/root/.cache/yarn/**/*' +env: + shell: bash phases: + install: + commands: + - source ./shared_scripts.sh && _buildLinux + - source ./shared_scripts.sh && _loadCache + + pre_build: + commands: post_build: commands: - yarn lint-check diff --git a/shared_scripts.sh b/shared_scripts.sh index 20d480b069f..8faae6d3081 100644 --- a/shared_scripts.sh +++ b/shared_scripts.sh @@ -10,7 +10,8 @@ function test { # which allows us to share caches with jobs in the same batch function storeCache { localPath="$1" - s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$localPath" + alias="$2" + s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$alias" echo writing cache to $s3Path # zip contents and upload to s3 if ! (cd $localPath && tar cz . | aws s3 cp - $s3Path); then @@ -19,9 +20,11 @@ function storeCache { echo done writing cache cd $CODEBUILD_SRC_DIR } +# loadCache function loadCache { - localPath="$1" - s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$localPath" + alias="$1" + localPath="$2" + s3Path="s3://$CACHE_BUCKET_NAME/$CODEBUILD_SOURCE_VERSION/$alias" echo loading cache from $s3Path # create directory if it doesn't exist yet mkdir -p $localPath @@ -44,14 +47,12 @@ function _setShell { function _buildLinux { _setShell echo Linux Build - # yarn run production-build + yarn run production-build # copy [repo, ~/.cache, and .ssh to s3] - - #last 11 characters amplify-cli - truncatedPath= ${CODEBUILD_SRC_DIR:(-11)} - storeCache $truncatedPath - storeCache $HOME/.cache + storeCache $CODEBUILD_SRC_DIR repo + storeCache $HOME/.cache .cache } + function _buildWindows { _setShell echo Windows Build From f15b966d98793fec3233c5f662251df590a1fd9d Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 15:58:01 -0400 Subject: [PATCH 093/107] chore: modifying shared scripts and validating packages --- codebuild_specs/validate_packages.yml | 14 +------------- shared_scripts.sh | 5 +++-- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index d483c382c4c..36dbddcbefd 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -5,16 +5,4 @@ env: phases: install: commands: - - source ./shared_scripts.sh && _buildLinux - - source ./shared_scripts.sh && _loadCache - - pre_build: - commands: - post_build: - commands: - - yarn lint-check - - cd packages/amplify-util-mock && npm e2e - - yarn test-ci - - yarn verify-api-extract - - yarn verify-yarn-lock - - echo Post build complete + - source ./shared_scripts.sh && _test diff --git a/shared_scripts.sh b/shared_scripts.sh index 8faae6d3081..21d8bfa39b1 100644 --- a/shared_scripts.sh +++ b/shared_scripts.sh @@ -62,8 +62,8 @@ function _buildWindows { function _test { echo Run Test # download [repo, .cache from s3] - loadCache $CODEBUILD_SRC_DIR - loadCache $HOME/.cache + loadCache repo $CODEBUILD_SRC_DIR + loadCache .cache $HOME/.cache # run tests yarn test-ci echo collecting coverage @@ -147,6 +147,7 @@ function _buildBinaries { unsetNpmRegistryUrl # copy [repo/out to s3] } + function _runE2ETestsLinux { source .circleci/local_publish_helpers.sh source $BASH_ENV From 2992df93e0240aa9126297cef9e93e6be0c0eb5c Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 16:19:10 -0400 Subject: [PATCH 094/107] test --- codebuild_specs/base.yml | 3 +++ codebuild_specs/validate_packages.yml | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml index 914ec27d83b..752d55560ce 100644 --- a/codebuild_specs/base.yml +++ b/codebuild_specs/base.yml @@ -13,5 +13,8 @@ batch: - identifier: validate_packages buildspec: codebuild_specs/validate_packages.yml debug-session: true + env: + variables: + EXAMPLE_SAMPLE: 'test' depend-on: - prepare_build diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/validate_packages.yml index 36dbddcbefd..2c03ddb2bfa 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/validate_packages.yml @@ -1,8 +1,7 @@ version: 0.2 env: shell: bash - phases: - install: + build: commands: - - source ./shared_scripts.sh && _test + - source ./shared-scripts.sh && _test From 8b821e49431fd789eb94edc2092e95613141f140 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 16:24:54 -0400 Subject: [PATCH 095/107] trying to test without instaling node modules --- codebuild_specs/prepare_build.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 6e499abbde5..7423e8cae88 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -11,18 +11,18 @@ phases: pre_build: commands: - source ./shared_scripts.sh && _setShell - build: - commands: - - yarn build-tests - - yarn production-build - # Save cache after these are build in post build step - post_build: - commands: - - yarn test - - source ./shared_scripts.sh && _buildLinux + - source ./shared_scripts.sh && _test + # build: + # commands: + # - yarn build-tests + # - yarn production-build + # # Save cache after these are build in post build step + # post_build: + # commands: + # - yarn test + # - source ./shared_scripts.sh && _buildLinux cache: paths: # - '/root/.cache/yarn/**/*' # - 'node_modules/**/*' # - 'packages/**/node_modules/**/*' - From c09b11228ebe1c2bd16b4fb977ee164af0a56a03 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 16:34:18 -0400 Subject: [PATCH 096/107] chore: fixing artifcats --- codebuild_specs/prepare_build.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index 7423e8cae88..ed31d193348 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -11,18 +11,21 @@ phases: pre_build: commands: - source ./shared_scripts.sh && _setShell - - source ./shared_scripts.sh && _test - # build: - # commands: - # - yarn build-tests - # - yarn production-build - # # Save cache after these are build in post build step - # post_build: - # commands: - # - yarn test - # - source ./shared_scripts.sh && _buildLinux + + build: + commands: + - yarn build-tests + - yarn production-build + # Save cache after these are build in post build step + post_build: + commands: + - yarn test + - source ./shared_scripts.sh && _buildLinux cache: paths: # - '/root/.cache/yarn/**/*' # - 'node_modules/**/*' # - 'packages/**/node_modules/**/*' +artifacts: + files: + - 'shared-scripts.sh' From 415ecb38aba5274c800afbd8918bf02ad4ecbc83 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 17:07:09 -0400 Subject: [PATCH 097/107] chore: changing file-path --- codebuild_specs/prepare_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index ed31d193348..f534590d30c 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -28,4 +28,4 @@ cache: # - 'packages/**/node_modules/**/*' artifacts: files: - - 'shared-scripts.sh' + - './shared-scripts.sh' From 2ecbe01173b461342195e07c107138abcba60686 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Mon, 20 Mar 2023 17:24:07 -0400 Subject: [PATCH 098/107] chore: change file names --- codebuild_specs/prepare_build.yml | 11 +++-------- shared_scripts.sh => shared-scripts.sh | 0 2 files changed, 3 insertions(+), 8 deletions(-) rename shared_scripts.sh => shared-scripts.sh (100%) diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index f534590d30c..b48bcf76720 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -10,7 +10,7 @@ phases: - yarn pre_build: commands: - - source ./shared_scripts.sh && _setShell + - source ./shared-scripts.sh && _setShell build: commands: @@ -20,12 +20,7 @@ phases: post_build: commands: - yarn test - - source ./shared_scripts.sh && _buildLinux -cache: - paths: - # - '/root/.cache/yarn/**/*' - # - 'node_modules/**/*' - # - 'packages/**/node_modules/**/*' + - source ./shared-scripts.sh && _buildLinux artifacts: files: - - './shared-scripts.sh' + - 'shared-scripts.sh' diff --git a/shared_scripts.sh b/shared-scripts.sh similarity index 100% rename from shared_scripts.sh rename to shared-scripts.sh From 9fcad4e20583c83125679878ebe3bcfb65faf971 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 21 Mar 2023 11:45:53 -0400 Subject: [PATCH 099/107] chore: testing out new phases --- codebuild_specs/base.yml | 22 ++++++++++++++++--- codebuild_specs/cache-load.sh | 20 ----------------- codebuild_specs/cache-store.sh | 17 -------------- .../{validate_packages.yml => lint.yml} | 2 +- codebuild_specs/mock_e2e_tests.yml | 7 ++++++ codebuild_specs/prepare_build.yml | 17 +------------- codebuild_specs/test.yml | 7 ++++++ shared-scripts.sh | 11 +++++++--- 8 files changed, 43 insertions(+), 60 deletions(-) delete mode 100644 codebuild_specs/cache-load.sh delete mode 100644 codebuild_specs/cache-store.sh rename codebuild_specs/{validate_packages.yml => lint.yml} (58%) create mode 100644 codebuild_specs/mock_e2e_tests.yml create mode 100644 codebuild_specs/test.yml diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml index 752d55560ce..2daad7492a3 100644 --- a/codebuild_specs/base.yml +++ b/codebuild_specs/base.yml @@ -10,11 +10,27 @@ batch: compute-type: BUILD_GENERAL1_LARGE variables: IS_AMPLIFY_CI: true - - identifier: validate_packages - buildspec: codebuild_specs/validate_packages.yml + - identifier: mock_e2e_tests + buildspec: codebuild_specs/mock_e2e_tests.yml + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: prepare_build + - identifier: test + buildspec: codebuild_specs/test.yml debug-session: true env: + compute-type: BUILD_GENERAL1_LARGE variables: - EXAMPLE_SAMPLE: 'test' + IS_AMPLIFY_CI: true + depend-on: prepare_build + - identifier: lint + buildspec: codebuild_specs/lint.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true depend-on: - prepare_build diff --git a/codebuild_specs/cache-load.sh b/codebuild_specs/cache-load.sh deleted file mode 100644 index 47678331339..00000000000 --- a/codebuild_specs/cache-load.sh +++ /dev/null @@ -1,20 +0,0 @@ -set -eu - -cachedir=$HOME/.s3buildcache - -# creates directory only if it doesn't exist already -mkdir -p $cachedir - -if [[ "/root/myCache/" = "" ]]; then - exit 0 -fi - -echo "🧳 Build cache enabled: /root/myCache/" -if ! aws s3 ls /root/myCache/ > /dev/null; then - echo "🧳⚠️ Cache not found." - exit 0 -fi - -if ! (cd $cachedir && aws s3 cp /root/myCache/ . | tar xzv); then - echo "🧳⚠️ Something went wrong fetching the cache. Continuing anyway." -fi diff --git a/codebuild_specs/cache-store.sh b/codebuild_specs/cache-store.sh deleted file mode 100644 index 297782a5f7f..00000000000 --- a/codebuild_specs/cache-store.sh +++ /dev/null @@ -1,17 +0,0 @@ -set -eu - -cachedir=$HOME/.s3buildcache -mkdir -p $cachedir - -if [[ "${S3_BUILD_CACHE:-}" = "" ]]; then - echo "Something failed, S3_BUILD_CACHE PHASE" - exit 0 -fi - -echo "🧳 Storing build cache at: /root/myCache/}" - -if ! (cd $cachedir && tar czv . | aws s3 cp - /root/myCache/}); then - echo "🧳⚠️ Something went wrong storing the cache." -fi - -echo "🧳 Finished." diff --git a/codebuild_specs/validate_packages.yml b/codebuild_specs/lint.yml similarity index 58% rename from codebuild_specs/validate_packages.yml rename to codebuild_specs/lint.yml index 2c03ddb2bfa..7363c6c10d0 100644 --- a/codebuild_specs/validate_packages.yml +++ b/codebuild_specs/lint.yml @@ -4,4 +4,4 @@ env: phases: build: commands: - - source ./shared-scripts.sh && _test + - source ./shared-scripts.sh && _lint diff --git a/codebuild_specs/mock_e2e_tests.yml b/codebuild_specs/mock_e2e_tests.yml new file mode 100644 index 00000000000..15573725d6a --- /dev/null +++ b/codebuild_specs/mock_e2e_tests.yml @@ -0,0 +1,7 @@ +version: 0.2 +env: + shell: bash +phases: + build: + commands: + - source ./shared-scripts.sh && _mockE2ETests diff --git a/codebuild_specs/prepare_build.yml b/codebuild_specs/prepare_build.yml index b48bcf76720..273b055f828 100644 --- a/codebuild_specs/prepare_build.yml +++ b/codebuild_specs/prepare_build.yml @@ -1,26 +1,11 @@ ---- version: 0.2 env: shell: bash phases: - install: - runtime-versions: - nodejs: 14 - commands: - - yarn - pre_build: - commands: - - source ./shared-scripts.sh && _setShell - build: commands: - - yarn build-tests - - yarn production-build - # Save cache after these are build in post build step - post_build: - commands: - - yarn test - source ./shared-scripts.sh && _buildLinux + artifacts: files: - 'shared-scripts.sh' diff --git a/codebuild_specs/test.yml b/codebuild_specs/test.yml new file mode 100644 index 00000000000..ed813463ab0 --- /dev/null +++ b/codebuild_specs/test.yml @@ -0,0 +1,7 @@ +version: 0.2 +env: + shell: bash +phases: + build: + commands: + - source ./shared-scripts.sh && _testLinux diff --git a/shared-scripts.sh b/shared-scripts.sh index 21d8bfa39b1..ce2e910b030 100644 --- a/shared-scripts.sh +++ b/shared-scripts.sh @@ -52,14 +52,13 @@ function _buildLinux { storeCache $CODEBUILD_SRC_DIR repo storeCache $HOME/.cache .cache } - function _buildWindows { _setShell echo Windows Build yarn run production-build # copy [repo, .cache, and .ssh to s3] } -function _test { +function _testLinux { echo Run Test # download [repo, .cache from s3] loadCache repo $CODEBUILD_SRC_DIR @@ -75,8 +74,11 @@ function _validateCDKVersion { yarn ts-node .circleci/validate_cdk_version.ts } function _lint { - # download [repo, .cache from s3] echo Linting + # download [repo, .cache from s3] + loadCache repo $CODEBUILD_SRC_DIR + loadCache .cache $HOME/.cache + yarn lint-check yarn lint-check-package-json yarn prettier-check @@ -102,6 +104,9 @@ function _verifyVersionsMatch { } function _mockE2ETests { # download [repo, .cache from s3] + loadCache repo $CODEBUILD_SRC_DIR + loadCache .cache $HOME/.cache + source .circleci/local_publish_helpers.sh cd packages/amplify-util-mock/ yarn e2e From fef2c71b57054b805357027d0aadcb6a8eeb9c35 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 21 Mar 2023 11:52:44 -0400 Subject: [PATCH 100/107] chore: spacing issue --- codebuild_specs/base.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml index 2daad7492a3..57e0dcf80d7 100644 --- a/codebuild_specs/base.yml +++ b/codebuild_specs/base.yml @@ -16,7 +16,8 @@ batch: compute-type: BUILD_GENERAL1_LARGE variables: IS_AMPLIFY_CI: true - depend-on: prepare_build + depend-on: + - prepare_build - identifier: test buildspec: codebuild_specs/test.yml debug-session: true @@ -24,7 +25,8 @@ batch: compute-type: BUILD_GENERAL1_LARGE variables: IS_AMPLIFY_CI: true - depend-on: prepare_build + depend-on: + - prepare_build - identifier: lint buildspec: codebuild_specs/lint.yml debug-session: true From 643f8bac8a7ae73e05d374adf0c88c58114fa39b Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 21 Mar 2023 12:37:55 -0400 Subject: [PATCH 101/107] chore: do not fail fast in mockE2E runs --- codebuild_specs/base.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml index 57e0dcf80d7..6d23c77d87b 100644 --- a/codebuild_specs/base.yml +++ b/codebuild_specs/base.yml @@ -1,7 +1,7 @@ --- version: 0.2 batch: - fast-fail: true + fast-fail: false build-graph: - identifier: prepare_build buildspec: codebuild_specs/prepare_build.yml From 7d3a4a60d15aa52727e2b8d187e5a5a0252ca3d3 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 21 Mar 2023 12:43:24 -0400 Subject: [PATCH 102/107] chore: adding verify api extract and validate cdk version --- codebuild_specs/base.yml | 18 ++++++++++++++++++ codebuild_specs/validate_cdk_version.yml | 7 +++++++ codebuild_specs/verify_api_extract.yml | 7 +++++++ shared-scripts.sh | 8 +++++++- 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 codebuild_specs/validate_cdk_version.yml create mode 100644 codebuild_specs/verify_api_extract.yml diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml index 6d23c77d87b..1c052cc4457 100644 --- a/codebuild_specs/base.yml +++ b/codebuild_specs/base.yml @@ -36,3 +36,21 @@ batch: IS_AMPLIFY_CI: true depend-on: - prepare_build + - identifier: validate_cdk_version + buildspec: codebuild_specs/validate_cdk_version.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: verify_api_extract + buildspec: codebuild_specs/verify_api_extract.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build diff --git a/codebuild_specs/validate_cdk_version.yml b/codebuild_specs/validate_cdk_version.yml new file mode 100644 index 00000000000..f1bf130dbc6 --- /dev/null +++ b/codebuild_specs/validate_cdk_version.yml @@ -0,0 +1,7 @@ +version: 0.2 +env: + shell: bash +phases: + build: + commands: + - source ./shared-scripts.sh && _validateCDKVersion diff --git a/codebuild_specs/verify_api_extract.yml b/codebuild_specs/verify_api_extract.yml new file mode 100644 index 00000000000..ac360de6cfd --- /dev/null +++ b/codebuild_specs/verify_api_extract.yml @@ -0,0 +1,7 @@ +version: 0.2 +env: + shell: bash +phases: + build: + commands: + - source ./shared-scripts.sh && _verifyAPIExtract diff --git a/shared-scripts.sh b/shared-scripts.sh index ce2e910b030..34218b6f679 100644 --- a/shared-scripts.sh +++ b/shared-scripts.sh @@ -71,6 +71,8 @@ function _testLinux { function _validateCDKVersion { echo Validate CDK Version # download [repo, .cache from s3] + loadCache repo $CODEBUILD_SRC_DIR + loadCache .cache $HOME/.cache yarn ts-node .circleci/validate_cdk_version.ts } function _lint { @@ -84,8 +86,12 @@ function _lint { yarn prettier-check } function _verifyAPIExtract { - # download [repo, .cache from s3] echo Verify API Extract + + # download [repo, .cache from s3] + loadCache repo $CODEBUILD_SRC_DIR + loadCache .cache $HOME/.cache + yarn verify-api-extract } function _verifyYarnLock { From 4031ec1505de1f4ef3bdf2a6cb63a22315f79e8d Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 21 Mar 2023 13:16:35 -0400 Subject: [PATCH 103/107] chore: cleaning up e2e resources test --- codebuild_specs/base.yml | 18 ++++++++++++++++++ codebuild_specs/cleanup_e2e_resources.yml | 0 codebuild_specs/verify_yarn_lock.yml | 7 +++++++ shared-scripts.sh | 13 ++++++++++++- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 codebuild_specs/cleanup_e2e_resources.yml create mode 100644 codebuild_specs/verify_yarn_lock.yml diff --git a/codebuild_specs/base.yml b/codebuild_specs/base.yml index 1c052cc4457..25dfe25c6ff 100644 --- a/codebuild_specs/base.yml +++ b/codebuild_specs/base.yml @@ -10,6 +10,15 @@ batch: compute-type: BUILD_GENERAL1_LARGE variables: IS_AMPLIFY_CI: true + - identifier: cleanup_e2e_resources + buildspec: codebuild_specs/cleanup_e2e_resources.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build - identifier: mock_e2e_tests buildspec: codebuild_specs/mock_e2e_tests.yml env: @@ -54,3 +63,12 @@ batch: IS_AMPLIFY_CI: true depend-on: - prepare_build + - identifier: verify_yarn_lock + buildspec: codebuild_specs/verify_yarn_lock.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build diff --git a/codebuild_specs/cleanup_e2e_resources.yml b/codebuild_specs/cleanup_e2e_resources.yml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/codebuild_specs/verify_yarn_lock.yml b/codebuild_specs/verify_yarn_lock.yml new file mode 100644 index 00000000000..9fba2102f79 --- /dev/null +++ b/codebuild_specs/verify_yarn_lock.yml @@ -0,0 +1,7 @@ +version: 0.2 +env: + shell: bash +phases: + build: + commands: + - source ./shared-scripts.sh && _verifyYarnLock diff --git a/shared-scripts.sh b/shared-scripts.sh index 34218b6f679..9c207fbe3bb 100644 --- a/shared-scripts.sh +++ b/shared-scripts.sh @@ -95,8 +95,11 @@ function _verifyAPIExtract { yarn verify-api-extract } function _verifyYarnLock { + echo Verify yarn lock # download [repo, .cache from s3] - echo "Verify Yarn Lock" + loadCache repo $CODEBUILD_SRC_DIR + loadCache .cache $HOME/.cache + yarn verify-yarn-lock } function _verifyVersionsMatch { @@ -169,3 +172,11 @@ function _runE2ETestsLinux { cd packages/amplify-e2e-tests retry runE2eTest } + +function cleanupE2EResources { + loadCache repo $CODEBUILD_SRC_DIR + loadCache .cache $HOME/.cache + + cd packages/amplify-e2e-tests + yarn clean-e2e-resources +} From 4a34b417ad840bef304eed02e176f0277905b6c2 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 21 Mar 2023 13:27:29 -0400 Subject: [PATCH 104/107] chore: add e2e cleanup script --- codebuild_specs/cleanup_e2e_resources.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/codebuild_specs/cleanup_e2e_resources.yml b/codebuild_specs/cleanup_e2e_resources.yml index e69de29bb2d..6dd10460772 100644 --- a/codebuild_specs/cleanup_e2e_resources.yml +++ b/codebuild_specs/cleanup_e2e_resources.yml @@ -0,0 +1,7 @@ +version: 0.2 +env: + shell: bash +phases: + build: + commands: + - source ./shared-scripts.sh && _cleanupE2EResources From 7c928fa757a49c27f8dcc7086aa6a30880eb01b1 Mon Sep 17 00:00:00 2001 From: Eddy Varela Date: Tue, 4 Apr 2023 16:57:33 -0400 Subject: [PATCH 105/107] chore: adding two separate workflows --- codebuild_specs/e2e_workflow.yml | 74 ++++++++++++++++++++++++++++++++ codebuild_specs/pr_workflow.yml | 65 ++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 codebuild_specs/e2e_workflow.yml create mode 100644 codebuild_specs/pr_workflow.yml diff --git a/codebuild_specs/e2e_workflow.yml b/codebuild_specs/e2e_workflow.yml new file mode 100644 index 00000000000..25dfe25c6ff --- /dev/null +++ b/codebuild_specs/e2e_workflow.yml @@ -0,0 +1,74 @@ +--- +version: 0.2 +batch: + fast-fail: false + build-graph: + - identifier: prepare_build + buildspec: codebuild_specs/prepare_build.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + - identifier: cleanup_e2e_resources + buildspec: codebuild_specs/cleanup_e2e_resources.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: mock_e2e_tests + buildspec: codebuild_specs/mock_e2e_tests.yml + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: test + buildspec: codebuild_specs/test.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: lint + buildspec: codebuild_specs/lint.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: validate_cdk_version + buildspec: codebuild_specs/validate_cdk_version.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: verify_api_extract + buildspec: codebuild_specs/verify_api_extract.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: verify_yarn_lock + buildspec: codebuild_specs/verify_yarn_lock.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build diff --git a/codebuild_specs/pr_workflow.yml b/codebuild_specs/pr_workflow.yml new file mode 100644 index 00000000000..13400384d92 --- /dev/null +++ b/codebuild_specs/pr_workflow.yml @@ -0,0 +1,65 @@ +--- +version: 0.2 +batch: + fast-fail: false + build-graph: + - identifier: prepare_build + buildspec: codebuild_specs/prepare_build.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + - identifier: mock_e2e_tests + buildspec: codebuild_specs/mock_e2e_tests.yml + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: test + buildspec: codebuild_specs/test.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: lint + buildspec: codebuild_specs/lint.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: validate_cdk_version + buildspec: codebuild_specs/validate_cdk_version.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: verify_api_extract + buildspec: codebuild_specs/verify_api_extract.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build + - identifier: verify_yarn_lock + buildspec: codebuild_specs/verify_yarn_lock.yml + debug-session: true + env: + compute-type: BUILD_GENERAL1_LARGE + variables: + IS_AMPLIFY_CI: true + depend-on: + - prepare_build From 9f5287c03704e81ee21aa61f5dc0968b5556d31d Mon Sep 17 00:00:00 2001 From: jscriptual <111312780+jscriptual@users.noreply.github.com> Date: Tue, 4 Apr 2023 17:16:11 -0400 Subject: [PATCH 106/107] Update .editorconfig From a3c1448ee06f35de01c3fee6dfeb8ec8bfd3ead6 Mon Sep 17 00:00:00 2001 From: jscriptual <111312780+jscriptual@users.noreply.github.com> Date: Mon, 10 Apr 2023 11:10:11 -0400 Subject: [PATCH 107/107] Update codecov.yml --- codecov.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/codecov.yml b/codecov.yml index 928d582cf30..b7af5f41661 100644 --- a/codecov.yml +++ b/codecov.yml @@ -14,3 +14,4 @@ coverage: default: target: 80% if_not_found: success +