about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWilliam Wennerström <william@optmzr.se>2019-06-04 13:45:17 +0200
committerWilliam Wennerström <william@optmzr.se>2019-06-06 13:58:26 +0200
commit3700c80ad1258885256fa963dd8a13ab84853170 (patch)
tree2843a656e97f63757ac5e5a4afc2b8fa40d32a8a
parent48013f8d4368a81596cff42b5697a6f49a29865e (diff)
downloadprofani-tty-3700c80ad1258885256fa963dd8a13ab84853170.tar.gz
Add Travis CI tests for Arch, Debian and OSX/macOS
+ Arch and Debian are run in Docker containers, as openSUSE Tumbleweed.

+ OSX/macOS doesn't use any containers.
   * Homebrew is used to fetch all the dependencies.
   * The dependencies are declared in the Brewfile.travis file.

+ The travis-build.sh script has been modified to check for the current
  OS and the different configure flags has been moved into an array
  that'll be looped through instead.
  The xscreensaver (for libXScrnSaver) flags has been removed for macOS
  as it only makes sense for systems running X11, which macOS doesn't
  (usually) do.

+ Some minor shellcheck fixes, too.

Fixes: #1100
-rw-r--r--.travis.yml45
-rw-r--r--Brewfile.travis20
-rw-r--r--Dockerfile.arch58
-rw-r--r--Dockerfile.debian49
-rw-r--r--Dockerfile.tumbleweed (renamed from Dockerfile)28
-rwxr-xr-xbootstrap.sh2
-rwxr-xr-xtravis-build.sh180
7 files changed, 243 insertions, 139 deletions
diff --git a/.travis.yml b/.travis.yml
index abdeaa98..ed87ab56 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,10 +1,47 @@
 sudo: required
-language: c
+language: bash
+
 services:
-  - docker
+  - docker # Linux tests are run in Docker containers.
+
+addons:
+  homebrew:
+    brewfile: Brewfile.travis # mac OS dependencies.
+    # libsignal-protocol-c is still not in the Travis CI Homebrew snapshot, the
+    # line below could be removed when the snapshot has been updated to speed up
+    # the OSX job.
+    update: true
+
+matrix:
+  include:
+    - os: linux
+      env: BUILD_FLAVOR=tumbleweed
+    - os: linux
+      env: BUILD_FLAVOR=debian
+    - os: linux
+      env: BUILD_FLAVOR=arch
+    - os: osx
+      env:
+        # Ensure that "keg-only" Homebrew versions are used.
+        - PKG_CONFIG_PATH="/usr/local/opt/ncurses/lib/pkgconfig:$PKG_CONFIG_PATH"
+        - PKG_CONFIG_PATH="/usr/local/opt/expat/lib/pkgconfig:$PKG_CONFIG_PATH"
+        - PKG_CONFIG_PATH="/usr/local/opt/curl/lib/pkgconfig:$PKG_CONFIG_PATH"
+        - PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:$PKG_CONFIG_PATH"
+        - PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH"
 
 before_install:
-  - docker build -f Dockerfile -t profanity .
+  - if [ "$TRAVIS_OS_NAME" = "linux" ]; then
+      docker build -f Dockerfile."$BUILD_FLAVOR" -t profanity .;
+    fi
 
 script:
