-
Notifications
You must be signed in to change notification settings - Fork 23
/
.travis.yml
140 lines (117 loc) · 4.54 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
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
137
138
139
140
language: cpp
env:
global:
# It sets the Application Environment
- POCO_WEBSERVICE_ENVIRONMENT=build
# It makes Docker Hub public repository information available
- DOCKERHUB_USERNAME=edsonsoares
- DOCKERHUB_REPOSITORY=poco_restful_webservice
# Do not prompt for user input when using any SDK methods.
- CLOUDSDK_CORE_DISABLE_PROMPTS=1
- GCLOUD_INSTANCE_NAME=poco_restful_webservice
os: linux
dist: trusty
sudo: enabled
cache:
directories:
# We cache the SDK so we don't have to download it again on subsequent builds.
- $HOME/google-cloud-sdk
services:
- mysql
- docker
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libmysqlclient-dev
- gcc-snapshot
- gcc-6
- g++-6
notifications:
email:
on_success: never # default: change
on_failure: always # default: always
before_install:
# It sets GCC 6 as the default version.
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
# It makes GCloud SDK available
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then
rm -rf $HOME/google-cloud-sdk;
curl https://sdk.cloud.google.com | bash > /dev/null;
fi
- source $HOME/google-cloud-sdk/path.bash.inc
- gcloud --quiet components update
- gcloud version
install:
# It makes available CMake 3.7.2
- cd $HOME
- wget https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz
- tar -xf cmake-3.7.2.tar.gz
- cd cmake-3.7.2
- ./configure
- make && sudo make install
# It makes available Google Test
- sudo sudo apt-get install libgtest-dev
- cd /usr/src/gtest
- sudo cmake .
- sudo make
- sudo cp *.a /usr/lib
# It makes available Poco 1.8.1
# - cd $HOME
# - wget https://pocoproject.org/releases/poco-1.8.1/poco-1.8.1-all.tar.gz
# - tar -xf poco-1.8.1-all.tar.gz
# - cd poco-1.8.1-all
# - ./configure --no-tests --no-samples --everything --omit=MongoDB,Data/ODBC,Data/SQLite,PDF,CppParser,Crypto,NetSSL_OpenSSL,CppUnit,PageCompiler
# - make && sudo make install
- cd $HOME
- git clone https://github.com/edson-a-soares/poco.git /tmp/poco
- cd /tmp/poco
- ./configure --no-tests --no-samples --everything --omit=MongoDB,SQL/ODBC,SQL/SQLite,PDF,CppParser,Crypto,NetSSL_OpenSSL,CppUnit,PageCompiler
- make && sudo make install
before_script:
# =============================================================
# It makes available a MySQL User with proper privileges to
# perform database related tests.
# =============================================================
- mysql -e "CREATE USER 'ci_environment'@'localhost' IDENTIFIED BY 'abc12345'; GRANT ALL ON *.* TO 'ci_environment'@'localhost'";
# =============================================================
# It removes standard Ant Jsch package for using the local one.
# If both are kept Ant gets a bit confused and the build fails.
# =============================================================
- if [ -e "/usr/share/ant/lib/ant-jsch.jar" ]; then
sudo rm "/usr/share/ant/lib/ant-jsch.jar"; fi
# =============================================================
# The following Ant Tasks:
# 1. Create the database
# 2. Create DBDeploy and Application tables as well as load
# sample data.
# =============================================================
- cd $TRAVIS_BUILD_DIR
- ant -propertyfile ci.properties create_schema
- ant -propertyfile ci.properties init_schema
# It makes local libs path available in the PATH environmental variable.
- export LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"
script:
# It creates a separated CMake build directory for building the application.
- cd $HOME && sudo mkdir cmake-build && cd cmake-build
# It enables all parts of the application for building.
- sudo cmake $TRAVIS_BUILD_DIR -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=yes -DENABLE_STANDALONE_SERVICE=yes
# It compiles the application and run the tests.
- sudo cmake --build . --target all -- -j 2
- cd $TRAVIS_BUILD_DIR/bin && ./tests --gtest_filter=* --gtest_color=yes
before_deploy:
- cd $TRAVIS_BUILD_DIR
- bash $TRAVIS_BUILD_DIR/scripts/shell/push-docker-image.sh
deploy:
provider: script
skip_cleanup: true
script: bash $TRAVIS_BUILD_DIR/scripts/shell/deploy.sh
on:
branch: master
after_script:
# =============================================================
# The following Ant Task destroys database and all sample data.
# =============================================================
- cd $TRAVIS_BUILD_DIR
- ant -propertyfile ci.properties drop_schema