Still sorting out test part

This commit is contained in:
jpic 2020-02-16 18:12:18 +01:00
parent b771e9bd1a
commit 42595bfd10
4 changed files with 10 additions and 19 deletions

View File

@ -7,6 +7,9 @@ setup(
setup_requires='setupmeta',
install_requires=['cli2'],
extras_require=dict(
full=[
'pyyaml',
],
test=[
'pytest',
'pytest-cov',

View File

@ -29,15 +29,10 @@ class GitLabCI(Script):
job = self.kwargs[arg]
_args = []
if not isinstance(job['image'], str):
await job['image'](**kwargs)
image = str(job['image'].image)
_args.append('recreate')
else:
image = job['image']
await Docker(
*cli.shlaxfile.actions[arg].actions,
image=image
)(*_args, **kwargs)
await self.action('Docker', Run(job['script']), image=image)(*_args, **kwargs)
def colorized(self):
return type(self).__name__

View File

@ -12,7 +12,7 @@ class Docker(Localhost):
def __init__(self, *args, **kwargs):
self.image = kwargs.get('image', 'alpine')
if not isinstance(self.image, Image):
self.image = Image(image)
self.image = Image(self.image)
super().__init__(*args, **kwargs)
self.context['ctr'] = None
@ -54,10 +54,6 @@ class Docker(Localhost):
if self.context['ctr']:
self.context['ctr'] = (await self.exec('docker', 'start', name)).out
else:
self.context['ctr'] = (
await self.exec('sleep', '120', daemon=True)
).out
return await super().call(*args, **kwargs)
async def copy(self, *args):

View File

@ -24,34 +24,31 @@ build = Buildah(
'''),
Copy('shlax/', 'setup.py', '/app'),
),
Pip('/app'),
Pip('/app[full]'),
commit='yourlabs/shlax',
workdir='/app',
)
shlax = Container(
build=build,
test=test,
)
pypi = Run(
'pypi-release',
stage='deploy',
image='yourlabs/python',
test=Script(Run('./shlaxfile.py -d test')),
)
gitlabci = GitLabCI(
build=dict(
stage='build',
image='yourlabs/shlax',
script='./shlaxfile.py shlax build',
),
test=dict(
stage='test',
script='./shlaxfile.py -d test',
image=build,
),
pypi=dict(
stage='deploy',
only=['tags'],
image='yourlabs/python',
script='pypi-release',
),
)