From b2c6c7e4c6cc85e6f7579b3c32081590d9517728 Mon Sep 17 00:00:00 2001 From: Danny McCormick Date: Wed, 20 Mar 2019 15:06:50 -0400 Subject: [PATCH] Build: Add Azure Pipelines CI (#2299) --- .ci/.azure-pipelines-steps.yml | 38 +++++++++++++++ .ci/.azure-pipelines.yml | 84 ++++++++++++++++++++++++++++++++++ .gitignore | 4 ++ package.json | 10 ++-- 4 files changed, 131 insertions(+), 5 deletions(-) create mode 100644 .ci/.azure-pipelines-steps.yml create mode 100644 .ci/.azure-pipelines.yml diff --git a/.ci/.azure-pipelines-steps.yml b/.ci/.azure-pipelines-steps.yml new file mode 100644 index 000000000..ef26e4e60 --- /dev/null +++ b/.ci/.azure-pipelines-steps.yml @@ -0,0 +1,38 @@ +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 test + displayName: Run tests + +- script: npm run coveralls + displayName: Run coveralls + env: + # Pretend to be AppVeyor for now + APPVEYOR: true + APPVEYOR_BUILD_NUMBER: $(Build.BuildNumber) + APPVEYOR_BUILD_ID: $(Agent.OS)_$(node_version) + APPVEYOR_REPO_COMMIT: $(Build.SourceVersion) + APPVEYOR_REPO_BRANCH: $(Build.SourceBranchName) + # Overwrite the GitLab Service Name + COVERALLS_SERVICE_NAME: Azure Pipelines + COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN_SECRET) + COVERALLS_PARALLEL: true + CI_PULL_REQUEST: $(System.PullRequest.PullRequestNumber) + +- script: npm run azure-pipelines + displayName: Write tests to xml + +- task: PublishTestResults@2 + inputs: + testResultsFiles: '**/test.xunit' + condition: succeededOrFailed() diff --git a/.ci/.azure-pipelines.yml b/.ci/.azure-pipelines.yml new file mode 100644 index 000000000..dcdd68e63 --- /dev/null +++ b/.ci/.azure-pipelines.yml @@ -0,0 +1,84 @@ +trigger: +- master +- releases/* + +jobs: + - job: Test_Linux + displayName: Run Tests on Linux + pool: + vmImage: "Ubuntu 16.04" + 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_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: Notify_Coveralls + displayName: Notify Coveralls that the parallel report is done + pool: + vmImage: "Ubuntu 16.04" + dependsOn: + - Test_Linux + - Test_Windows + - Test_MacOS + steps: + - script: curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$BUILD_NAME&payload[status]=done" + env: + COVERALLS_REPO_TOKEN: $(COVERALLS_REPO_TOKEN_SECRET) + BUILD_NAME: $(Build.BuildNumber) diff --git a/.gitignore b/.gitignore index ac88dd1f0..466085e12 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ lib-cov # Coverage directory used by tools like istanbul coverage +.nyc_output # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) .grunt @@ -29,3 +30,6 @@ node_modules # Garbage files .DS_Store + +# Test results +test.xunit diff --git a/package.json b/package.json index a4ce8bcaa..38b855cf4 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,9 @@ "scripts": { "lint": "eslint .", "pretest": "npm run lint", - "test": "mocha --async-only", - "cover": "istanbul cover _mocha --report lcovonly", - "coveralls": "npm run cover && istanbul-coveralls" + "test": "nyc mocha --async-only", + "azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit", + "coveralls": "nyc report --reporter=text-lcov | coveralls" }, "dependencies": { "glob-watcher": "^5.0.0", @@ -36,13 +36,13 @@ "vinyl-fs": "^3.0.0" }, "devDependencies": { + "coveralls": "github:phated/node-coveralls#2.x", "eslint": "^2.13.1", "eslint-config-gulp": "^3.0.1", "expect": "^1.20.2", - "istanbul": "^0.4.3", - "istanbul-coveralls": "^1.0.3", "mkdirp": "^0.5.1", "mocha": "^3.0.0", + "nyc": "^10.3.2", "rimraf": "^2.2.5" }, "keywords": [