From 9ab8d29e4360b223e46e20a345005a9d1c7af8db Mon Sep 17 00:00:00 2001 From: Apeksha Awasthi Date: Thu, 28 Feb 2019 15:56:16 -0500 Subject: [PATCH] Set up CI with Azure Pipelines --- .azure-pipelines-steps.yml | 34 ++++++++++++++++++++++++++++++++++ .azure-pipelines.yml | 35 +++++++++++++++++++++++++++++++++++ ava.config.js | 3 +++ package.json | 11 ++++++++--- readme.md | 1 + 5 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 .azure-pipelines-steps.yml create mode 100644 .azure-pipelines.yml create mode 100644 ava.config.js diff --git a/.azure-pipelines-steps.yml b/.azure-pipelines-steps.yml new file mode 100644 index 0000000..5d04af3 --- /dev/null +++ b/.azure-pipelines-steps.yml @@ -0,0 +1,34 @@ +steps: +- task: NodeTool@0 + inputs: + versionSpec: $(NODE_VERSION) + displayName: 'Install Node.js' + +- script: npm install + displayName: 'Install dependencies (npm install)' + +- script: npm run test:lint + displayName: 'Run lint check' + +- script: npm run test:validate + displayName: 'Run TypeScript Declaration / Flow checks' + +- bash: | + npm install -g tap-junit + npm run test:ava | tap-junit > test-results.xml + env: + CI: true + displayName: 'Run tests' + +- task: PublishTestResults@2 + inputs: + testResultsFormat: JUnit + testResultsFiles: './test-results.xml' + testRunTitle: '$(System.JobIdentifier) tests' + displayName: 'Publish test results' + +- script: npm run report-coverage + env: + COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN_SECRET) + continueOnError: true + displayName: 'Publish coverage results' diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml new file mode 100644 index 0000000..5b46cab --- /dev/null +++ b/.azure-pipelines.yml @@ -0,0 +1,35 @@ +trigger: +- master + +jobs: + - job: Linux + pool: + vmImage: 'ubuntu-16.04' + strategy: + matrix: + Node8: + NODE_VERSION: '8.x' + Node10: + NODE_VERSION: '10.x' + steps: + - template: .azure-pipelines-steps.yml + + - job: Windows + pool: + vmImage: vs2017-win2016 + strategy: + matrix: + Node10: + NODE_VERSION: '10.x' + steps: + - template: .azure-pipelines-steps.yml + + - job: macOS + pool: + vmImage: macos-10.13 + strategy: + matrix: + Node10: + NODE_VERSION: '10.x' + steps: + - template: .azure-pipelines-steps.yml diff --git a/ava.config.js b/ava.config.js new file mode 100644 index 0000000..ed5b94e --- /dev/null +++ b/ava.config.js @@ -0,0 +1,3 @@ +export default function config() { + return process.env.CI ? {tap: true} : {}; +} diff --git a/package.json b/package.json index bbc1634..e9ac3a6 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,12 @@ "node": ">=8" }, "scripts": { - "test": "xo && nyc ava && tsd-check && flow", - "bench": "matcha benchmark.js" + "test:lint": "xo", + "test:ava": "nyc ava", + "test:validate": "tsd-check && flow", + "test": "npm-run-all test:*", + "bench": "matcha benchmark.js", + "report-coverage": "nyc report --reporter=text-lcov | coveralls" }, "files": [ "index.js", @@ -53,7 +57,8 @@ "flow-bin": "^0.94.0", "import-fresh": "^3.0.0", "matcha": "^0.7.0", - "nyc": "^13.3.0", + "npm-run-all": "^4.1.5", + "nyc": "^13.1.0", "resolve-from": "^4.0.0", "tsd-check": "^0.3.0", "xo": "^0.24.0" diff --git a/readme.md b/readme.md index 1e3b9bb..4147fa3 100644 --- a/readme.md +++ b/readme.md @@ -10,6 +10,7 @@ > Terminal string styling done right [![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript- and Flow-ready](https://img.shields.io/npm/types/chalk.svg) +[![Azure Pipelines Build Status](https://dev.azure.com/chalk-ci/chalk/_apis/build/status/chalk?branchName=master)](https://dev.azure.com/chalk-ci/chalk/_build/latest?definitionId=1&branchName=master)