From 99e18a07f69b6dad9cf6e5afa999687cb51a4b7b Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 5 Oct 2021 20:14:40 +0300 Subject: [PATCH] ci: use the local Angular packages when testing AIO/docs examples with RxJS v7 (#43683) The `test_aio_local` and `test_docs_examples` CI jobs, test the AIO app and the docs examples using the locally built Angular packages. They also include steps that install RxJS v7 and test the examples against that as well, to avoid regressions with RxJS v7. However, it turns out that the `yarn add` command used to install RxJS v7 caused yarn to overwrite the local Agular packages in `node_modules/` with the ones from NPM. This commit ensures that the local Angular packages are restored in `node_modules/` after adding RxJS v7. It also adds a check to ensure that the restoration of local Angular packages did not affect the version of RxJS. PR Close #43683 --- .circleci/config.yml | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6b2bac12b91..40082e17d2e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -431,6 +431,8 @@ jobs: test_aio_local: executor: default-executor + environment: + RXJS_VERSION_7: '7.1.0' steps: - custom_attach_workspace - init_environment @@ -446,7 +448,15 @@ jobs: # Check the bundle sizes. - run: yarn --cwd aio payload-size aio-local # Run tests with RxJS v7. - - run: yarn --cwd aio add rxjs@7.1.0 + - run: yarn --cwd aio add rxjs@$RXJS_VERSION_7 && yarn --cwd aio aio-use-local + - run: + name: Ensure we use RxJS v7 + command: >- + node --eval " + const expected = process.env.RXJS_VERSION_7; + const actual = require('./aio/node_modules/rxjs/package.json').version; + assert(actual === expected, 'Expected RxJS v' + expected + ', but found v' + actual + '.'); + " - run: yarn --cwd aio test --progress=false --watch=false test_aio_tools: @@ -466,6 +476,8 @@ jobs: name: default-executor resource_class: xlarge parallelism: 5 + environment: + RXJS_VERSION_7: '7.1.0' steps: - custom_attach_workspace - init_environment @@ -477,8 +489,16 @@ jobs: # with either "0", "1", etc as node index. This can be passed to the "--shard" argument. - run: yarn --cwd aio example-e2e --setup --local --cliSpecsConcurrency=5 --shard=${CIRCLE_NODE_INDEX}/${CIRCLE_NODE_TOTAL} # Run tests with RxJS v7. - # (Exclude some examples that are not yet compatible with v7.) - - run: yarn --cwd aio/tools/examples/shared add rxjs@7.1.0 && yarn --cwd aio boilerplate:add + - run: yarn --cwd aio/tools/examples/shared add rxjs@$RXJS_VERSION_7 && yarn --cwd aio example-use-local && yarn --cwd aio boilerplate:add + - run: + name: Ensure we use RxJS v7 + command: >- + node --eval " + const expected = process.env.RXJS_VERSION_7; + const actual = require('./aio/tools/examples/shared/node_modules/rxjs/package.json').version; + assert(actual === expected, 'Expected RxJS v' + expected + ', but found v' + actual + '.'); + " + # Exclude some examples that are not yet compatible with v7. - run: yarn --cwd aio example-e2e --cliSpecsConcurrency=5 --shard=${CIRCLE_NODE_INDEX}/${CIRCLE_NODE_TOTAL} --exclude=practical-observable-usage --exclude=upgrade-module --exclude=upgrade-phonecat # This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`. @@ -492,7 +512,7 @@ jobs: - run: ./aio/scripts/build-artifacts.sh $AIO_SNAPSHOT_ARTIFACT_PATH $CI_PULL_REQUEST $CI_COMMIT - store_artifacts: path: *aio_preview_artifact_path - # The `destination` needs to be kept in synch with the value of + # The `destination` needs to be kept in sync with the value of # `AIO_ARTIFACT_PATH` in `aio/aio-builds-setup/Dockerfile` destination: aio/dist/aio-snapshot.tgz - run: node ./aio/scripts/create-preview $CIRCLE_BUILD_NUM