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

Commit

Permalink
Add support for heroku CI (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-hash authored and eddiemoore committed May 9, 2019
1 parent b811a12 commit 25a4e6b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/detect.js
Expand Up @@ -12,6 +12,7 @@ var services = {
semaphore: require('./services/semaphore'),
snap: require('./services/snap'),
gitlab: require('./services/gitlab'),
heroku: require('./services/heroku'),
}

var detectProvider = function() {
Expand Down
17 changes: 17 additions & 0 deletions lib/services/heroku.js
@@ -0,0 +1,17 @@
// https://devcenter.heroku.com/articles/heroku-ci

module.exports = {
detect: function() {
return !!process.env.HEROKU_TEST_RUN_ID
},

configuration: function() {
console.log(' heroku CI Detected')
return {
service: 'heroku',
build: process.env.HEROKU_TEST_RUN_ID,
commit: process.env.HEROKU_TEST_RUN_COMMIT_VERSION,
branch: process.env.HEROKU_TEST_RUN_BRANCH,
}
},
}
21 changes: 21 additions & 0 deletions test/services/heroku.test.js
@@ -0,0 +1,21 @@
var heroku = require('../../lib/services/heroku')

describe('Heroku CI Provider', function() {
it('can detect heroku', function() {
process.env.HEROKU_TEST_RUN_ID = '454f5dc9-afa4-433f-bb28-84678a00fd98'
expect(heroku.detect()).toBe(true)
})

it('can get wercker env info', function() {
process.env.HEROKU_TEST_RUN_ID = '454f5dc9-afa4-433f-bb28-84678a00fd98'
process.env.HEROKU_TEST_RUN_COMMIT_VERSION =
'743b04806ea677403aa2ff26c6bdeb85005de658'
process.env.HEROKU_TEST_RUN_BRANCH = 'master'
expect(heroku.configuration()).toEqual({
service: 'heroku',
commit: '743b04806ea677403aa2ff26c6bdeb85005de658',
build: '454f5dc9-afa4-433f-bb28-84678a00fd98',
branch: 'master',
})
})
})

0 comments on commit 25a4e6b

Please sign in to comment.