Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deltachat-node to v0.44.0 and fix ci #796

Merged
merged 10 commits into from
May 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 31 additions & 46 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,64 +1,49 @@
sudo: required
language: node_js
services:
- docker
sudo: required
dist: xenial

addons:
apt:
homebrew:
packages:
- appstream-util
- desktop-file-utils
- python3-pip
- python3-setuptools
- libssl-dev
- libsqlite3-dev
- libbz2-dev
- zlib1g-dev
- libsasl2-dev
- meson
- libetpan
- openssl
- coreutils
update: true
os:
- osx
- linux

node_js:
- 10

os:
- osx
- linux
env:
global:
- DOCKER_IMAGE=deltachat/travis-dc-node-base:latest

matrix:
- DC_CORE_VERSION="master" SYS_DC_CORE="false"
- DC_CORE_VERSION="master" SYS_DC_CORE="true"

cache:
directories:
- $HOME/Library/Caches/Homebrew
- $HOME/.cargo
- $TRAVIS_BUILD_DIR/target

before_cache:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cleanup;

before_install:
- if [ $(uname) = Linux ]; then
wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip;
unzip ninja-linux.zip;
chmod +x ninja;
sudo cp ninja /usr/bin;
fi
- if [ $(uname) = Linux ]; then
sudo pip3 install meson;
fi
- ./ci_scripts/ci-prelude.sh

install:
- npm install
- ./ci_scripts/ci-build.sh

script:
- if [ $(uname) = Linux ]; then
desktop-file-validate static/chat.delta.desktop.desktop;
fi
- if [ $(uname) = Linux ]; then
appstream-util validate-relax static/chat.delta.desktop.appdata.xml;
fi
- npm run build
- npm test
- if [ $(uname) != Linux ]; then
npm run test-integration;
fi

# Only deploy for OSX, for linux we only release source.
deploy:
skip_cleanup: true
provider: script
script: npm run dist-ci
on:
repo: deltachat/deltachat-desktop
os: osx
all_branches: true

- ./ci_scripts/ci-test.sh

notifications:
email: false
35 changes: 35 additions & 0 deletions ci_scripts/build_sasl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

set -e -x

SASL_VERSION=2.1.27
SASL_SHA256=26866b1549b00ffd020f188a43c258017fa1c382b3ddadd8201536f72efb05d5

curl -O https://www.cyrusimap.org/releases/cyrus-sasl-${SASL_VERSION}.tar.gz
echo "${SASL_SHA256} cyrus-sasl-${SASL_VERSION}.tar.gz" | shasum -a256 -c -
tar zxf cyrus-sasl-${SASL_VERSION}.tar.gz

cd cyrus-sasl-${SASL_VERSION}

./configure --enable-shared \
--disable-silent-rules \
--disable-cmulocal \
--disable-sample \
--disable-obsolete_cram_attr \
--disable-obsolete_digest_attr \
--disable-staticdlopen \
--disable-java \
--disable-alwaystrue \
--enable-checkapop \
--enable-cram \
--enable-digest \
--enable-scram \
--enable-plain \
--enable-anon \
--enable-login \
--disable-macos-framework \
"$@"

make
make install
ldconfig || true
42 changes: 42 additions & 0 deletions ci_scripts/ci-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# Build deltachat-node itself.

# On linux this uses the latest created docker container, which works
# fine on the CI build but may be the wrong continer if you are doing
# things somewhere else. Set CONTAINER_ID to the correct container to
# avoid using the latest created container.

set -ex


# To facilitate running locally, derive some Travis environment
# variables.
if [ -z "$TRAVIS_OS_NAME" ]; then
case $(uname) in
Darwin)
TRAVIS_OS_NAME=osx
;;
Linux)
TRAVIS_OS_NAME=linux
;;
*)
echo "TRAVIS_OS_NAME unset and uname=$(uname) is unknown" >&2
exit 1
esac
fi
SYS_DC_CORE=${SYS_DC_CORE:-true}


if [ $TRAVIS_OS_NAME = linux ]; then
CONTAINER_ID=${CONTAINER_ID:-$(docker ps --latest --format='{{.ID}}')}
EXEC="docker exec $CONTAINER_ID";
EXEC_ROOT="docker exec -u0:0 -eHOME=/ $CONTAINER_ID";
else
EXEC=
EXEC_ROOT=sudo
fi

