forked from swagger-api/swagger-ui
-
Notifications
You must be signed in to change notification settings - Fork 3
/
decimate.cfg
67 lines (49 loc) · 3.05 KB
/
decimate.cfg
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
from cflshared.processutil import doExec, findExecutable
from decimate.exceptions import CantRunHereException
from decimate.projects import urlImport
from decimate.projects.otherbuilds import OtherBuildsTestConfiguration, TriggerHostingTestConfiguration
from decimate.projects.statuspublishing import StatusPublishingProject, StatusPublishingTestConfiguration, Status
from decimate.projects.git import GitTestConfiguration
import re
cflSvnRoot = "https://svn-dev.int.corefiling.com/svn/"
urlImport(cflSvnRoot + "devel/decimate/sharedConfigs/trunk/cfl.py", names=["ExpiringArchiveTestConfiguration", "PublishedReleasesTestConfiguration"])
class SwaggerProject(StatusPublishingProject):
name = "Swagger"
category = "PD/Libraries/Decimate"
def getTestConfigurations(self):
return [SwaggerJs("swagger.js"), SwaggerUi("swagger-ui"), PublishedReleases("Published Releases")]
class SwaggerJs(GitTestConfiguration, StatusPublishingTestConfiguration, ExpiringArchiveTestConfiguration):
gitUrls = [{"repos": "https://github.com/CoreFiling/swagger.js.git", "to": "swagger.js"}]
publishFilesBase = "swagger.js/lib"
publishFiles = ["*.js"]
def canRunHere(self, work):
if not findExecutable("npm"):
raise CantRunHereException("Need Node.js framework & npm to run (sudo yum install npm)")
if not findExecutable("coffee"):
raise CantRunHereException("Need CoffeeScript to run (sudo yum install coffee-script)")
return super(SwaggerJs, self).canRunHere(work)
def runTests(self):
doExec(["npm", "run-script", "build"], cwd="swagger.js", expectedReturnCode=0)
return Status.OK
class SwaggerUi(GitTestConfiguration, StatusPublishingTestConfiguration, OtherBuildsTestConfiguration, ExpiringArchiveTestConfiguration, TriggerHostingTestConfiguration):
gitUrls = [{"repos": "https://github.com/CoreFiling/swagger-ui.git", "to": "swagger-ui"}]
otherBuilds = [{"configName": "swagger.js", "copyFiles": [{"files": ["swagger.js"], "to": "swagger-ui/lib"}]}]
publishFilesBase = "swagger-ui/dist"
publishFiles = ["*"]
triggerableBuilds = [("Swagger", "Published Releases")]
def canRunHere(self, work):
if not findExecutable("npm"):
raise CantRunHereException("Need Node.js framework & npm to run (sudo yum install npm)")
if not findExecutable("coffee"):
raise CantRunHereException("Need CoffeeScript to run (sudo yum install coffee-script)")
return super(SwaggerUi, self).canRunHere(work)
def runTests(self):
doExec(["npm", "install", "handlebars"], cwd="swagger-ui", expectedReturnCode=0)
doExec(["npm", "install", "less"], cwd="swagger-ui", expectedReturnCode=0)
doExec(["npm", "run-script", "build"], cwd="swagger-ui", expectedReturnCode=0)
return Status.OK
class PublishedReleases(PublishedReleasesTestConfiguration):
buildNumberProvider = "otherBuildsVersion"
def runTests(self):
self.setVersionNumber(re.sub("-g[0-9a-f]+$", "", self.buildNumber))
return super(PublishedReleases, self).runTests()