This repository was archived by the owner on Nov 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathcs_api-tc-buildstep
More file actions
executable file
·72 lines (57 loc) · 2.51 KB
/
cs_api-tc-buildstep
File metadata and controls
executable file
·72 lines (57 loc) · 2.51 KB
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
#!/usr/bin/env python3
# desc# Standard interface to CodeStream's TeamCity build process for the VS Code Extension
# Relevant documentation
# https://github.com/TeamCodeStream/teamcity_tools/blob/master/README.md#Structured_Builds
import os
import sys
sys.path.append(os.environ['DT_TOP'] + "/lib")
import sysUtils as su
import buildUtils
# su.printErr("this script needs to be customized")
# exit(1)
# 1. add filename extensions for all assets created (tgz, vsix, zip, ...)
assetExtensionList = ['tgz']
# 2. add any additional repos to be included (do not include primary repo)
additionalRepos = []
# 3. choose the build type (npm, intellijPlugin, custom)
buildType = buildUtils.buildType.npm
args = buildUtils.parseStandardBuildArgs()
buildOptions = {
'verbose': args.verbose,
'assetExtensionList': assetExtensionList,
'additionalRepos': additionalRepos
}
# 4. Set this if you want your applied git tags to be something other than 'v' (v1.2.3)
shortName = os.environ['CS_API_SHORT_NAME'] if 'CS_API_SHORT_NAME' in os.environ else "api"
buildOptions['gitTagPrefix'] = f"{shortName}-"
if args.verbose:
print("buildstep running with", args.action)
build = buildUtils.build(buildType, **buildOptions)
if not build:
su.printErr("could not get a build object")
exit(1)
exitCode = 0
# 5. Make sure the default actions apply, if not make changes as necessary.
# Use 'build.execCmd("command string")' to execute custom actions.
# https://github.com/TeamCodeStream/teamcity_tools/blob/master/README.project-build-types.md
if args.action == 'prep':
build.prep() # set teamcity variables / parameters
elif args.action == 'build':
# build.build() # complete build so services can be started
print("there's nothing to build")
elif args.action == 'citest':
# build.citest() # run the continuous integration test suite
exitCode = build.execCmd("cs_api-service start && sleep 2 && npm run test:ci", returnOnError=True)
build.execCmd("cs_api-service stop")
elif args.action == 'pack':
build.pack(csServerMonoRepoDir='api_server') # create asset info file and package assets
elif args.action == 'publish':
build.publish() # publish assets for distribution
elif args.action == 'tag':
build.tag() # update version info and apply tags
elif args.action == 'release':
build.release() # release assets to the general public
else:
su.printErr("invalid build args")
exit(1)
exit(exitCode)