Commit d002e0ea authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

graph view, & use test make target instead of check

parent 9759f9d6
...@@ -10,6 +10,7 @@ ADD requirements.txt ./ ...@@ -10,6 +10,7 @@ ADD requirements.txt ./
RUN apt-get update -qq && apt-get install -qqy \ RUN apt-get update -qq && apt-get install -qqy \
apt-transport-https \ apt-transport-https \
git \ git \
graphviz \
libpq-dev \ libpq-dev \
netcat-openbsd \ netcat-openbsd \
ssmtp \ ssmtp \
......
...@@ -758,7 +758,7 @@ class Dependency(models.Model): ...@@ -758,7 +758,7 @@ class Dependency(models.Model):
unique_together = ('project', 'library') unique_together = ('project', 'library')
def __str__(self): def __str__(self):
return '{self.project} depends on {self.library}: {self.robotpkg:d} {self.cmake:d}' return f'{self.project} depends on {self.library}: {self.robotpkg:d} {self.cmake:d}'
def get_default_forge(project): def get_default_forge(project):
......
...@@ -18,7 +18,7 @@ cache: ...@@ -18,7 +18,7 @@ cache:
- make checkout MASTER_REPOSITORY="dir ${CI_PROJECT_DIR}" - make checkout MASTER_REPOSITORY="dir ${CI_PROJECT_DIR}"
- make install - make install
- cd work.$(hostname)/$(make show-var VARNAME=DISTNAME) - cd work.$(hostname)/$(make show-var VARNAME=DISTNAME)
{% if project.tests %} - make check {% if project.tests %} - make test
{% endif %} {% endif %}
{% for image in robotpkg.valid_images %}{{ image.get_job_name }}: {% for image in robotpkg.valid_images %}{{ image.get_job_name }}:
<<: *robotpkg-{{ robotpkg }} <<: *robotpkg-{{ robotpkg }}
......
...@@ -105,3 +105,16 @@ def docker(request): ...@@ -105,3 +105,16 @@ def docker(request):
cmd = filters.pop('cmd') cmd = filters.pop('cmd')
images = models.Image.objects.filter(**filters) images = models.Image.objects.filter(**filters)
return HttpResponse('\n'.join([' '.join(getattr(image, cmd)()) for image in images]), content_type="text/plain") return HttpResponse('\n'.join([' '.join(getattr(image, cmd)()) for image in images]), content_type="text/plain")
def graph(request):
with open('/tmp/graph', 'w') as f:
print('digraph {', file=f)
for project in Project.objects.all():
print(f'{{I{project.pk} [label="{project}"];}}', file=f)
for dep in Dependency.objects.all():
print(f'I{dep.project.pk} -> I{dep.library.pk};', file=f)
print('}', file=f)
svg = run(['dot', '/tmp/graph', '-Tsvg'], capture_output=True).stdout.decode()
return HttpResponse(svg, content_type='image/svg+xml')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment