Skip to content

Commit

Permalink
fix: mysql & pg ci problem (#1641)
Browse files Browse the repository at this point in the history
  • Loading branch information
imbajin authored Nov 10, 2021
1 parent cc509f9 commit 417c73c
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 25 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ jobs:
strategy:
fail-fast: false
matrix:
BACKEND: [memory, cassandra, scylladb, hbase, rocksdb]
BACKEND: [memory, cassandra, scylladb, hbase, rocksdb, mysql, postgresql]
JAVA_VERSION: ['8']

steps:
- name: Install JDK ${{ matrix.JAVA_VERSION }}
uses: actions/setup-java@v2
Expand Down Expand Up @@ -49,6 +50,19 @@ jobs:
run: |
$TRAVIS_DIR/install-backend.sh ${{ matrix.BACKEND }}
- name: Init Mysql Env
uses: mirromutth/[email protected]
with:
host port: 3306 # Optional, default value is 3306. The port of host
container port: 3306 # Optional, default value is 3306. The port of container
character set server: 'utf8mb4' # Optional, default value is 'utf8mb4'. The '--character-set-server' option for mysqld
collation server: 'utf8mb4_general_ci' # Optional, default value is 'utf8mb4_general_ci'. The '--collation-server' option for mysqld
mysql version: '5.7' # Optional, default value is "latest". The version of the MySQL
mysql database: 'test' # Optional, default value is "test". The specified database which will be create
mysql root password: "******" # Required if "mysql user" is empty, default is empty. The root superuser password
#mysql user: 'root' # Required if "mysql root password" is empty, default is empty. The superuser for the specified database. Can use secrets, too
#mysql password: ${{ secrets.DatabasePassword }} # Required if "mysql user" exists. The password for the "mysql user"

- name: Run test
run: |
mvn test -P core-test,${{ matrix.BACKEND }}
Expand Down
16 changes: 8 additions & 8 deletions hugegraph-dist/src/assembly/travis/install-backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ if [[ $# -ne 1 ]]; then
fi

BACKEND=$1
TRAVIS_DIR=`dirname $0`
TRAVIS_DIR=$(dirname "$0")

if [ ! -d $HOME/downloads ]; then
mkdir $HOME/downloads
if [ ! -d "$HOME"/downloads ]; then
mkdir "$HOME"/downloads
fi

case $BACKEND in
cassandra)
$TRAVIS_DIR/install-cassandra.sh
"$TRAVIS_DIR"/install-cassandra.sh
;;
scylladb)
$TRAVIS_DIR/install-scylladb.sh
"$TRAVIS_DIR"/install-scylladb.sh
;;
hbase)
$TRAVIS_DIR/install-hbase.sh
"$TRAVIS_DIR"/install-hbase.sh
;;
mysql)
$TRAVIS_DIR/install-mysql-via-docker.sh
"$TRAVIS_DIR"/install-mysql-via-docker.sh
;;
postgresql)
$TRAVIS_DIR/install-postgresql-via-docker.sh
"$TRAVIS_DIR"/install-postgresql-via-docker.sh
;;
*)
# don't need to install for other backends
Expand Down
13 changes: 8 additions & 5 deletions hugegraph-dist/src/assembly/travis/install-mysql-via-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

set -ev

TRAVIS_DIR=`dirname $0`
TRAVIS_DIR=$(dirname "$0")

# Need speed up it
CONF=hugegraph-test/src/main/resources/hugegraph.properties
MYSQL_USERNAME=root
MYSQL_PASSWORD=123456

# Set MySQL configurations
sed -i "s/jdbc.username=.*/jdbc.username=$MYSQL_USERNAME/" $CONF
sed -i "s/jdbc.password=.*/jdbc.password=$MYSQL_PASSWORD/" $CONF
sed -i "s/jdbc.reconnect_max_times=.*/jdbc.reconnect_max_times=10/" $CONF
sed -i "s/jdbc.reconnect_interval=.*/jdbc.reconnect_interval=5/" $CONF


docker pull mysql:5.7
docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
# Keep for upgrade in future
#docker pull mysql:5.7
#docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD="******" -d mysql:5.7
4 changes: 2 additions & 2 deletions hugegraph-dist/src/assembly/travis/install-mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -ev

TRAVIS_DIR=`dirname $0`
TRAVIS_DIR=$(dirname "$0")
#MYSQL_DOWNLOAD_ADDRESS="http://dev.MySQL.com/get/Downloads"
#MYSQL_VERSION="MySQL-5.7"
#MYSQL_PACKAGE="mysql-5.7.11-Linux-glibc2.5-x86_64"
Expand All @@ -15,7 +15,7 @@ if [ -d /var/lib/mysql ]; then
sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
sudo mv /var/lib/mysql /mnt/ramdisk
sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql
sudo cp $TRAVIS_DIR/mysql.cnf /etc/mysql/conf.d/mysql.cnf
sudo cp "$TRAVIS_DIR"/mysql.cnf /etc/mysql/conf.d/mysql.cnf
sudo service mysql restart
else
echo "Please install mysql firstly."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@

set -ev

TRAVIS_DIR=`dirname $0`
TRAVIS_DIR=$(dirname "$0")
CONF=hugegraph-test/src/main/resources/hugegraph.properties

POSTGRESQL_DRIVER=org.postgresql.Driver
POSTGRESQL_URL=jdbc:postgresql://localhost:5432/
POSTGRESQL_USERNAME=postgres
POSTGRESQL_PASSWORD=123456

# Set PostgreSQL configurations
sed -i "s/jdbc.driver=.*/jdbc.driver=$POSTGRESQL_DRIVER/" $CONF
sed -i "s?jdbc.url=.*?jdbc.url=$POSTGRESQL_URL?" $CONF
sed -i "s/jdbc.username=.*/jdbc.username=$POSTGRESQL_USERNAME/" $CONF
sed -i "s/jdbc.password=.*/jdbc.password=$POSTGRESQL_PASSWORD/" $CONF

sudo service postgresql stop 9.2

docker pull postgres:9.6
docker volume create pgdata
docker run --rm -v pgdata:/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_PASSWORD=123456 -d postgres:9.6
docker run --rm -v pgdata:/var/lib/postgresql/data -p 5432:5432 -e POSTGRES_PASSWORD="******" -d postgres:9.6
2 changes: 1 addition & 1 deletion hugegraph-dist/src/assembly/travis/install-postgresql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -ev

TRAVIS_DIR=`dirname $0`
TRAVIS_DIR=$(dirname "$0")
CONF=hugegraph-test/src/main/resources/hugegraph.properties

POSTGRESQL_DRIVER=org.postgresql.Driver
Expand Down
4 changes: 2 additions & 2 deletions hugegraph-dist/src/assembly/travis/start-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -ev

HOME_DIR=`pwd`
TRAVIS_DIR=`dirname $0`
HOME_DIR=$(pwd)
TRAVIS_DIR=$(dirname $0)
BASE_DIR=$1
BACKEND=$2
BIN=$BASE_DIR/bin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static synchronized MysqlOptions instance() {
"jdbc.password",
"The password corresponding to jdbc.username.",
null,
""
"******"
);

public static final ConfigOption<Integer> JDBC_RECONNECT_MAX_TIMES =
Expand Down
2 changes: 1 addition & 1 deletion hugegraph-test/src/main/resources/hugegraph.properties
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ hbase.znode_parent=/hbase
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306
jdbc.username=root
jdbc.password=
jdbc.password=******
jdbc.reconnect_max_times=3
jdbc.reconnect_interval=3
jdbc.sslmode=disable
Expand Down

0 comments on commit 417c73c

Please sign in to comment.