-- docker run -it profanity ./travis-build.sh
+  - if [ "$TRAVIS_OS_NAME" = "linux" ]; then
+      docker run -it profanity ./travis-build.sh;
+    fi
+  - if [ "$TRAVIS_OS_NAME" = "osx" ]; then
+      ./travis-build.sh;
+    fi
+
+after_failure:
+  - cat ./config.log
+  - env
diff --git a/Brewfile.travis b/Brewfile.travis
new file mode 100644
index 00000000..e6743e03
--- /dev/null
+++ b/Brewfile.travis
@@ -0,0 +1,20 @@
+brew 'autoconf'
+brew 'autoconf-archive'
+brew 'automake'
+brew 'check'
+brew 'curl'
+brew 'expat'
+brew 'glib'
+brew 'gnutls'
+brew 'gpgme'
+brew 'gtk+'
+brew 'libffi'
+brew 'libotr'
+brew 'libsignal-protocol-c'
+brew 'libstrophe'
+brew 'libtool'
+brew 'ncurses'
+brew 'openssl'
+brew 'ossp-uuid'
+brew 'pkg-config'
+brew 'readline'
diff --git a/Dockerfile.arch b/Dockerfile.arch
new file mode 100644
index 00000000..4e0eee6d
--- /dev/null
+++ b/Dockerfile.arch
@@ -0,0 +1,58 @@
+FROM archlinux/base
+
+RUN pacman -Syu --noconfirm && pacman -S --needed --noconfirm \
+  autoconf \
+  autoconf-archive \
+  automake \
+  base-devel \
+  check \
+  cmake \
+  cmocka \
+  curl \
+  doxygen \
+  expat \
+  gcc \
+  git \
+  gpgme \
+  gtk2 \
+  libgcrypt \
+  libmicrohttpd \
+  libnotify \
+  libotr \
+  libtool \
+  libxss \
+  make \
+  openssl \
+  pkg-config \
+  python \
+  wget
+
+RUN mkdir -p /usr/src/{stabber,profanity}
+
+RUN useradd -mb /usr/src --shell=/bin/false aur && usermod -L aur
+USER aur
+
+WORKDIR /usr/src/aur
+RUN wget https://aur.archlinux.org/cgit/aur.git/snapshot/libstrophe-git.tar.gz
+RUN wget https://aur.archlinux.org/cgit/aur.git/snapshot/libsignal-protocol-c.tar.gz
+RUN tar -zxvf libstrophe-git.tar.gz
+RUN tar -zxvf libsignal-protocol-c.tar.gz
+RUN pushd libstrophe-git && makepkg && popd
+RUN pushd libsignal-protocol-c && makepkg && popd
+
+USER root
+
+RUN pacman -U --noconfirm libstrophe-git/libstrophe-git-*.pkg.tar.xz
+RUN pacman -U --noconfirm libsignal-protocol-c/libsignal-protocol-c-*.pkg.tar.xz
+
+WORKDIR /usr/src
+RUN git clone git://github.com/boothj5/stabber.git
+
+WORKDIR /usr/src/stabber
+RUN ./bootstrap.sh
+RUN ./configure --prefix=/usr --disable-dependency-tracking
+RUN make
+RUN make install
+
+WORKDIR /usr/src/profanity
+COPY . /usr/src/profanity
diff --git a/Dockerfile.debian b/Dockerfile.debian
new file mode 100644
index 00000000..29ceae80
--- /dev/null
+++ b/Dockerfile.debian
@@ -0,0 +1,49 @@
+# Build the latest Debian testing image
+FROM debian:testing
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+  autoconf \
+  autoconf-archive \
+  automake \
+  expect \
+  gcc \
+  git \
+  libcmocka-dev \
+  libcurl3-dev \
+  libgcrypt-dev \
+  libglib2.0-dev \
+  libgpgme11-dev \
+  libgtk2.0-dev \
+  libmicrohttpd-dev \
+  libncursesw5-dev \
+  libnotify-dev \
+  libotr5-dev \
+  libreadline-dev \
+  libsignal-protocol-c-dev \
+  libssl-dev \
+  libtool \
+  libxss-dev \
+  make \
+  pkg-config \
+  python-dev
+
+RUN mkdir -p /usr/src/{stabber,libmesode,profanity}
+WORKDIR /usr/src
+
+RUN git clone git://github.com/boothj5/stabber.git
+RUN git clone git://github.com/profanity-im/libmesode.git
+
+WORKDIR /usr/src/stabber
+RUN ./bootstrap.sh
+RUN ./configure --prefix=/usr --disable-dependency-tracking
+RUN make
+RUN make install
+
+WORKDIR /usr/src/libmesode
+RUN ./bootstrap.sh
+RUN ./configure --prefix=/usr
+RUN make
+RUN make install
+
+WORKDIR /usr/src/profanity
+COPY . /usr/src/profanity
diff --git a/Dockerfile b/Dockerfile.tumbleweed
index f0106b7f..9acf4cce 100644
--- a/Dockerfile
+++ b/Dockerfile.tumbleweed
@@ -5,35 +5,35 @@ FROM opensuse/tumbleweed
 # libmicrohttpd - for stabber
 # glibc-locale - to have en_US locale
 RUN zypper --non-interactive in --no-recommends \
-  git \
-  gcc \
   autoconf \
   autoconf-archive \
-  make \
   automake \
-  libtool \
+  expect-devel \
+  gcc \
+  git \
   glib2-devel \
+  glibc-locale \
   gtk2-devel \
-  expect-devel \
   libXss-devel \
+  libcmocka-devel \
   libcurl-devel \
   libexpat-devel \
+  libgcrypt-devel \
   libgpgme-devel \
   libmesode-devel \
+  libmicrohttpd-devel \
   libnotify-devel \
   libotr-devel \
+  libsignal-protocol-c-devel \
+  libtool \
   libuuid-devel \
-  libcmocka-devel \
+  make \
   ncurses-devel \
-  python3-devel \
-  python3 \
-  python-devel \
   python \
