| - 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 |
| get_url: |
| url: "{{ item.url }}" |
| dest: "{{ new_source_prefix }}/coverage.xml" |
| when: |
| - item.metadata is defined |
| - item.metadata.type is defined |
| - item.metadata.type == "cobertura_xml" |
| loop: "{{ zuul.artifacts }}" |
| |
| - 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" |