Skip to content

Commit

Permalink
Cirrus CI support
Browse files Browse the repository at this point in the history
  • Loading branch information
RDIL authored Nov 9, 2019
1 parent 2803ede commit cb7301a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions source/ci_source/providers/Cirrus.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Env, CISource } from "../ci_source"
import { ensureEnvKeysExist, ensureEnvKeysAreInt } from "../ci_source_helpers"

export class Travis implements CISource {
constructor(private readonly env: Env) {}

get name(): string {
return "Cirrus CI"
}

get isCI(): boolean {
return ensureEnvKeysExist(this.env, ["CIRRUS_CI"])
}

get isPR(): boolean {
const mustHave = ["CIRRUS_CI", "CIRRUS_PR", "CIRRUS_REPO_FULL_NAME"]
const mustBeInts = ["CIRRUS_PR"]
return ensureEnvKeysExist(this.env, mustHave) && ensureEnvKeysAreInt(this.env, mustBeInts)
}

get pullRequestID(): string {
return this.env.CIRRUS_PR
}

get repoSlug(): string {
return this.env.CIRRUS_REPO_FULL_NAME
}

get ciRunURL() {
return `https://cirrus-ci.com/task/${this.env.CIRRUS_TASK_ID}`
}
}

0 comments on commit cb7301a

Please sign in to comment.