-  readline-devel \
-  libsignal-protocol-c-devel \
-  libgcrypt-devel \
-  libmicrohttpd-devel \
-  glibc-locale
+  python-devel \
+  python3 \
+  python3-devel \
+  readline-devel
 
 # https://github.com/openSUSE/docker-containers-build/issues/26
 ENV LANG en_US.UTF-8
diff --git a/bootstrap.sh b/bootstrap.sh
index abae7294..80624f20 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -1,4 +1,4 @@
 #!/bin/sh
 
 mkdir -p m4
-autoreconf -i $@
+autoreconf -i "$@"
diff --git a/travis-build.sh b/travis-build.sh
index aa88105a..10ba684f 100755
--- a/travis-build.sh
+++ b/travis-build.sh
@@ -13,123 +13,63 @@ trap error_handler ERR
 
 ./bootstrap.sh
 
-echo
-echo "--> Building with ./configure --enable-notifications --enable-icons --enable-otr --enable-pgp --enable-omemo --enable-plugins --enable-c-plugins --enable-python-plugins --with-xscreensaver"
-echo
-./configure --enable-notifications --enable-icons --enable-otr --enable-pgp --enable-omemo --enable-plugins --enable-c-plugins --enable-python-plugins --with-xscreensaver
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-notifications --disable-icons --disable-otr --disable-pgp --disable-omemo --disable-plugins --disable-c-plugins --disable-python-plugins --without-xscreensaver"
-echo
-./configure --disable-notifications --disable-icons --disable-otr --disable-pgp --disable-omemo --disable-plugins --disable-c-plugins --disable-python-plugins --without-xscreensaver
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-notifications"
-echo
-./configure --disable-notifications
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-icons"
-echo
-./configure --disable-icons
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-otr"
-echo
-./configure --disable-otr
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-pgp"
-echo
-./configure --disable-pgp
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-omemo"
-echo
-./configure --disable-omemo
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-pgp --disable-otr"
-echo
-./configure --disable-pgp --disable-otr
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-pgp --disable-otr --disable-omemo"
-echo
-./configure --disable-pgp --disable-otr --disable-omemo
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-plugins"
-echo
-./configure --disable-plugins
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-python-plugins"
-echo
-./configure --disable-python-plugins
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-c-plugins"
-echo
-./configure --disable-c-plugins
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --disable-c-plugins --disable-python-plugins"
-echo
-./configure --disable-c-plugins --disable-python-plugins
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure --without-xscreensaver"
-echo
-./configure --without-xscreensaver
-make
-./profanity -v
-make clean
-
-echo
-echo "--> Building with ./configure"
-echo
-./configure
-make
-make check
-./profanity -v
-make clean
+tests=()
+case $(uname | tr '[:upper:]' '[:lower:]') in
+    linux*)
+        tests=(
+        "--enable-notifications --enable-icons --enable-otr --enable-pgp
+        --enable-omemo --enable-plugins --enable-c-plugins
+        --enable-python-plugins --with-xscreensaver"
+        "--disable-notifications --disable-icons --disable-otr --disable-pgp
+        --disable-omemo --disable-plugins --disable-c-plugins
+        --disable-python-plugins --without-xscreensaver"
+        "--disable-notifications"
+        "--disable-icons"
+        "--disable-otr"
+        "--disable-pgp"
+        "--disable-omemo"
+        "--disable-pgp --disable-otr"
+        "--disable-pgp --disable-otr --disable-omemo"
+        "--disable-plugins"
+        "--disable-python-plugins"
+        "--disable-c-plugins"
+        "--disable-c-plugins --disable-python-plugins"
+        "--without-xscreensaver"
+        "")
+        ;;
+    darwin*)
+        tests=(
+        "--enable-notifications --enable-icons --enable-otr --enable-pgp
+        --enable-omemo --enable-plugins --enable-c-plugins
+        --enable-python-plugins"
+        "--disable-notifications --disable-icons --disable-otr --disable-pgp
+        --disable-omemo --disable-plugins --disable-c-plugins
+        --disable-python-plugins"
+        "--disable-notifications"
+        "--disable-icons"
+        "--disable-otr"
+        "--disable-pgp"
+        "--disable-omemo"
+        "--disable-pgp --disable-otr"
+        "--disable-pgp --disable-otr --disable-omemo"
+        "--disable-plugins"
+        "--disable-python-plugins"
+        "--disable-c-plugins"
+        "--disable-c-plugins --disable-python-plugins"
+        "")
+        ;;
+esac
+
+for flags in "${tests[@]}"
+do
+    echo
+    echo "--> Building with ./configure $flags"
+    echo
+    # shellcheck disable=SC2086
+    ./configure $flags
+    make
+    ./profanity -v
+    make clean
+
+    echo "$flags"
+done