Skip to content

Commit

Permalink
CI Improvements around runtime coverage, code coverage reports and ad…
Browse files Browse the repository at this point in the history
…d GitHub workflows (#2868)

* move to GitHub workflow only for code analysis

* setup Node CI Matrix, use Azure DevOps for code coverage reports

* cleanup README.md

* add test:devops script and reporter devDependency
  • Loading branch information
stevengum authored Oct 5, 2020
1 parent 876100d commit 6ebb785
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 75 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/run-eslint.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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.
11 changes: 0 additions & 11 deletions build/yaml/botbuilder-js-ci-node12.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
55 changes: 42 additions & 13 deletions build/yaml/botbuilder-js-ci.yml
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -8,32 +8,61 @@ 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*"}
displayName: 'Dir workspace except node-modules (takes 5 seconds)'
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
- 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()
19 changes: 0 additions & 19 deletions build/yaml/js-analysis-steps.yml

This file was deleted.

45 changes: 22 additions & 23 deletions build/yaml/js-build-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 .",
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit 6ebb785

Please sign in to comment.