Skip to content

Commit

Permalink
feat: add agola CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Oct 29, 2023
1 parent f6f173f commit ec4e149
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Officially supported CI servers:

| Name | Constant | isPR |
| ------------------------------------------------------------------------------- | ----------------------- | ---- |
| [Agola CI](https://agola.io/) | `ci.AGOLA` ||
| [AWS CodeBuild](https://aws.amazon.com/codebuild/) | `ci.CODEBUILD` | 🚫 |
| [AppVeyor](http://www.appveyor.com) | `ci.APPVEYOR` ||
| [Azure Pipelines](https://azure.microsoft.com/en-us/services/devops/pipelines/) | `ci.AZURE_PIPELINES` ||
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const isPR: boolean | null;
*/
export const name: string | null;

export const AGOLA: boolean;
export const APPCIRCLE: boolean;
export const APPVEYOR: boolean;
export const CODEBUILD: boolean;
Expand Down
38 changes: 38 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,44 @@ test('Gitea Actions', function (t) {
t.end()
})

test('Agola CI', function (t) {
process.env.AGOLA_GIT_REF = 'true'
process.env.AGOLA_PULL_REQUEST_ID = ''

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

t.equal(ci.isCI, true)
t.equal(ci.isPR, false)
t.equal(ci.name, 'Agola CI')
t.equal(ci.AGOLA, true)
assertVendorConstants('AGOLA', ci, t)

delete process.env.AGOLA_GIT_REF
delete process.env.AGOLA_PULL_REQUEST_ID

t.end()
})

test('Agola CI - PR', function (t) {
process.env.AGOLA_GIT_REF = 'true'
process.env.AGOLA_PULL_REQUEST_ID = '12'

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

t.equal(ci.isCI, true)
t.equal(ci.isPR, true)
t.equal(ci.name, 'Agola CI')
t.equal(ci.AGOLA, true)
assertVendorConstants('AGOLA', ci, t)

delete process.env.AGOLA_GIT_REF
delete process.env.AGOLA_PULL_REQUEST_ID

t.end()
})

function assertVendorConstants (expect, ci, t) {
ci._vendors.forEach(function (constant) {
let bool = constant === expect
Expand Down
6 changes: 6 additions & 0 deletions vendors.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
[
{
"name": "Agola CI",
"constant": "AGOLA",
"env": "AGOLA_GIT_REF",
"pr": "AGOLA_PULL_REQUEST_ID"
},
{
"name": "Appcircle",
"constant": "APPCIRCLE",
Expand Down

0 comments on commit ec4e149

Please sign in to comment.