-
Notifications
You must be signed in to change notification settings - Fork 92
/
ci.rb
106 lines (106 loc) · 3.85 KB
/
ci.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
module CodeClimate
module TestReporter
class Ci
def self.service_data(env = ENV)
if env["TRAVIS"]
{
name: "travis-ci",
branch: env["TRAVIS_BRANCH"],
build_identifier: env["TRAVIS_JOB_ID"],
pull_request: env["TRAVIS_PULL_REQUEST"],
}
elsif env["CIRCLECI"]
{
name: "circleci",
build_identifier: env["CIRCLE_BUILD_NUM"],
branch: env["CIRCLE_BRANCH"],
commit_sha: env["CIRCLE_SHA1"],
}
elsif env["SEMAPHORE"]
{
name: "semaphore",
branch: env["BRANCH_NAME"],
build_identifier: env["SEMAPHORE_BUILD_NUMBER"],
}
elsif env["JENKINS_URL"]
{
name: "jenkins",
build_identifier: env["BUILD_NUMBER"],
build_url: env["BUILD_URL"],
branch: env["GIT_BRANCH"],
commit_sha: env["GIT_COMMIT"],
}
elsif env["TDDIUM"]
{
name: "tddium",
build_identifier: env["TDDIUM_SESSION_ID"],
worker_id: env["TDDIUM_TID"],
}
elsif env["WERCKER"]
{
name: "wercker",
build_identifier: env["WERCKER_BUILD_ID"],
build_url: env["WERCKER_BUILD_URL"],
branch: env["WERCKER_GIT_BRANCH"],
commit_sha: env["WERCKER_GIT_COMMIT"],
}
elsif env["APPVEYOR"]
{
name: "appveyor",
build_identifier: env["APPVEYOR_BUILD_ID"],
build_url: env["APPVEYOR_API_URL"],
branch: env["APPVEYOR_REPO_BRANCH"],
commit_sha: env["APPVEYOR_REPO_COMMIT"],
pull_request: env["APPVEYOR_PULL_REQUEST_NUMBER"],
}
elsif env["CI_NAME"] =~ /DRONE/i
{
name: "drone",
build_identifier: env["CI_BUILD_NUMBER"],
build_url: env["CI_BUILD_URL"],
branch: env["CI_BRANCH"],
commit_sha: env["CI_COMMIT"],
pull_request: env["CI_PULL_REQUEST"],
}
elsif env["CI_NAME"] =~ /codeship/i
{
name: "codeship",
build_identifier: env["CI_BUILD_ID"],
# build URL cannot be reconstructed for Codeship since env does not contain project ID
build_url: env["CI_BUILD_URL"],
branch: env["CI_BRANCH"],
commit_sha: env["CI_COMMIT_ID"],
# CI timestamp is not quite equivalent to commited at but there's no equivalent in Codeship
committed_at: env["CI_TIMESTAMP"],
}
elsif env["CI_NAME"] =~ /VEXOR/i
{
name: "vexor",
build_identifier: env["CI_BUILD_NUMBER"],
build_url: env["CI_BUILD_URL"],
branch: env["CI_BRANCH"],
commit_sha: env["CI_BUILD_SHA"],
pull_request: env["CI_PULL_REQUEST_ID"],
}
elsif env["BUILDKITE"]
{
name: "buildkite",
build_identifier: env["BUILDKITE_JOB_ID"],
build_url: env["BUILDKITE_BUILD_URL"],
branch: env["BUILDKITE_BRANCH"],
commit_sha: env["BUILDKITE_COMMIT"],
}
elsif env["GITLAB_CI"]
{
name: "gitlab-ci",
build_identifier: env["CI_BUILD_ID"],
branch: env["CI_BUILD_REF_NAME"],
commit_sha: env["CI_BUILD_REF"],
}
else
{}
end
end
end
end
end