Break runtests back into steps for more granular CI feedback
This commit is contained in:
parent
2df2fa514d
commit
d94fdb3e84
@ -19,4 +19,6 @@ before_script:
|
|||||||
- go get github.com/meatballhat/gfmxr/...
|
- go get github.com/meatballhat/gfmxr/...
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- ./runtests
|
- ./runtests vet
|
||||||
|
- ./runtests test
|
||||||
|
- ./runtests gfmxr
|
||||||
|
62
runtests
62
runtests
@ -13,33 +13,51 @@ PACKAGE_NAME = os.environ.get(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main(sysargs=sys.argv[:]):
|
||||||
_run('go vet ./...'.split())
|
target = 'test'
|
||||||
|
if len(sysargs) > 1:
|
||||||
|
target = sysargs[1]
|
||||||
|
|
||||||
if check_output('go version'.split()).split()[2] >= 'go1.2':
|
{
|
||||||
coverprofiles = []
|
'vet': _vet,
|
||||||
for subpackage in ['', 'altsrc']:
|
'test': _test,
|
||||||
coverprofile = 'cli.coverprofile'
|
'gfmxr': _gfmxr
|
||||||
if subpackage != '':
|
}[target]()
|
||||||
coverprofile = '{}.coverprofile'.format(subpackage)
|
|
||||||
|
|
||||||
coverprofiles.append(coverprofile)
|
|
||||||
|
|
||||||
_run('go test -v'.split() + [
|
|
||||||
'-coverprofile={}'.format(coverprofile),
|
|
||||||
'{}/{}'.format(PACKAGE_NAME, subpackage)
|
|
||||||
])
|
|
||||||
|
|
||||||
combined = _combine_coverprofiles(coverprofiles)
|
|
||||||
_run('go tool cover -func={}'.format(combined.name).split())
|
|
||||||
combined.close()
|
|
||||||
else:
|
|
||||||
_run('go test -v ./...'.split())
|
|
||||||
|
|
||||||
_run(['gfmxr', '-c', str(_gfmxr_count()), '-s', 'README.md'])
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
def _test():
|
||||||
|
if check_output('go version'.split()).split()[2] < 'go1.2':
|
||||||
|
_run('go test -v ./...'.split())
|
||||||
|
return
|
||||||
|
|
||||||
|
coverprofiles = []
|
||||||
|
for subpackage in ['', 'altsrc']:
|
||||||
|
coverprofile = 'cli.coverprofile'
|
||||||
|
if subpackage != '':
|
||||||
|
coverprofile = '{}.coverprofile'.format(subpackage)
|
||||||
|
|
||||||
|
coverprofiles.append(coverprofile)
|
||||||
|
|
||||||
|
_run('go test -v'.split() + [
|
||||||
|
'-coverprofile={}'.format(coverprofile),
|
||||||
|
'{}/{}'.format(PACKAGE_NAME, subpackage)
|
||||||
|
])
|
||||||
|
|
||||||
|
combined = _combine_coverprofiles(coverprofiles)
|
||||||
|
_run('go tool cover -func={}'.format(combined.name).split())
|
||||||
|
combined.close()
|
||||||
|
|
||||||
|
|
||||||
|
def _gfmxr():
|
||||||
|
_run(['gfmxr', '-c', str(_gfmxr_count()), '-s', 'README.md'])
|
||||||
|
|
||||||
|
|
||||||
|
def _vet():
|
||||||
|
_run('go vet ./...'.split())
|
||||||
|
|
||||||
|
|
||||||
def _run(command):
|
def _run(command):
|
||||||
print('runtests: {}'.format(' '.join(command)), file=sys.stderr)
|
print('runtests: {}'.format(' '.join(command)), file=sys.stderr)
|
||||||
check_call(command)
|
check_call(command)
|
||||||
|
Loading…
Reference in New Issue
Block a user