Skip to content

Add Azure Pipelines CI #2299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 20, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .azure-pipelines-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
steps:
- script: npm i -g npm@$(npm_version)
displayName: Use legacy npm version $(npm_version)
condition: ne(variables['npm_version'], '')

- task: NodeTool@0
inputs:
versionSpec: '$(node_version)'
displayName: Use Node $(node_version)

- script: npm install
displayName: npm install

- script: npm run coveralls
env:
COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN_SECRET)
displayName: Run coveralls
condition: eq(variables['run_coveralls'], true)

- script: npm test
displayName: Run tests
condition: ne(variables['run_coveralls'], true)

- task: PublishTestResults@2
inputs:
testResultsFiles: '**/xunit.xml'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So azure pipelines only speaks xunit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this input it does, but it can also use JUnit, NUnit, VSTest, xUnit, or cTest, we'd just need to change testResultsFiles to something like **/junit.xml. I believe if we want we could also do something like **/TEST-**.xml, this input really just works as a pattern matcher I think.

I used xunit since that matches the custom reporter I added (more on that below).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@damccorm It looks like mocha (even the version we use) ships with an XUnit reporter. Can we just use that? We can have an azure script that does mocha --async-only --reporter xunit

That way we can drop the extra reporter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works, the only downside is we don't get great output in the console.

What we get with multi-reporter:

image

What we get with xunit reporter:

image

I have this change in PR, if you're comfortable with that tradeoff I'll merge just let me know.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh actually, on closer inspection, this doesn't get written to a file which is necessary for us to report results. We can pipe it out to a file, but that would mean we would get no output at all on the console.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use the -O output=test.xunit flag to specify the output file. I was thinking we could just run the test suites as separate phases, one with the spec reporter and one with the xunit reporter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me! Updated accordingly

condition: succeededOrFailed()
66 changes: 66 additions & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
trigger:
- master
- releases/*

jobs:
- job: Test_Linux
displayName: Run Tests on Linux
pool:
vmImage: "Ubuntu 16.04"
variables:
run_coveralls: true
strategy:
matrix:
Node_v10:
node_version: 10
Node_v8:
node_version: 8
Node_v6:
node_version: 6
Node_v4:
node_version: 4
Node_v0_12:
node_version: 0.12
Node_v0_10:
node_version: 0.10
steps:
- template: .azure-pipelines-steps.yml

- job: Test_Windows
displayName: Run Tests on Windows
pool:
vmImage: vs2017-win2016
strategy:
matrix:
Node_v10:
node_version: 10
Node_v8:
node_version: 8
Node_v6:
node_version: 6
Node_v4:
node_version: 4
npm_version: 2
Node_v0_12:
node_version: 0.12
npm_version: 2
Node_v0_10:
node_version: 0.10
npm_version: 2
steps:
- template: .azure-pipelines-steps.yml

- job: Test_MacOS
displayName: Run Tests on MacOS
pool:
vmImage: macos-10.13
strategy:
matrix:
Node_v10:
node_version: 10
Node_v4:
node_version: 4
Node_v0_10:
node_version: 0.10
steps:
- template: .azure-pipelines-steps.yml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ node_modules

# Garbage files
.DS_Store

# Test results
xunit.xml
Loading