Skip to content

Commit

Permalink
feat: add Vela CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Oct 29, 2023
1 parent fc243f4 commit bb13901
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Officially supported CI servers:
| [TaskCluster](http://docs.taskcluster.net) | `ci.TASKCLUSTER` | 🚫 |
| [TeamCity](https://www.jetbrains.com/teamcity/) by JetBrains | `ci.TEAMCITY` | 🚫 |
| [Travis CI](http://travis-ci.org) | `ci.TRAVIS` ||
| [Vela](https://go-vela.github.io/docs/) | `ci.VELA` ||
| [Vercel](https://vercel.com/) | `ci.VERCEL` ||
| [Visual Studio App Center](https://appcenter.ms/) | `ci.APPCENTER` | 🚫 |
| [Woodpecker](https://woodpecker-ci.org/) | `ci.WOODPECKER` ||
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const STRIDER: boolean;
export const TASKCLUSTER: boolean;
export const TEAMCITY: boolean;
export const TRAVIS: boolean;
export const VELA: boolean;
export const VERCEL: boolean;
export const APPCENTER: boolean;
export const WOODPECKER: boolean;
Expand Down
38 changes: 38 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,44 @@ test('Agola CI - PR', function (t) {
t.end()
})

test('Vela', function (t) {
process.env.VELA = 'true'
process.env.VELA_PULL_REQUEST = '2'

clearModule('./')
const ci = require('./')

t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Vela')
t.equal(ci.VELA, true)
assertVendorConstants('VELA', ci, t)

delete process.env.VELA
delete process.env.VELA_PULL_REQUEST

t.end()
})

test('Vela - PR', function (t) {
process.env.VELA = 'true'
process.env.VELA_PULL_REQUEST = '1'

clearModule('./')
const ci = require('./')

t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Vela')
t.equal(ci.VELA, true)
assertVendorConstants('VELA', ci, t)

delete process.env.VELA
delete process.env.VELA_PULL_REQUEST

t.end()
})

function assertVendorConstants (expect, ci, t) {
ci._vendors.forEach(function (constant) {
let bool = constant === expect
Expand Down
8 changes: 8 additions & 0 deletions vendors.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@
"ne": "false"
}
},
{
"name": "Vela",
"constant": "VELA",
"env": "VELA",
"pr": {
"VELA_PULL_REQUEST": "1"
}
},
{
"name": "Vercel",
"constant": "VERCEL",
Expand Down

0 comments on commit bb13901

Please sign in to comment.