-
Notifications
You must be signed in to change notification settings - Fork 16
/
.gitlab-ci.yml
131 lines (126 loc) · 5.4 KB
/
.gitlab-ci.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
###################################################
# _ _ _ #
# | | | | (_) #
# | |_| | ___ _ __ _ _______ _ __ #
# | _ |/ _ \| '__| |_ / _ \| '_ \ #
# | | | | (_) | | | |/ / (_) | | | | #
# \_| |_/\___/|_| |_/___\___/|_| |_| #
###################################################
# This file is part of Horizon (c).
#
# Copyright (c) 2019 Sagun K. ([email protected]).
# Copyright (c) 2019 Horizon Dev Team.
#
# Base Author - Sagun K. ([email protected])
#
# This library is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this library. If not, see <http://www.gnu.org/licenses/>.
###################################################
stages:
- debug
- release
variables: &base_vars
# Configure mysql service (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE: 'horizon'
MYSQL_USER: 'ragnarok'
MYSQL_ROOT_PASSWORD: 'ragnarok'
MYSQL_PASSWORD: 'ragnarok'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
GIT_DEPTH: '3'
DEBIAN_COMMON_PACKAGES: cmake mysql-server libmysqlcppconn-dev libboost-all-dev libreadline-dev libcrypto++-dev libluajit-5.1-dev zlib1g-dev
.prerequisites: &prerequisites
before_script:
- pwd
- uname -a
- ${PKG_CMD} update
- ${PKG_CMD} -y install wget lsb-release gnupg unzip
- wget https://dev.mysql.com/get/mysql-apt-config_0.8.12-1_all.deb
- dpkg -i mysql-apt-config_0.8.12-1_all.deb
- ${PKG_CMD} update
- ${PKG_CMD} -y install ${INSTALL_PACKAGES}
- ${PKG_CMD} -y install ${INSTALL_COMPILER}
- mysql --version
- service mysql start
- echo "CREATE USER '${MYSQL_USER}'@'mysql' IDENTIFIED WITH mysql_native_password BY '${MYSQL_PASSWORD}';" | mysql --user=root --password="${MYSQL_ROOT_PASSWORD}" --host=mysql
- echo "CREATE DATABASE ${MYSQL_DATABASE};"
- echo "GRANT ALL ON ${MYSQL_DATABASE}.* TO '${MYSQL_USER}'@'mysql';"
- echo "USE ${MYSQL_DATABASE}; SELECT 'OK'" | mysql --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} --host=mysql
- mysql --user="${MYSQL_USER}" --password="${MYSQL_PASSWORD}" --host="mysql" ${MYSQL_DATABASE} < sql-files/horizon.sql
# SPDLOG
- mkdir tmp; cd tmp;
- git clone https://github.com/gabime/spdlog.git
- cd spdlog; mkdir build; cd build; cmake ../; make install; cd ../../
- git clone https://github.com/ThePhD/sol2.git
- cd sol2; mkdir build; cd build; cmake ../
- make install; cd ../../
# CryptoPP
- mkdir cryptopp; cd cryptopp; wget https://www.cryptopp.com/cryptopp810.zip;
- unzip cryptopp810.zip;
- make && make install;
- cd ../../
artifacts:
paths:
- mysql-apt-config_0.8.12-1_all.deb
expire_in: 1 week
cache:
key: "$CI_BUILD_NAME"
paths:
- tmp
services:
- name: mysql:latest
entrypoint: ['/entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
# Compilers
debian:stretch-gcc:
<<: *prerequisites
stage: debug
image: debian:stretch
variables:
<<: *base_vars
PKG_CMD: apt-get --yes -o dir::cache::archives="apt-cache"
INSTALL_PACKAGES: git ${DEBIAN_COMMON_PACKAGES}
INSTALL_COMPILER: g++
script:
- pwd
- ${INSTALL_COMPILER} --version
- export CXX=/usr/bin/${INSTALL_COMPILER}
- ./horizon build
- cp bin/config/inter-server.lua.dist bin/config/inter-server.lua
- cp bin/config/auth-server.lua.dist bin/config/auth-server.lua
- cp bin/config/char-server.lua.dist bin/config/char-server.lua
- cp bin/config/zone-server.lua.dist bin/config/zone-server.lua
- mkdir bin/logs
debian:stretch-clang:
<<: *prerequisites
stage: debug
image: debian:stretch
variables:
<<: *base_vars
PKG_CMD: apt-get --yes -o dir::cache::archives="apt-cache"
INSTALL_PACKAGES: git ${DEBIAN_COMMON_PACKAGES}
INSTALL_COMPILER: clang
script:
- ${INSTALL_COMPILER} --version
- export CXX=/usr/bin/${INSTALL_COMPILER}++
- git clone https://github.com/gabime/spdlog.git
- cd spdlog; mkdir build; cd build; cmake ../
- make install; cd ..; cd ..;
- ./horizon build
- cp bin/config/inter-server.lua.dist bin/config/inter-server.lua
- cp bin/config/auth-server.lua.dist bin/config/auth-server.lua
- cp bin/config/char-server.lua.dist bin/config/char-server.lua
- cp bin/config/zone-server.lua.dist bin/config/zone-server.lua
- mkdir bin/logs
- ./horizon inter bin --test-run --dbuser=${MYSQL_USER} --dbhost=mysql --dbdatabase=${MYSQL_DATABASE} --dbpassword=${MYSQL_PASSWORD} --dbthreads=10
- ./horizon auth bin --test-run --dbuser=${MYSQL_USER} --dbhost=mysql --dbdatabase=${MYSQL_DATABASE} --dbpassword=${MYSQL_PASSWORD} --dbthreads=10
- ./horizon char bin --test-run --dbuser=${MYSQL_USER} --dbhost=mysql --dbdatabase=${MYSQL_DATABASE} --dbpassword=${MYSQL_PASSWORD} --dbthreads=10
- ./horizon zone bin --test-run --dbuser=${MYSQL_USER} --dbhost=mysql --dbdatabase=${MYSQL_DATABASE} --dbpassword=${MYSQL_PASSWORD} --dbthreads=10