summaryrefslogtreecommitdiff
path: root/.travis.yml
blob: 20e92f181b138230ecb37d248f66a85bd8645262 (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
language: python
sudo: True
dist: xenial

python:
  - "3.6"
  - "3.7"
  - "3.8"

# We start two containers in parallel, one to check and build the docs and the
# other to run the test suite.
env:
  - JOB=docs
  - JOB=tests

# Cache pip objects to speed up next build
cache:
  pip: True
  ccache: True

addons:
  apt:
    sources:
      - sourceline: 'ppa:xapian-backports/ppa'
      - sourceline: 'ppa:notmuch/notmuch'
    packages:
      - dtach
      - libxapian-dev
      - libgmime-3.0-dev
      - libtalloc-dev
      - libgpgme-dev
      - gpgsm
      - swig


install:
  #################################################
  ###                   NOTMUCH                 ###
  #################################################
  - |
    set -e
    # Build with ccache to speed up rebuilds.
    #export PATH=/usr/lib/ccache:$PATH

    # Set paths
    export LD_LIBRARY_PATH=$HOME/.local/lib
    export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig

    # Clone the notmuch repository and move into it.
    git clone git://notmuchmail.org/git/notmuch --depth 1
    cd notmuch
    # Make and install the library.  We install the library without sudo as we
    # might want to switch to the travis container later.
    ./configure --prefix=$HOME/.local \
                --without-bash-completion \
                --without-api-docs \
                --without-emacs \
                --without-desktop \
                --without-ruby \
                --without-zsh-completion
    make -j3 -l2
    make install
    # Export the library search path.
    # Install the python bindings.
    cd bindings/python
    #python setup.py install --user
    pip install .
    # Move out of the notmuch dir again.
    cd ../../..


  #################################################
  ###                 PYHON DEPS                ###
  #################################################
  - pip install urwid
  - pip install configobj
  - pip install gpg
  - pip install twisted
  - pip install python-magic

  - |
    set -e
    if [[ $JOB = docs ]]; then
      # install sphinx (only used to build docs)
      pip install sphinx
      # Mock all "difficult" dependencies of alot in order to be able to import
      # alot when rebuilding the documentation.  Notmuch would have to be
      # installed by hand in order to get a recent enough version on travis.
      printf '%s = None\n' NotmuchError NullPointerError > notmuch.py
      touch gpg.py
    else
      # install alot
      pip install .
      # programs to generate a coverage report and upload it to codacy.com
      pip install coverage codacy-coverage
    fi


before_script: |
  # Prepare a minimal config file for the test.
  set -e
  if [[ $JOB = tests ]]; then
    touch ~/.notmuch-config
    echo 'initial_command=call os._exit(0)' > conf
  fi


script: |
  set -e
  if [[ $JOB = docs ]]; then
    # First remove the auto generated documentation source files.
    make -C docs cleanall
    # Regenerate them (run "true" instead of sphinx-build to speed things up).
    make -C docs html SPHINXBUILD=true
    # Check that the generated docs where already commited.
    git diff --exit-code
    # Generate the html docs and turn all warnings into errors.
    make -C docs html SPHINXBUILD='sphinx-build -W'
  else
    alot --config conf
    coverage run setup.py test
  fi

after_success: |
  set -e
  if [[ $JOB = tests ]]; then
    coverage xml
    python-codacy-coverage -r coverage.xml
  fi

notifications:
  irc:
    channels:
      - "chat.freenode.net#alot"
    on_success: change
    use_notice: true