Skip to content

Commit ae2c24d

Browse files
authored
fix(e2e): Resolve the local version codegen for e2e tests (#479)
* fix(e2e): add codegen version check * add cache restore * add npm global path change
1 parent ab991c3 commit ae2c24d

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.circleci/config.base.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ install_cli_with_local_codegen: &install_cli
3636
source .circleci/local_publish_helpers.sh
3737
startLocalRegistry "$(pwd)/.circleci/verdaccio.yaml"
3838
setNpmRegistryUrlToLocal
39-
sudo npm install -g @aws-amplify/cli-internal
40-
sudo npm install -g amplify-app
39+
changeNpmGlobalPath
40+
npm install -g @aws-amplify/cli-internal
4141
amplify -v
42-
amplify-app --version
42+
npm list --global --depth=1
4343
unsetNpmRegistryUrl
4444
working_directory: ~/repo
4545

@@ -154,6 +154,8 @@ jobs:
154154
steps:
155155
- attach_workspace:
156156
at: ./
157+
- restore_cache:
158+
key: amplify-codegen-yarn-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}
157159
- restore_cache:
158160
key: amplify-verdaccio-cache-{{ .Branch }}-{{ .Revision }}
159161
- run: *install_cli

.circleci/config.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ install_cli_with_local_codegen: &ref_3
3434
source .circleci/local_publish_helpers.sh
3535
startLocalRegistry "$(pwd)/.circleci/verdaccio.yaml"
3636
setNpmRegistryUrlToLocal
37-
sudo npm install -g @aws-amplify/cli-internal
38-
sudo npm install -g amplify-app
37+
changeNpmGlobalPath
38+
npm install -g @aws-amplify/cli-internal
3939
amplify -v
40-
amplify-app --version
40+
npm list --global --depth=1
4141
unsetNpmRegistryUrl
4242
working_directory: ~/repo
4343
clean_up_e2e_resources: &ref_5
@@ -157,6 +157,8 @@ jobs:
157157
steps: &ref_4
158158
- attach_workspace:
159159
at: ./
160+
- restore_cache:
161+
key: 'amplify-codegen-yarn-deps-{{ .Branch }}-{{ checksum "yarn.lock" }}'
160162
- restore_cache:
161163
key: 'amplify-verdaccio-cache-{{ .Branch }}-{{ .Revision }}'
162164
- run: *ref_3

.circleci/local_publish_helpers.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ function setNpmRegistryUrlToLocal {
2828
npm set registry "$custom_registry_url"
2929
yarn config set registry "$custom_registry_url"
3030
}
31+
32+
function changeNpmGlobalPath {
33+
mkdir -p ~/.npm-global
34+
npm config set prefix '~/.npm-global'
35+
export PATH=~/.npm-global/bin:$PATH
36+
}

0 commit comments

Comments
 (0)