blob: f86e739f6bce42902f3cc0f49af44927ae85981e [file] [log] [blame]
Jan Kundrát3a016432020-04-07 22:47:49 +02001- name: Ensure pycobertura is available
2 pip:
3 name: pycobertura
4 extra_args: --user
5
6- name: Prepare copy of the new version of sources
7 shell: |
8 set -ex
9 NEW_WORK={{ ansible_user_dir }}/new
10 mkdir "${NEW_WORK}"
11 NEW_SRCDIR=${NEW_WORK}/{{ zuul.project.short_name }}
12 pushd {{ zuul.project.src_dir }}
13 git worktree add "${NEW_SRCDIR}" {{ zuul.branch }}
14 popd
15
16- name: Retrieve coverage from parent jobs
17 get_url:
18 url: "{{ item.url }}"
19 dest: "{{ ansible_user_dir }}/new/coverage.xml"
20 when:
21 - item.metadata is defined
22 - item.metadata.type is defined
23 - item.metadata.type == "cobertura_xml"
24 loop: "{{ zuul.artifacts }}"
25
26- name: Generate pycobertura report
27 shell: |
28 set -ex
29 PATH=${PATH}:~/.local/bin
30 pycobertura show --format html --output "{{ ansible_user_dir }}/zuul-output/logs/coverage.html" \
31 --source "{{ ansible_user_dir }}/new/{{ zuul.project.short_name }}" "{{ ansible_user_dir }}/new/coverage.xml"
32 pycobertura diff --format html --output "{{ ansible_user_dir }}/zuul-output/logs/coverage-diff.html" \
33 --source1 "{{ zuul.project.src_dir }}" "{{ coverage_xml_dir }}/coverage.xml" \
34 --source2 "{{ ansible_user_dir }}/new/{{ zuul.project.short_name }}" "{{ ansible_user_dir }}/new/coverage.xml"
35 sed -e 's;^ </body>$; <p>Show <a href="coverage.html">final coverage</a> only</p>\n </body>;' \
36 -i "{{ ansible_user_dir }}/zuul-output/logs/coverage-diff.html"