blob: 444d5251fd0828a1e36916db8efc26664c4c7a3f [file] [log] [blame]
Jan Kundrát67008092020-04-08 19:06:12 +02001- name: Place for new version of sources
2 file:
3 path: "{{ new_source_prefix }}"
4 state: directory
5
Jan Kundrát3a016432020-04-07 22:47:49 +02006- name: Prepare copy of the new version of sources
Jan Kundrát67008092020-04-08 19:06:12 +02007 command: git worktree add {{ new_source_prefix }}/{{ zuul.project.short_name }} {{ zuul.branch }}
8 args:
9 chdir: "{{ zuul.project.src_dir }}"
Jan Kundrát3a016432020-04-07 22:47:49 +020010
11- name: Retrieve coverage from parent jobs
12 get_url:
13 url: "{{ item.url }}"
Jan Kundrát67008092020-04-08 19:06:12 +020014 dest: "{{ new_source_prefix }}/coverage.xml"
Jan Kundrát3a016432020-04-07 22:47:49 +020015 when:
16 - item.metadata is defined
17 - item.metadata.type is defined
18 - item.metadata.type == "cobertura_xml"
19 loop: "{{ zuul.artifacts }}"
20
21- name: Generate pycobertura report
22 shell: |
23 set -ex
24 PATH=${PATH}:~/.local/bin
25 pycobertura show --format html --output "{{ ansible_user_dir }}/zuul-output/logs/coverage.html" \
Jan Kundrát67008092020-04-08 19:06:12 +020026 --source "{{ new_source_prefix }}/{{ zuul.project.short_name }}" "{{ new_source_prefix }}/coverage.xml"
Jan Kundrát3a016432020-04-07 22:47:49 +020027 pycobertura diff --format html --output "{{ ansible_user_dir }}/zuul-output/logs/coverage-diff.html" \
28 --source1 "{{ zuul.project.src_dir }}" "{{ coverage_xml_dir }}/coverage.xml" \
Jan Kundrát67008092020-04-08 19:06:12 +020029 --source2 "{{ new_source_prefix }}/{{ zuul.project.short_name }}" "{{ new_source_prefix }}/coverage.xml"
Jan Kundrát3a016432020-04-07 22:47:49 +020030 sed -e 's;^ </body>$; <p>Show <a href="coverage.html">final coverage</a> only</p>\n </body>;' \
31 -i "{{ ansible_user_dir }}/zuul-output/logs/coverage-diff.html"