|
| 1 | +#!/usr/bin/env python3 |
| 2 | + |
| 3 | +# desc# Standard interface to CodeStream's build process |
| 4 | + |
| 5 | +# https://github.com/TeamCodeStream/teamcity_tools/blob/master/README.md#Structured_Builds |
| 6 | + |
| 7 | +import os |
| 8 | +import sys |
| 9 | + |
| 10 | +sys.path.append(os.environ['DT_TOP'] + "/lib") |
| 11 | +import sysUtils as su |
| 12 | +import buildUtils |
| 13 | + |
| 14 | +su.printErr("this script needs to be customized") |
| 15 | +exit(1) |
| 16 | + |
| 17 | +# 1. add filename extensions for all assets created (tgz, vsix, zip, ...) |
| 18 | +assetExtensionList = ['tgz'] |
| 19 | + |
| 20 | +# 2. add any additional repos to be included (do not include primary repo) |
| 21 | +additionalRepos = [] |
| 22 | + |
| 23 | +# 3. choose the build type (npm, intellijPlugin, custom) |
| 24 | +# https://github.com/TeamCodeStream/teamcity_tools/blob/master/README.project-build-types.md |
| 25 | +buildType = buildUtils.buildType.npm |
| 26 | + |
| 27 | +args = buildUtils.parseStandardBuildArgs() |
| 28 | +buildOptions = { |
| 29 | + 'verbose': args.verbose, |
| 30 | + 'assetExtensionList': assetExtensionList, |
| 31 | + # 'buildDirectory': '...', # execute build in this subdirectory relative to repo root |
| 32 | + # 'useDistDir': True, # assets are created/managed in 'dist/' directory |
| 33 | + 'additionalRepos': additionalRepos |
| 34 | +} |
| 35 | + |
| 36 | +# 4. Set this if you want your applied git tags to be something other than 'v' (v1.2.3) |
| 37 | +# buildOptions['gitTagPrefix'] = "mytag-" |
| 38 | + |
| 39 | +if args.verbose: |
| 40 | + print("buildstep running with", args.action) |
| 41 | + |
| 42 | +build = buildUtils.build(buildType, **buildOptions) |
| 43 | +if not build: |
| 44 | + su.printErr("could not get a build object") |
| 45 | + exit(1) |
| 46 | + |
| 47 | +# 5. Make sure the default actions apply, if not make changes as necessary. |
| 48 | +# Use 'build.execCmd("command string")' to execute custom actions. |
| 49 | +# https://github.com/TeamCodeStream/teamcity_tools/blob/master/README.build-configurations.md |
| 50 | +if args.action == 'prep': |
| 51 | + build.prep() # set teamcity variables / parameters |
| 52 | +elif args.action == 'build': |
| 53 | + build.build() # complete build so services can be started |
| 54 | +elif args.action == 'citest': |
| 55 | + build.citest() # run the continuous integration test suite |
| 56 | +elif args.action == 'pack': |
| 57 | + build.pack() # create asset info file and package assets |
| 58 | +elif args.action == 'publish': |
| 59 | + build.publish() # publish assets for distribution |
| 60 | +elif args.action == 'tag': |
| 61 | + build.tag() # update version info and apply tags |
| 62 | +elif args.action == 'release': |
| 63 | + build.release() # release assets to the general public |
| 64 | +else: |
| 65 | + su.printErr("invalid build args") |
| 66 | + exit(1) |
| 67 | + |
| 68 | +exit(0) |
0 commit comments