blob: 5c80870797b145c39f6d8addca6aea2f258d739e [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
Jan Kundrát6e2570d2020-04-08 18:52:51 +020012 include_task: download.yaml
13 loop: "{{ zuul.artifacts | json_query(artifact_seletctor) }}"
14 vars:
15 artifact_seletctor: "[([?metadata.type == 'cobertura_xml' && project == '{{ zuul.project.name }}'])[-1]]"
16 loop_control:
17 loop_var: artifact
Jan Kundrát3a016432020-04-07 22:47:49 +020018
19- name: Generate pycobertura report
20 shell: |
21 set -ex
22 PATH=${PATH}:~/.local/bin
23 pycobertura show --format html --output "{{ ansible_user_dir }}/zuul-output/logs/coverage.html" \
Jan Kundrát67008092020-04-08 19:06:12 +020024 --source "{{ new_source_prefix }}/{{ zuul.project.short_name }}" "{{ new_source_prefix }}/coverage.xml"
Jan Kundrát3a016432020-04-07 22:47:49 +020025 pycobertura diff --format html --output "{{ ansible_user_dir }}/zuul-output/logs/coverage-diff.html" \
26 --source1 "{{ zuul.project.src_dir }}" "{{ coverage_xml_dir }}/coverage.xml" \
Jan Kundrát67008092020-04-08 19:06:12 +020027 --source2 "{{ new_source_prefix }}/{{ zuul.project.short_name }}" "{{ new_source_prefix }}/coverage.xml"
Jan Kundrát3a016432020-04-07 22:47:49 +020028 sed -e 's;^ </body>$; <p>Show <a href="coverage.html">final coverage</a> only</p>\n </body>;' \
29 -i "{{ ansible_user_dir }}/zuul-output/logs/coverage-diff.html"