
This job that tests the zuul-jobs tox role runs various tox targets including the docs target. This means we need to install dependencies for doc building. On Ubuntu Noble this include libjpeg-dev for Pillow wheel building and we fail without this profile installed. We keep the default profiles of compile and test because we also run other targets that likely depend on these profiles. Change-Id: Ifa3495488f35b1fbe4fc665c4d0ac5ed8adb33aa
104 lines
3.4 KiB
YAML
104 lines
3.4 KiB
YAML
- hosts: all
|
|
roles:
|
|
- ensure-tox
|
|
tasks:
|
|
- name: Run bindep
|
|
include_role:
|
|
name: bindep
|
|
vars:
|
|
# We're building doc targets below so we need that bindep profile on
|
|
# top of the default compile and test profiles.
|
|
bindep_profile: 'compile test doc'
|
|
- name: Run tox with constraints
|
|
include_role:
|
|
name: tox
|
|
vars:
|
|
tox_envlist: docs
|
|
tox_constraints_file: '{{ zuul.project.src_dir }}/zuul-tests.d/test-constraints.txt'
|
|
# Make sure we test with verbose output even if the default changes
|
|
tox_extra_args: '-vv'
|
|
|
|
- name: Run tox with multiple testenvs
|
|
include_role:
|
|
name: tox
|
|
vars:
|
|
tox_envlist: docs,linters
|
|
tox_environment:
|
|
ANSIBLE_ROLES_PATH: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/roles"
|
|
# Make sure we test with verbose output even if the default changes
|
|
tox_extra_args: '-vv'
|
|
|
|
- name: Create tempfile to verify testenvs ran
|
|
tempfile:
|
|
register: default_tempfile
|
|
|
|
- name: Run tox
|
|
block:
|
|
- name: Run tox with empty envlist
|
|
include_role:
|
|
name: tox
|
|
vars:
|
|
zuul_work_dir: "{{ zuul.project.src_dir }}/test-playbooks/python/"
|
|
tox_extra_args: "-- {{ default_tempfile.path }}"
|
|
tox_install_siblings: false
|
|
tox_envlist: ''
|
|
|
|
- name: Make sure magic lines are present
|
|
lineinfile:
|
|
path: "{{ default_tempfile.path }}"
|
|
line: linters
|
|
check_mode: true
|
|
register: default_status
|
|
failed_when: default_status is changed
|
|
always:
|
|
- name: Remove tempfile
|
|
file:
|
|
state: absent
|
|
path: "{{ default_tempfile.path }}"
|
|
|
|
- name: Check testenvs output
|
|
block:
|
|
- name: Create tempfile to verify testenvs ran
|
|
tempfile:
|
|
register: ALL_tempfile
|
|
|
|
- name: Run tox with ALL
|
|
include_role:
|
|
name: tox
|
|
vars:
|
|
zuul_work_dir: "{{ zuul.project.src_dir }}/test-playbooks/python/"
|
|
tox_install_siblings: false
|
|
tox_extra_args: "-- {{ ALL_tempfile.path }}"
|
|
tox_envlist: 'ALL'
|
|
always:
|
|
- name: Make sure magic lines are present
|
|
loop:
|
|
- linters
|
|
- non-default
|
|
lineinfile:
|
|
path: "{{ ALL_tempfile.path }}"
|
|
line: "{{ item }}"
|
|
check_mode: true
|
|
register: ALL_status
|
|
failed_when: ALL_status is changed
|
|
|
|
- name: Move test-playbooks/python/tox.ini to test-playbooks/python/foo.ini
|
|
# Tox 4 appears to have trouble when there is a tox.ini in the current
|
|
# dir and you run it with -c pointing at another file. Work around this
|
|
# to test the use of -c by moving the tox.ini to another location
|
|
# and -c'ing against that in the next task.
|
|
command: mv tox.ini foo.ini
|
|
args:
|
|
chdir: "{{ zuul.project.src_dir }}/test-playbooks/python/"
|
|
|
|
- name: Run tox against a specific config file
|
|
include_role:
|
|
name: tox
|
|
vars:
|
|
zuul_work_dir: "{{ zuul.project.src_dir }}/test-playbooks/python/"
|
|
# Make sure the tox_config_file option works
|
|
tox_config_file: foo.ini
|
|
tox_envlist: 'foo'
|
|
# Make sure we test with verbose output even if the default changes
|
|
tox_extra_args: '-vv'
|