export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
$EXEC npm install --dc-system-lib=$SYS_DC_CORE;
$EXEC npm run build;
77 changes: 77 additions & 0 deletions ci_scripts/ci-prelude.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

# This script prepares the CI host by installing external dependencies
# for the deltachat-node bindings.

set -ex


# Some default variables, these are normally provided by the CI
# runtime.
DOCKER_IMAGE=${DOCKER_IMAGE:-deltachat/travis-dc-node-base:latest}
DC_CORE_VERSION=${DC_CORE_VERSION:-master}


# To facilitate running locally, derive some Travis environment
# variables.
if [ -z "$TRAVIS_OS_NAME" ]; then
case $(uname) in
Darwin)
TRAVIS_OS_NAME=osx
;;
Linux)
TRAVIS_OS_NAME=linux
;;
*)
echo "TRAVIS_OS_NAME unset and uname=$(uname) is unknown" >&2
exit 1
esac
fi
SYS_DC_CORE=${SYS_DC_CORE:-true}


case $TRAVIS_OS_NAME in
linux)
docker pull $DOCKER_IMAGE
CONTAINER_ID=$(docker run -d -v/etc/passwd:/etc/passwd:ro -u$(id -u):$(id -g) -v$(pwd):/work -w/work -eHOME=/work $DOCKER_IMAGE)
EXEC="docker exec $CONTAINER_ID";
EXEC_ROOT="docker exec -u0:0 -eHOME=/ $CONTAINER_ID";
if [ "$SYS_DC_CORE" = "true" ]; then
$EXEC git clone --branch=$DC_CORE_VERSION https://github.com/deltachat/deltachat-core deltachat-core-src
$EXEC meson -Drpgp=true deltachat-core-build deltachat-core-src
$EXEC ninja -v -C deltachat-core-build
$EXEC_ROOT ninja -v -C deltachat-core-build install
$EXEC_ROOT ldconfig -v
$EXEC rm -rf deltachat-core-build deltachat-core-src
fi
;;
osx)
# Install cyrus sasl
./ci_scripts/build_sasl.sh --with-openssl=/usr/local/opt/openssl

export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig

# Install rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- --default-toolchain nightly -y
. ~/.cargo/env

# Install rpgp
git clone https://github.com/rpgp/rpgp.git
pushd rpgp/pgp-ffi
make install
popd


if [ "$SYS_DC_CORE" = "true" ]; then
git clone --branch=$DC_CORE_VERSION https://github.com/deltachat/deltachat-core deltachat-core-src
meson -Drpgp=true deltachat-core-build deltachat-core-src
ninja -v -C deltachat-core-build
sudo ninja -v -C deltachat-core-build install
fi
rm -rf deltachat-core-build deltachat-core-src cyrus-sasl-*
;;
*)
echo "Unknown OS: $TRAVIS_OS_NAME" >&2
exit 1
esac
48 changes: 48 additions & 0 deletions ci_scripts/ci-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Build deltachat-node itself.

# On linux this uses the latest created docker container, which works
# fine on the CI build but may be the wrong continer if you are doing
# things somewhere else. Set CONTAINER_ID to the correct container to
# avoid using the latest created container.

set -ex


# To facilitate running locally, derive some Travis environment
# variables.
if [ -z "$TRAVIS_OS_NAME" ]; then
case $(uname) in
Darwin)
TRAVIS_OS_NAME=osx
;;
Linux)
TRAVIS_OS_NAME=linux
;;
*)
echo "TRAVIS_OS_NAME unset and uname=$(uname) is unknown" >&2
exit 1
esac
fi

if [ $TRAVIS_OS_NAME = linux ]; then
CONTAINER_ID=${CONTAINER_ID:-$(docker ps --latest --format='{{.ID}}')}
EXEC="docker exec -eDC_ADDR=$DC_ADDR -eDC_MAIL_PW=$DC_MAIL_PW $CONTAINER_ID";
EXEC_ROOT="docker exec -u0:0 -eHOME=/ $CONTAINER_ID";
else
EXEC=
EXEC_ROOT=sudo
fi


$EXEC npm test;
#if [ $TRAVIS_PULL_REQUEST = false ]; then
# $EXEC npm run test-integration;
#fi


# Finally cleanup the running container
if [ $TRAVIS_OS_NAME = linux ]; then
docker kill $CONTAINER_ID;
fi
Loading