From 53c3f692469e82e35188897a22b4337a8bde6e9b Mon Sep 17 00:00:00 2001 From: Peter Innes Date: Mon, 14 Jun 2021 11:21:15 -0700 Subject: [PATCH 1/6] Adding npm test step to CI/CD pipeline templates. --- build/yaml/templates/component-template.yml | 2 ++ build/yaml/templates/npm-test-steps.yml | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 build/yaml/templates/npm-test-steps.yml diff --git a/build/yaml/templates/component-template.yml b/build/yaml/templates/component-template.yml index 95bd8ca858..bd27ea611e 100644 --- a/build/yaml/templates/component-template.yml +++ b/build/yaml/templates/component-template.yml @@ -9,6 +9,7 @@ stages: displayName: Build Node project steps: - template: npm-build-steps.yml + - template: npm-test-steps.yml - stage: stage_package_node displayName: 'Node: Build, Version & Pack' @@ -18,6 +19,7 @@ stages: displayName: 'Build & Pack Node project' steps: - template: npm-build-steps.yml + - template: npm-test-steps.yml - template: npm-versioning-steps.yml - template: npm-package-steps.yml diff --git a/build/yaml/templates/npm-test-steps.yml b/build/yaml/templates/npm-test-steps.yml new file mode 100644 index 0000000000..0db91c2c29 --- /dev/null +++ b/build/yaml/templates/npm-test-steps.yml @@ -0,0 +1,5 @@ +steps: +- script: | + yarn exec npm run --if-present test + displayName: 'Run test if it exists' + workingDirectory: '$(WorkingDirectory)' From 4340c692830ee81fbccdcf5b07abcf6812fb5544 Mon Sep 17 00:00:00 2001 From: Peter Innes Date: Mon, 14 Jun 2021 11:28:15 -0700 Subject: [PATCH 2/6] Add comment to generator-bot-adaptive to trigger pipeline. --- generators/generator-bot-adaptive/generators/app/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/generators/generator-bot-adaptive/generators/app/index.js b/generators/generator-bot-adaptive/generators/app/index.js index 0cbebf9ab3..252e0f763c 100644 --- a/generators/generator-bot-adaptive/generators/app/index.js +++ b/generators/generator-bot-adaptive/generators/app/index.js @@ -6,6 +6,8 @@ const rt = require('runtypes'); const { BaseGenerator, integrations, platforms } = require('../../index'); const { v4: uuidv4 } = require('uuid'); +// Adding a comment to trigger CI/CD pipeline and exercise unit tests. + const options = rt.Record({ applicationSettingsDirectory: rt.String, botProjectSettings: rt From 6aaf8a022dfc6c532eead558f9c44a84f43a474c Mon Sep 17 00:00:00 2001 From: Peter Innes Date: Mon, 14 Jun 2021 11:44:21 -0700 Subject: [PATCH 3/6] Restoring dependencies in npm-test-steps.yml. --- build/yaml/templates/npm-test-steps.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/yaml/templates/npm-test-steps.yml b/build/yaml/templates/npm-test-steps.yml index 0db91c2c29..0a056c8977 100644 --- a/build/yaml/templates/npm-test-steps.yml +++ b/build/yaml/templates/npm-test-steps.yml @@ -1,4 +1,9 @@ steps: +- script: | + yarn --immutable + displayName: 'Install dependencies' + workingDirectory: '$(WorkingDirectory)' + - script: | yarn exec npm run --if-present test displayName: 'Run test if it exists' From b1a2d2d5524bf721857b5bd8eb6d1be129c92267 Mon Sep 17 00:00:00 2001 From: Peter Innes Date: Mon, 14 Jun 2021 12:17:48 -0700 Subject: [PATCH 4/6] Updating npm-test-steps.yml to simply run 'yarn run test' due to difference in yarn package restoration location. --- build/yaml/templates/npm-test-steps.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/build/yaml/templates/npm-test-steps.yml b/build/yaml/templates/npm-test-steps.yml index 0a056c8977..19c7a79692 100644 --- a/build/yaml/templates/npm-test-steps.yml +++ b/build/yaml/templates/npm-test-steps.yml @@ -1,10 +1,5 @@ steps: - script: | - yarn --immutable - displayName: 'Install dependencies' - workingDirectory: '$(WorkingDirectory)' - -- script: | - yarn exec npm run --if-present test + yarn run test displayName: 'Run test if it exists' workingDirectory: '$(WorkingDirectory)' From 86490741da020d8761100cfd9083f36fede0dd74 Mon Sep 17 00:00:00 2001 From: Peter Innes Date: Mon, 14 Jun 2021 12:53:34 -0700 Subject: [PATCH 5/6] Updating npm-test-steps.yml to manually check for presence of test script in package.json, and conditionally only run 'yarn run test' if a test script is defined. --- build/yaml/templates/npm-test-steps.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/build/yaml/templates/npm-test-steps.yml b/build/yaml/templates/npm-test-steps.yml index 19c7a79692..1915442941 100644 --- a/build/yaml/templates/npm-test-steps.yml +++ b/build/yaml/templates/npm-test-steps.yml @@ -1,5 +1,26 @@ steps: +# You are probably wondering "Why not just run 'yarn exec npm run --if-present test'?". +# On Azure Pipelines, yarn install by default restores modules to a global node_modules cache +# instead of a local package cache. When running the npm CLI, it is unable to resolve required +# dependencies as a result, whereas yarn run