blob: 5c80870797b145c39f6d8addca6aea2f258d739e [file] [log] [blame]
- name: Place for new version of sources
file:
path: "{{ new_source_prefix }}"
state: directory
- name: Prepare copy of the new version of sources
command: git worktree add {{ new_source_prefix }}/{{ zuul.project.short_name }} {{ zuul.branch }}
args:
chdir: "{{ zuul.project.src_dir }}"
- name: Retrieve coverage from parent jobs
include_task: download.yaml
loop: "{{ zuul.artifacts | json_query(artifact_seletctor) }}"
vars:
artifact_seletctor: "[([?metadata.type == 'cobertura_xml' && project == '{{ zuul.project.name }}'])[-1]]"
loop_control:
loop_var: artifact
- name: Generate pycobertura report
shell: |
set -ex
PATH=${PATH}:~/.local/bin
pycobertura show --format html --output "{{ ansible_user_dir }}/zuul-output/logs/coverage.html" \
--source "{{ new_source_prefix }}/{{ zuul.project.short_name }}" "{{ new_source_prefix }}/coverage.xml"
pycobertura diff --format html --output "{{ ansible_user_dir }}/zuul-output/logs/coverage-diff.html" \
--source1 "{{ zuul.project.src_dir }}" "{{ coverage_xml_dir }}/coverage.xml" \
--source2 "{{ new_source_prefix }}/{{ zuul.project.short_name }}" "{{ new_source_prefix }}/coverage.xml"
sed -e 's;^ </body>$; <p>Show <a href="coverage.html">final coverage</a> only</p>\n </body>;' \
-i "{{ ansible_user_dir }}/zuul-output/logs/coverage-diff.html"