Skip to content

Commit

Permalink
Circle20 (#295)
Browse files Browse the repository at this point in the history
* Migrate to Circle CI 2.0

* Add basic workflow definition to Circle CI

* Add Android tests to Circle CI

* Build and test only debug flavour of the code in Circle CI

To speed up CI tests completion

* Port x86_64 Circle CI test job

* Update Java JNI build to support JDK 8

At least on Linux they moved some of the headers to OS-varian subdirectory and it seems the preferred way to get proper includes for JNI build is to include their file `/usr/share/java/java_defaults.mk`

* Drop php tests from Circle 2.0

* Install ruby rvm

* Bump gcov version when creating the symlink

Ubuntu 16.04 installs gcov-5

* Add back PHP tests as a separate workflow

* add npm for js tests
  • Loading branch information
Lagovas committed Jan 26, 2018
1 parent 45ee23e commit c9bdce2
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 106 deletions.
117 changes: 117 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
version: 2
jobs:
android:
docker:
- image: cossacklabs/android-build
steps:
- checkout
- run: git submodule update --init
# limit CMake/Ninja build concurrency when building BoringSSL
# otherwise we hit the 4GB memory limit for the build container
- run: echo 'set_property(GLOBAL APPEND PROPERTY JOB_POOLS circleci_job_pool=4)' >> third_party/boringssl/src/CMakeLists.txt
- run: sed -i 's/"-GNinja"/"-DCMAKE_JOB_POOL_COMPILE=circleci_job_pool", "-GNinja"/g' third_party/boringssl/build.gradle
- run: ./gradlew --no-daemon --no-parallel --max-workers=2 assembleDebug
# install emulator image and create a device
- run: $ANDROID_HOME/tools/bin/sdkmanager 'emulator' 'system-images;android-22;default;armeabi-v7a'
- run: $ANDROID_HOME/tools/bin/avdmanager create avd --name nexus --device "Nexus 5" --package 'system-images;android-22;default;armeabi-v7a'
- run:
command: $ANDROID_HOME/emulator/emulator -avd nexus -noaudio -no-window -gpu off -verbose -qemu
background: true
# wait for emulator to fully boot before running tests
- run: timeout 10m /bin/bash -c 'while true; do $ANDROID_HOME/platform-tools/adb wait-for-device logcat -b events -d | grep -i boot_progress_enable_screen && break; date; sleep 3; done'
- run: ./gradlew --no-daemon --no-parallel --max-workers=2 connectedAndroidTest
x86_64:
docker:
- image: cossacklabs/android-build
environment:
GOTHEMIS_IMPORT: github.com/cossacklabs/themis/gothemis
CFLAGS: "-DCIRICLE_TEST"
steps:
- run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get -y install libssl-dev python python-setuptools python3 python3-setuptools ruby-dev npm lcov libc6-dbg rsync software-properties-common
- run: sudo ln -sf /usr/bin/gcov-5 /usr/bin/gcov
- run: sudo gem install coveralls-lcov
- run: go get github.com/mattn/goveralls
# ruby rvm repository
- run: sudo apt-add-repository -y ppa:rael-gc/rvm
- run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get -y install rvm

# download last valgrind because current version of valgrind on ubuntu (3.11.0) gives false positive errors
# link from http://valgrind.org/downloads/current.html
# don't fetch if was cached

- restore_cache:
keys:
- valgrind-3.13.0

- run: if [ ! -d $HOME/valgrind ]; then cd $HOME && wget ftp://sourceware.org/pub/valgrind/valgrind-3.13.0.tar.bz2 && tar -xjf valgrind-3.13.0.tar.bz2 && cd valgrind-3.13.0 && ./configure --prefix=$HOME/valgrind && make && sudo make install; fi

- save_cache:
key: valgrind-3.13.0
paths:
- ~/valgrind

- checkout
- run: make
- run: make JAVA_HOME=/usr/lib/jvm/default-java themis_jni
- run: sudo make install
- run: sudo make themispp_install
- run: sudo make pythemis_install
- run: sudo make rubythemis_install

- restore_cache:
keys:
- boringssl-chromium-stable

- run: if [ ! -d $HOME/boringssl ]; then cd $HOME && git clone https://boringssl.googlesource.com/boringssl && cd boringssl && git checkout chromium-stable && mkdir build && cd build && cmake .. && make && cp decrepit/libdecrepit.a crypto/; fi

- save_cache:
key: boringssl-chromium-stable
paths:
- ~/boringssl

- run: make ENGINE=boringssl ENGINE_INCLUDE_PATH=$HOME/boringssl/include ENGINE_LIB_PATH=$HOME/boringssl/build/crypto BUILD_PATH=build_with_boringssl prepare_tests_basic
- run: make BUILD_PATH=cover_build COVERAGE=y prepare_tests_basic
- run: make prepare_tests_all
- run: mkdir -p $HOME/go/src/$GOTHEMIS_IMPORT
- run: rsync -auv gothemis/ $HOME/go/src/$GOTHEMIS_IMPORT/
- run: lcov --directory . --zerocounters
# run only if CIRCLE_PR_NUMBER variable is not set (it's not pull request and COVERALLS_TOKEN will be set via circleCI for non-PR build) and COVERALLS_TOKEN is set
# we should calculate coverage for gothemis and send report before sending coverage of main C part
- run: '[ -z "$CIRCLE_PR_NUMBER" ] && ! [ -z "$COVERALLS_TOKEN" ] && cd $HOME/go/src/$GOTHEMIS_IMPORT && $HOME/go/bin/goveralls -v -service=circle-ci -repotoken=$COVERALLS_TOKEN || true'
- run: sudo /sbin/ldconfig
- run: make test
- run: make test_python
- run: make test_js
# it's important to set version of ruby precisely.
- run: source /etc/profile.d/rvm.sh && rvm use system && make test_ruby
- run: make test_go
- run: $HOME/valgrind/bin/valgrind build/tests/soter_test 2>&1 | grep "ERROR SUMMARY\|definitely lost\|indirectly lost\|possibly lost" | awk '{sum += $4} END {print $0; if ( sum > 0 ) { exit 1 } }'
- run: $HOME/valgrind/bin/valgrind build/tests/themis_test 2>&1 | grep "ERROR SUMMARY\|definitely lost\|indirectly lost\|possibly lost" | awk '{sum += $4} END {print $0; if ( sum > 0 ) { exit 1 } }'
- run: cover_build/tests/soter_test
- run: cover_build/tests/themis_test
- run: lcov --directory . --capture --output-file coverage.info
- run: lcov --remove coverage.info 'tests/*' 'src/soter/openssl/*' '/usr/*' --output-file coverage.info
- run: lcov --list coverage.info
- run: coveralls-lcov -v --repo-token $COVERALLS_TOKEN coverage.info || true
- run: $HOME/valgrind/bin/valgrind build_with_boringssl/tests/soter_test 2>&1 | grep "ERROR SUMMARY\|definitely lost\|indirectly lost\|possibly lost" | awk '{sum += $4} END {print $0; if ( sum > 0 ) { exit 1 } }'
- run: $HOME/valgrind/bin/valgrind build_with_boringssl/tests/themis_test 2>&1 | grep "ERROR SUMMARY\|definitely lost\|indirectly lost\|possibly lost" | awk '{sum += $4} END {print $0; if ( sum > 0 ) { exit 1 } }'
# using this php5 image until we ensure tests are working for php7
php5:
docker:
- image: circleci/php:5.6
steps:
- run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get -y install cmake libssl-dev build-essential libc6-dbg default-jdk
- checkout
- run: make
- run: sudo make install
- run: sudo make phpthemis_install
- run: make prepare_tests_all
- run: make test_php

workflows:
version: 2
tests:
jobs:
- android
- x86_64
- php5
104 changes: 0 additions & 104 deletions circle.yml

This file was deleted.

6 changes: 4 additions & 2 deletions jni/themis_jni.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ THEMIS_JNI_OBJ = $(patsubst jni/%.c,$(OBJ_PATH)/jni/%.o, $(THEMIS_JNI_SRC))
THEMIS_JNI_BIN = themis_jni

ifeq ($(JDK_INCLUDE_PATH),)
JDK_INCLUDE_PATH=$(JAVA_HOME)/include
include /usr/share/java/java_defaults.mk
else
jvm_includes=$(JAVA_HOME)/include
endif

$(OBJ_PATH)/jni/%.o: jni/%.c
@mkdir -p $(@D)
@$(CC) $(CFLAGS) -I$(JDK_INCLUDE_PATH) -c $< -o $@
@$(CC) $(CFLAGS) $(jvm_includes) -c $< -o $@

0 comments on commit c9bdce2

Please sign in to comment.