Still sorting out test part
This commit is contained in:
parent
b771e9bd1a
commit
42595bfd10
3
setup.py
3
setup.py
@ -7,6 +7,9 @@ setup(
|
|||||||
setup_requires='setupmeta',
|
setup_requires='setupmeta',
|
||||||
install_requires=['cli2'],
|
install_requires=['cli2'],
|
||||||
extras_require=dict(
|
extras_require=dict(
|
||||||
|
full=[
|
||||||
|
'pyyaml',
|
||||||
|
],
|
||||||
test=[
|
test=[
|
||||||
'pytest',
|
'pytest',
|
||||||
'pytest-cov',
|
'pytest-cov',
|
||||||
|
|||||||
@ -29,15 +29,10 @@ class GitLabCI(Script):
|
|||||||
job = self.kwargs[arg]
|
job = self.kwargs[arg]
|
||||||
_args = []
|
_args = []
|
||||||
if not isinstance(job['image'], str):
|
if not isinstance(job['image'], str):
|
||||||
await job['image'](**kwargs)
|
|
||||||
image = str(job['image'].image)
|
image = str(job['image'].image)
|
||||||
_args.append('recreate')
|
|
||||||
else:
|
else:
|
||||||
image = job['image']
|
image = job['image']
|
||||||
await Docker(
|
await self.action('Docker', Run(job['script']), image=image)(*_args, **kwargs)
|
||||||
*cli.shlaxfile.actions[arg].actions,
|
|
||||||
image=image
|
|
||||||
)(*_args, **kwargs)
|
|
||||||
|
|
||||||
def colorized(self):
|
def colorized(self):
|
||||||
return type(self).__name__
|
return type(self).__name__
|
||||||
|
|||||||
@ -12,7 +12,7 @@ class Docker(Localhost):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.image = kwargs.get('image', 'alpine')
|
self.image = kwargs.get('image', 'alpine')
|
||||||
if not isinstance(self.image, Image):
|
if not isinstance(self.image, Image):
|
||||||
self.image = Image(image)
|
self.image = Image(self.image)
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.context['ctr'] = None
|
self.context['ctr'] = None
|
||||||
|
|
||||||
@ -54,10 +54,6 @@ class Docker(Localhost):
|
|||||||
|
|
||||||
if self.context['ctr']:
|
if self.context['ctr']:
|
||||||
self.context['ctr'] = (await self.exec('docker', 'start', name)).out
|
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)
|
return await super().call(*args, **kwargs)
|
||||||
|
|
||||||
async def copy(self, *args):
|
async def copy(self, *args):
|
||||||
|
|||||||
13
shlaxfile.py
13
shlaxfile.py
@ -24,34 +24,31 @@ build = Buildah(
|
|||||||
'''),
|
'''),
|
||||||
Copy('shlax/', 'setup.py', '/app'),
|
Copy('shlax/', 'setup.py', '/app'),
|
||||||
),
|
),
|
||||||
Pip('/app'),
|
Pip('/app[full]'),
|
||||||
commit='yourlabs/shlax',
|
commit='yourlabs/shlax',
|
||||||
workdir='/app',
|
workdir='/app',
|
||||||
)
|
)
|
||||||
|
|
||||||
shlax = Container(
|
shlax = Container(
|
||||||
build=build,
|
build=build,
|
||||||
test=test,
|
test=Script(Run('./shlaxfile.py -d test')),
|
||||||
)
|
|
||||||
|
|
||||||
pypi = Run(
|
|
||||||
'pypi-release',
|
|
||||||
stage='deploy',
|
|
||||||
image='yourlabs/python',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
gitlabci = GitLabCI(
|
gitlabci = GitLabCI(
|
||||||
build=dict(
|
build=dict(
|
||||||
stage='build',
|
stage='build',
|
||||||
image='yourlabs/shlax',
|
image='yourlabs/shlax',
|
||||||
|
script='./shlaxfile.py shlax build',
|
||||||
),
|
),
|
||||||
test=dict(
|
test=dict(
|
||||||
stage='test',
|
stage='test',
|
||||||
|
script='./shlaxfile.py -d test',
|
||||||
image=build,
|
image=build,
|
||||||
),
|
),
|
||||||
pypi=dict(
|
pypi=dict(
|
||||||
stage='deploy',
|
stage='deploy',
|
||||||
only=['tags'],
|
only=['tags'],
|
||||||
image='yourlabs/python',
|
image='yourlabs/python',
|
||||||
|
script='pypi-release',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user