Skip to content

Instantly share code, notes, and snippets.

@dolang
Last active May 18, 2018 17:45
Show Gist options
  • Save dolang/f101548443f07c9bbfe13f4803972060 to your computer and use it in GitHub Desktop.
Save dolang/f101548443f07c9bbfe13f4803972060 to your computer and use it in GitHub Desktop.
Install Kivy from the daily PPA; download & run the tests. Ansible playbook.
---
# Ansible Playbook for Ubuntu which installs the Kivy daily PPA
# packages, then fetches and runs the tests.
#
# The PPA is: `ppa:kivy-team/kivy-daily`. The script creates a shallow
# Kivy clone into ~/kivy, so make sure that directory is either already
# a Kivy repository or nonexistant/empty.
#
# Test output is saved separately for py2/py3 as `~/py2-kivy-tests.log`
# and `~/py3-kivy-tests.log`. They contain raw characters, so open
# e.g. like this::
#
# less -R ~/py3-kivy-tests.log
#
# Some tests are excluded, for the reasons see comment at the bottom.
- hosts: localhost
vars:
kivy_local_repo: "{{ ansible_user_dir }}/kivy"
kivy_remote_repo: "https://github.com/kivy/kivy"
tasks:
- name: "Install git"
apt:
name: git
state: present
cache_valid_time: 1800 # only `apt update` if older than 30m
become: true
- name: "Add PPA on {{ inventory_hostname }}"
apt_repository:
repo: ppa:kivy-team/kivy-daily
state: present
become: true
- name: "Install Kivy from PPA (py2, py3, examples)"
apt:
name:
- python-kivy
- python3-kivy
- kivy-examples
state: present
cache_valid_time: 1800
become: true
- name: "Install SDL2 dependencies not included by default (image, ttf)"
apt:
name:
- libsdl2-image-2.0-0
- libsdl2-ttf-2.0-0
state: present
cache_valid_time: 1800
become: true
- name: "Shallow clone Kivy into {{ kivy_local_repo }}"
git:
repo: "{{ kivy_remote_repo }}"
dest: "{{ kivy_local_repo }}"
depth: 1
- name: "Symlink git repo tests into system's py2 Kivy package"
file:
src: "{{ kivy_local_repo }}/kivy/tests"
dest: "/usr/lib/python2.7/dist-packages/kivy/tests"
state: link
become: true
- name: "Symlink git repo tests into system's py3 Kivy package"
file:
src: "{{ kivy_local_repo }}/kivy/tests"
dest: "/usr/lib/python3/dist-packages/kivy/tests"
state: link
become: true
- name: "Install nosetests dependencies for py2 and py3"
apt:
name:
- python-nose
- python-mock
- python-coverage
- python3-nose
- python3-coverage
state: present
cache_valid_time: 1800
become: true
# some tests have to be excluded, here's why:
# test_doc_gallery: module `doc` not present in PPA package
# test_local_zipsequence: tries to open cube.zip, but examples are separated
# test_video_unload: tries to open cityCC0.mpg, but examples are separated
- name: "Run Kivy tests on py2"
shell: |
nosetests kivy.tests \
-c "{{ kivy_local_repo }}/setup.cfg" \
-e test_doc_gallery \
-e test_local_zipsequence \
-e test_video_unload \
2> "{{ ansible_user_dir }}/py2-kivy-tests.log"
ignore_errors: True
- name: "Run Kivy tests on py3"
shell: |
nosetests3 kivy.tests \
-c "{{ kivy_local_repo }}/setup.cfg" \
-e test_doc_gallery \
-e test_local_zipsequence \
-e test_video_unload \
2> "{{ ansible_user_dir }}/py3-kivy-tests.log"
ignore_errors: True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment