diff --git a/.github/workflows/run-eslint.yml b/.github/workflows/run-eslint.yml index 64747fa09c..06e9df001f 100644 --- a/.github/workflows/run-eslint.yml +++ b/.github/workflows/run-eslint.yml @@ -1,17 +1,19 @@ -name: Run ESLint +name: Code Analysis on: workflow_dispatch: push: branches: - - stgum/test + - main + - 4.10 pull_request: branches: - - stgum/test + - main + - 4.10 jobs: build: - name: 'Run eslint' + name: Run ESLint runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index 50373d7bc6..98ad14bc5a 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ To get started building bots using the SDK, see the [Azure Bot Service Documenta The [Bot Framework Samples](https://github.com/microsoft/botbuilder-samples) includes a rich set of samples repository. -If you want to debug an issue, would like to [contribute](#contributing), or understand how the Bot Builder SDK works, instructions for building and testing the SDK are below. +If you want to debug an issue, would like to [contribute](#Contributing-and-our-code-of-conduct), or understand how the Bot Builder SDK works, instructions for building and testing the SDK are below. ### Prerequisites - [Git](https://git-scm.com/downloads) @@ -64,7 +64,7 @@ If you want to debug an issue, would like to [contribute](#contributing), or und Clone a copy of the repo: ```bash -git clone https://github.com/Microsoft/botbuilder-js.git +git clone https://github.com/microsoft/botbuilder-js.git ``` Change to the SDK's directory: @@ -106,7 +106,7 @@ npm install --global autorest Below are the various channels that are available to you for obtaining support and providing feedback. Please pay carful attention to which channel should be used for which type of content. e.g. general "how do I..." questions should be asked on Stack Overflow, Twitter or Gitter, with GitHub issues being for feature requests and bug reports. ### Github issues -[Github issues](https://github.com/Microsoft/botbuilder-python/issues) should be used for bugs and feature requests. +[Github issues](https://github.com/Microsoft/botbuilder-js/issues) should be used for bugs and feature requests. ### Stack overflow [Stack Overflow](https://stackoverflow.com/questions/tagged/botframework) is a great place for getting high-quality answers. Our support team, as well as many of our community members are already on Stack Overflow providing answers to 'how-to' questions. @@ -121,7 +121,7 @@ We use the [@botframework](https://twitter.com/botframework) account on twitter The [Gitter Channel](https://gitter.im/Microsoft/BotBuilder) provides a place where the Community can get together and collaborate. ## Contributing and our code of conduct -We welcome contributions and suggestions. Please see our [contributing guidelines](./contributing.md) for more information. +We welcome contributions and suggestions. Please see our [contributing guidelines](./Contributing.md) for more information. This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact @@ -136,4 +136,4 @@ at [secure@microsoft.com](mailto:secure@microsoft.com). You should receive a re Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the [MIT](./LICENSE.md) License. +Licensed under the [MIT](./LICENSE) License. diff --git a/build/yaml/botbuilder-js-ci-node12.yml b/build/yaml/botbuilder-js-ci-node12.yml index 1cb7704333..50309faa36 100644 --- a/build/yaml/botbuilder-js-ci-node12.yml +++ b/build/yaml/botbuilder-js-ci-node12.yml @@ -11,10 +11,6 @@ pool: variables: NodeVersion: 12.x # CI_PULL_REQUEST: define this in Azure -# COVERALLS_GIT_BRANCH: define this in Azure -# COVERALLS_GIT_COMMIT: define this in Azure -# COVERALLS_SERVICE_JOB_ID: define this in Azure -# COVERALLS_SERVICE_NAME: define this in Azure # version: define this in Azure, settable at queue time stages: @@ -30,10 +26,3 @@ stages: displayName: 'Dir workspace except node-modules (takes 5 seconds)' continueOnError: true condition: succeededOrFailed() - -- stage: CodeAnalysis - dependsOn: [] # Run this stage in parallel - jobs: - - job: - steps: - - template: js-analysis-steps.yml \ No newline at end of file diff --git a/build/yaml/botbuilder-js-ci.yml b/build/yaml/botbuilder-js-ci.yml index ab2bee1203..e3442b5396 100644 --- a/build/yaml/botbuilder-js-ci.yml +++ b/build/yaml/botbuilder-js-ci.yml @@ -1,5 +1,5 @@ # -# This runs under BotBuilder-Js-CI-yaml. Replaces classic build BotBuilder-JS-master-CI. +# This runs under botbuilder-js-ci.yml. Runs unit tests on Node versions 10, 12 and 14. # # "name" here defines the build number format. Build number is accessed via $(Build.BuildNumber) @@ -8,22 +8,21 @@ name: $(Build.BuildId) pool: vmImage: 'macOS-10.15' -variables: - NodeVersion: 10.x +# variables: # CI_PULL_REQUEST: define this in Azure -# COVERALLS_GIT_BRANCH: define this in Azure -# COVERALLS_GIT_COMMIT: define this in Azure -# COVERALLS_SERVICE_JOB_ID: define this in Azure -# COVERALLS_SERVICE_NAME: define this in Azure # version: define this in Azure, settable at queue time stages: -- stage: Build +- stage: Node10CI + dependsOn: [] # Run this stage in parallel + displayName: 'Node 10.x CI' + variables: + NodeVersion: 10.x jobs: - - job: + - job: Node10UnitTests + displayName: 'Node 10.x Unit Tests' steps: - template: js-build-steps.yml - - powershell: | pushd .. Get-ChildItem -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"} @@ -31,9 +30,39 @@ stages: continueOnError: true condition: succeededOrFailed() -- stage: CodeAnalysis +- stage: Node12CI dependsOn: [] # Run this stage in parallel + displayName: 'Node 12.x CI' + variables: + NodeVersion: 12.x jobs: - - job: + - job: Node12UnitTests + displayName: 'Node 12.x Unit Tests' + variables: + PostToDevOps: true # Post current Node LTS (12.x) code coverage report steps: - - template: js-analysis-steps.yml \ No newline at end of file + - template: js-build-steps.yml + - powershell: | + pushd .. + Get-ChildItem -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"} + displayName: 'Dir workspace except node-modules (takes 5 seconds)' + continueOnError: true + condition: succeededOrFailed() + +- stage: Node14CI + dependsOn: + - Node10CI # Node 14 is not the current LTS, so to save agents it will run after Node 10 completes + displayName: 'Node 14.x CI' + variables: + NodeVersion: 14.x + jobs: + - job: Node14UnitTests + displayName: 'Node 14.x Unit Tests' + steps: + - template: js-build-steps.yml + - powershell: | + pushd .. + Get-ChildItem -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"} + displayName: 'Dir workspace except node-modules (takes 5 seconds)' + continueOnError: true + condition: succeededOrFailed() diff --git a/build/yaml/js-analysis-steps.yml b/build/yaml/js-analysis-steps.yml deleted file mode 100644 index a2c1660867..0000000000 --- a/build/yaml/js-analysis-steps.yml +++ /dev/null @@ -1,19 +0,0 @@ -steps: -- task: NodeTool@0 - displayName: 'Use Node $(NodeVersion)' - inputs: - versionSpec: $(NodeVersion) - -- task: Npm@1 - displayName: 'npm install' - inputs: - command: custom - verbose: false - customCommand: 'install' - -- task: Npm@1 - displayName: 'npm run eslint' - inputs: - command: custom - verbose: false - customCommand: 'run eslint' \ No newline at end of file diff --git a/build/yaml/js-build-steps.yml b/build/yaml/js-build-steps.yml index 52ad0239fe..20cc569604 100644 --- a/build/yaml/js-build-steps.yml +++ b/build/yaml/js-build-steps.yml @@ -25,14 +25,6 @@ steps: workingDir: tools verbose: false -- task: Npm@1 - displayName: 'npm install coveralls --save-dev' - inputs: - command: custom - workingDir: tools - verbose: false - customCommand: 'install coveralls --save-dev' - - bash: | set -o xtrace sed -i '' 's/${Version}/$(version)/g' package.json @@ -92,24 +84,31 @@ steps: enabled: false - task: Npm@1 - displayName: 'npm run test-coverage' + displayName: 'npm run test:devops' inputs: command: custom verbose: false - customCommand: 'run test-coverage' + customCommand: 'run test:devops' -- powershell: | - Write-Host "Setting environment variable COVERALLS_REPO_TOKEN" - "##vso[task.setvariable variable=COVERALLS_REPO_TOKEN;]$(JsCoverallsToken)" - displayName: 'Set COVERALLS_REPO_TOKEN' - continueOnError: true - condition: and(succeeded(), ne(variables['System.PullRequest.IsFork'], 'True')) +# Publish test results to Azure Pipelines +- task: PublishTestResults@2 + displayName: 'Publish test results to Azure DevOps' + inputs: + testResultsFormat: 'JUnit' + testResultsFiles: '**/test-results.xml' + mergeTestResults: true + failTaskOnFailedTests: false # All test results should be published. Default is false, never set to true. + testRunTitle: 'Unit Tests for $(Build.SourceVersion)' + #buildPlatform: # Optional + #buildConfiguration: # Optional - Include Node runtime version? + #publishRunAttachments: true # Optional + condition: and(succeeded(), ne(variables['System.PullRequest.IsFork'], 'True'), eq(variables['PostToDevOps'], true)) -- task: Npm@1 - displayName: 'Upload coverage report to Coveralls https://coveralls.io/github/microsoft/botbuilder-js' +- task: PublishCodeCoverageResults@1 inputs: - command: custom - verbose: false - customCommand: 'run upload-coverage' - continueOnError: true - condition: and(succeeded(), ne(variables['System.PullRequest.IsFork'], 'True')) + codeCoverageTool: 'cobertura' + summaryFileLocation: './coverage/cobertura-coverage.xml' + #pathToSources: # Optional + #reportDirectory: # Optional + #additionalCodeCoverageFiles: # Optional + failIfCoverageEmpty: true diff --git a/package.json b/package.json index ae772ead51..467f88f04c 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "test:consumer": "node ./run-consumer-test.js", "test:coveralls": "lerna run build && nyc mocha \"libraries/@(adaptive*|bot*)/tests/**/*.test.js\" --exit && nyc report --reporter=text-lcov | coveralls", "test-coverage": "nyc mocha \"libraries/@(adaptive*|bot*)/tests/**/*.test.js\" --exit --check-leaks", + "test:devops": "nyc --report --reporter=cobertura mocha -- \"libraries/@(adaptive*|bot*)/tests/**/*.test.js\" --check-leaks --reporter mocha-junit-reporter --reporter-options includePending=true", "upload-coverage": "nyc report --reporter=text-lcov | coveralls", "build-docs": "lerna run build-docs", "eslint": "eslint ./libraries/*/src/**/*.ts --resolve-plugins-relative-to .", @@ -50,6 +51,7 @@ "eslint-plugin-promise": "^4.2.1", "eslint-plugin-security": "^1.4.0", "eslint-plugin-standard": "^4.0.1", + "mocha-junit-reporter": "^2.0.0", "prettier": "^2.1.2" }, "nyc": {