summaryrefslogtreecommitdiffstats
path: root/.travis.yml
blob: b10ec78a94c1620b567c02083d8279dc6784fed5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
os: linux
dist: xenial

language: python
python:
  # Travis Xenial Python to support system_site_packages
  - 3.5
cache: pip
virtualenv:
  system_site_packages: true

env:
  global:
    - DISPLAY=:99.0

git:
  # Set greater depth to get version from tags.
  depth: 1000

jobs:
  include:
    - name: Unit tests
      env: TOX_ENV=py3
    - name: Unit tests - libtorrent 1.2
      env: TOX_ENV=py3
      addons:
        apt:
          sources: [sourceline: "ppa:libtorrent.org/1.2-daily"]
          packages: [python3-libtorrent, python3-venv]
    - name: Unit tests - Python 2
      env: TOX_ENV=py27
      python: 2.7
    - if: commit_message =~ SECURITY_TEST
      env: TOX_ENV=security
    - name: Code linting
      env: TOX_ENV=lint
    - name: Docs build
      env: TOX_ENV=docs
    - name: GTK unit tests
      env: TOX_ENV=gtkui
    - name: Plugins unit tests
      env: TOX_ENV=plugins

addons:
  apt:
    sources:
      - sourceline: "ppa:libtorrent.org/rc-1.1-daily"
      - deadsnakes
    packages:
      - python-libtorrent
      - python3-libtorrent
      # Install py36 specifically for pre-commit to run black formatter.
      - python3.6
      # Intall python3-venv to provide ensurepip module for tox.
      - python3-venv
      # Spellchecking
      - enchant

# Install dependencies
install:
  - pip install tox
  # GTKUI tests
  - "if [ $TOX_ENV == 'gtkui' ]; then
    sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0;
    fi"
  # Security tests
  - "if [ $TOX_ENV == 'security' ]; then
    testssl_url=https://github.com/drwetter/testssl.sh/archive/v2.9.5-5.tar.gz;
    wget -O- $testssl_url | tar xz
    && mv -t deluge/tests/data testssl.sh-2.9.5-5/testssl.sh testssl.sh-2.9.5-5/etc/;
    fi"

before_script:
  - export PYTHONPATH=$PYTHONPATH:$PWD
  # Verify libtorrent installed and version
  - python -c "import libtorrent as lt; print(lt.__version__)"
  # Start xvfb for the GTKUI tests
  - "if [ $TOX_ENV == 'gtkui' ]; then
    /sbin/start-stop-daemon --start --quiet --background \
    --make-pidfile --pidfile /tmp/custom_xvfb_99.pid \
    --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16;
    fi"

script:
  - tox -e $TOX_ENV