From bb13901a07b0a43f8cbf1c3eb9c10f98047ce861 Mon Sep 17 00:00:00 2001 From: Sibiraj <20282546+sibiraj-s@users.noreply.github.com> Date: Sun, 29 Oct 2023 11:04:24 +0530 Subject: [PATCH] feat: add Vela CI --- README.md | 1 + index.d.ts | 1 + test.js | 38 ++++++++++++++++++++++++++++++++++++++ vendors.json | 8 ++++++++ 4 files changed, 48 insertions(+) diff --git a/README.md b/README.md index ee532d2..2c4227c 100644 --- a/README.md +++ b/README.md @@ -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` | ✅ | diff --git a/index.d.ts b/index.d.ts index 1ef6f0b..626a356 100644 --- a/index.d.ts +++ b/index.d.ts @@ -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; diff --git a/test.js b/test.js index 6d74308..5434582 100644 --- a/test.js +++ b/test.js @@ -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 diff --git a/vendors.json b/vendors.json index 466d568..457c229 100644 --- a/vendors.json +++ b/vendors.json @@ -284,6 +284,14 @@ "ne": "false" } }, + { + "name": "Vela", + "constant": "VELA", + "env": "VELA", + "pr": { + "VELA_PULL_REQUEST": "1" + } + }, { "name": "Vercel", "constant": "VERCEL",