forked from Lauszus/FaceRecognitionApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
109 lines (85 loc) · 4.3 KB
/
.travis.yml
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
language: android
sudo: required
jdk: oraclejdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -rf $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
# Zip files cache
- $HOME/zip-cache/
# Android NDK, OpenCV SDK and Eigen
- $HOME/android-ndk/
- $HOME/opencv-sdk/
- $HOME/eigen3/
# Gradle dependencies
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
# Android build cache (see http://tools.android.com/tech-docs/build-cache)
- $HOME/.android/build-cache/
android:
components:
# Use the latest revision of Android SDK Tools
- tools
- platform-tools
# The BuildTools version used by your project
- build-tools-28.0.3
# The SDK version used to compile your project
- android-28
# Additional components
- extra-android-m2repository
before_install:
# Accept the licenses needed for OpenCV and this project
- yes | sdkmanager "platforms;android-27" "platforms;android-28"
before_script:
# Download Android NDK, OpenCV Android SDK and Eigen 3
- if test ! -e $HOME/zip-cache/android-ndk.zip ; then wget https://dl.google.com/android/repository/android-ndk-r18-linux-x86_64.zip -O $HOME/zip-cache/android-ndk.zip ; fi
- if test ! -e $HOME/zip-cache/opencv-sdk.zip ; then wget https://github.com/opencv/opencv/releases/download/3.4.1/opencv-3.4.1-android-sdk.zip -O $HOME/zip-cache/opencv-sdk.zip ; fi
- if test ! -e $HOME/zip-cache/eigen3.zip ; then wget https://bitbucket.org/eigen/eigen/get/3.3.5.zip -O $HOME/zip-cache/eigen3.zip ; fi
# Unzip the zip files into their directories
- unzip -qq -n $HOME/zip-cache/android-ndk.zip -d $HOME/android-ndk
- unzip -qq -n $HOME/zip-cache/opencv-sdk.zip -d $HOME/opencv-sdk
- unzip -qq -n $HOME/zip-cache/eigen3.zip -d $HOME/eigen3
# Set environmental variables
- export ANDROID_NDK_HOME=$(dirname $HOME/android-ndk/android-ndk-*/ndk-build)
- export OPENCV_ANDROID_SDK=$HOME/opencv-sdk/OpenCV-android-sdk
- export EIGEN3_DIR=$(dirname $(find $HOME/eigen3 -type f -name 'signature_of_eigen3_matrix_library' -print -quit))
# Apply patch to OpenCV
- patch -d$OPENCV_ANDROID_SDK/../ -p0 < opencv.patch
script:
- ./gradlew --no-daemon build
before_deploy:
# Clean the project
- ./gradlew --no-daemon clean
- rm -rf build
- rm -rf app/.externalNativeBuild
# Remove git files
- find . -name .git | xargs rm -rf
- find . -name .gitmodules | xargs rm -rf
- find . -name .gitignore | xargs rm -rf
- find . -name .gitattributes | xargs rm -rf
# Copy content of OpenCV and Eigen3 into the project directory
- mkdir -p OpenCV-android-sdk Eigen3
- cp -a $OPENCV_ANDROID_SDK/. OpenCV-android-sdk/
- cp -a $EIGEN3_DIR/. Eigen3/
# Remove unused directories from OpenCV
- rm -rf OpenCV-android-sdk/apk OpenCV-android-sdk/samples
# Hardcode paths to OpenCV and Eigen3 using relative paths
- sed -i app/src/main/cpp/Android.mk -e "s/\$(OPENCV_ANDROID_SDK)/\$(LOCAL_PATH)\/..\/..\/..\/..\/OpenCV-android-sdk/"
- sed -i app/src/main/cpp/Android.mk -e "s/\$(EIGEN3_DIR)/\$(LOCAL_PATH)\/..\/..\/..\/..\/Eigen3/"
- sed -i app/src/main/cpp/Android.mk -e "/ifndef OPENCV_ANDROID_SDK/,+2d"
- sed -i app/src/main/cpp/Android.mk -e "/ifndef EIGEN3_DIR/,+2d"
- sed -i settings.gradle -e "s/System.getenv('OPENCV_ANDROID_SDK')/'OpenCV-android-sdk'/"
# Zip the directory
- cd ../
- mv FaceRecognitionApp "FaceRecognitionApp-$TRAVIS_TAG"
- zip -rq "FaceRecognitionApp-$TRAVIS_TAG.zip" "FaceRecognitionApp-$TRAVIS_TAG"
- APP_ZIP=$(pwd)/"FaceRecognitionApp-$TRAVIS_TAG.zip"
deploy:
provider: releases
api_key:
secure: AS5TYcwjqZes1JKqQTryPifgijqJd8H2lowmOWDPSwc17DYFWrU58TR2yn1KYFMQ0dzBse7q6W4Pa43UFl0vsNQaOzKiEg93NSZowXZx+uOF2nlfayFFxfGqVaKKyNpsV1Tmp+Q0eUK5XxBxJ5aSBgJ0II0lyjDaeNJ86x8mvxWoznRy4Ra9COiKnO5kRjwIoCbQFZcf9We4TuSzVnnAIKMeX1rYyczx099FWayIVgT1WSZYZ5r60iU2MZbpkP1/MAcZEOy9OhdQQYm4RYaVq2gmIgGqRKnQ6i9hJXHyNH/u8S3YOrK9SA6XSLN66KCnK4Sk/LtIIrw7ZVkgyHrgmp+hA4JiBuAGIlvDoMJHg8P1EWj2JeVh63NXJSFYvHgRqNpan+9Z+QISi+cAeejbQEumTLA3QJgdgCN22n6hgLWtPWLe4MDVZmWfhIZNZjQZC0C9w3Zi0fwJlf2fC2lQ2tthUBdX3CsM4Ct2Ev2Y+gWo0A4ykcgm0irv81BX6Pd9WAGNnT35+68xv5IU+K0RNT8XJD1aekVY7n7Z3I8f8n99OnFwP6k2T+4rseaY2pQT4aAmsLRKWtm5oKhPFW5hxjzd8REunohUZz81QdvDdCB6wm/knqIqy+A4kzoKkF2CrQxWGM4/hD0/Cnk5oGZSNNJYbfsb4SpBWwl7NiG1GzM=
file: "$APP_ZIP"
skip_cleanup: true
on:
tags: true