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

Commit 25a4e6b

Browse files
sy-hasheddiemoore
authored andcommitted
Add support for heroku CI (#127)
1 parent b811a12 commit 25a4e6b

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

lib/detect.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ var services = {
1212
semaphore: require('./services/semaphore'),
1313
snap: require('./services/snap'),
1414
gitlab: require('./services/gitlab'),
15+
heroku: require('./services/heroku'),
1516
}
1617

1718
var detectProvider = function() {

lib/services/heroku.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// https://devcenter.heroku.com/articles/heroku-ci
2+
3+
module.exports = {
4+
detect: function() {
5+
return !!process.env.HEROKU_TEST_RUN_ID
6+
},
7+
8+
configuration: function() {
9+
console.log(' heroku CI Detected')
10+
return {
11+
service: 'heroku',
12+
build: process.env.HEROKU_TEST_RUN_ID,
13+
commit: process.env.HEROKU_TEST_RUN_COMMIT_VERSION,
14+
branch: process.env.HEROKU_TEST_RUN_BRANCH,
15+
}
16+
},
17+
}

test/services/heroku.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var heroku = require('../../lib/services/heroku')
2+
3+
describe('Heroku CI Provider', function() {
4+
it('can detect heroku', function() {
5+
process.env.HEROKU_TEST_RUN_ID = '454f5dc9-afa4-433f-bb28-84678a00fd98'
6+
expect(heroku.detect()).toBe(true)
7+
})
8+
9+
it('can get wercker env info', function() {
10+
process.env.HEROKU_TEST_RUN_ID = '454f5dc9-afa4-433f-bb28-84678a00fd98'
11+
process.env.HEROKU_TEST_RUN_COMMIT_VERSION =
12+
'743b04806ea677403aa2ff26c6bdeb85005de658'
13+
process.env.HEROKU_TEST_RUN_BRANCH = 'master'
14+
expect(heroku.configuration()).toEqual({
15+
service: 'heroku',
16+
commit: '743b04806ea677403aa2ff26c6bdeb85005de658',
17+
build: '454f5dc9-afa4-433f-bb28-84678a00fd98',
18+
branch: 'master',
19+
})
20+
})
21+
})

0 commit comments

Comments
 (0)