Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
feat(services): add Cirrus CI (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored and eddiemoore committed Mar 10, 2019
1 parent 00d484b commit aa5a2b0
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This script ( `bin/codecov` ) detect your CI provider and all coverage reports a

Once your app is instrumented for coverage, and building, simply call `./node_modules/.bin/codecov`.

This library currently supports the following CI companies: [Travis CI](https://travis-ci.org/), [Travis](https://travis-ci.com/), [Appveyor](https://appveyor.com/), [CircleCI](https://circleci.com/), [Codeship](https://codeship.io/), [Drone](https://drone.io/), [Jenkins](http://jenkins-ci.org/), [Shippable](https://shippable.com/), [Semaphore](https://semaphoreapp.com/), [Wercker](https://wercker.com/), [Snap CI](https://snap-ci.com/), [Buildkite](https://buildkite.com/).
This library currently supports the following CI companies: [Travis CI](https://travis-ci.org/), [Travis](https://travis-ci.com/), [Appveyor](https://appveyor.com/), [CircleCI](https://circleci.com/), [Cirrus CI](https://cirrus-ci.org/), [Codeship](https://codeship.io/), [Drone](https://drone.io/), [Jenkins](http://jenkins-ci.org/), [Shippable](https://shippable.com/), [Semaphore](https://semaphoreapp.com/), [Wercker](https://wercker.com/), [Snap CI](https://snap-ci.com/), [Buildkite](https://buildkite.com/).

#### Upload repo tokens

Expand Down
1 change: 1 addition & 0 deletions lib/detect.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var services = {
travis: require('./services/travis'),
circle: require('./services/circle'),
cirrus: require('./services/cirrus'),
buildkite: require('./services/buildkite'),
azurePipelines: require('./services/azurePipelines'),
codeship: require('./services/codeship'),
Expand Down
17 changes: 17 additions & 0 deletions lib/services/cirrus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
detect: function() {
return !!process.env.CIRRUS_CI
},
configuration: function() {
console.log(' Cirrus CI Detected')
return {
service: 'cirrusci',
build: process.env.CIRRUS_BUILD_ID,
job: process.env.CIRRUS_TASK_ID,
commit: process.env.CIRRUS_CHANGE_IN_REPO,
branch: process.env.CIRRUS_BRANCH,
pr: process.env.CIRRUS_PR,
slug: process.env.CIRRUS_REPO_FULL_NAME,
}
},
}
27 changes: 27 additions & 0 deletions test/services/cirrus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var cirrus = require('../../lib/services/cirrus')

describe('Cirrus CI Provider', function() {
it('can detect cirrus', function() {
process.env.CIRRUS_CI = 'true'
expect(cirrus.detect()).to.be(true)
})

it('can get cirrus env info', function() {
process.env.CIRRUS_CI = 'true'
process.env.CIRRUS_BUILD_ID = '1234.1'
process.env.CIRRUS_CHANGE_IN_REPO = '5678'
process.env.CIRRUS_BRANCH = 'master'
process.env.CIRRUS_TASK_ID = '1234.1'
process.env.CIRRUS_PR = 'blah'
process.env.CIRRUS_REPO_FULL_NAME = 'owner/repo'
expect(cirrus.configuration()).to.eql({
service: 'cirrusci',
commit: '5678',
build: '1234.1',
job: '1234.1',
branch: 'master',
pr: 'blah',
slug: 'owner/repo',
})
})
})

0 comments on commit aa5a2b0

Please sign in to comment.