From 916f38ba21da4f135493d997eaa751048a21ddfe Mon Sep 17 00:00:00 2001 From: nilstes <nils.tesdal@gmail.com> Date: Tue, 11 Sep 2018 16:20:24 +0200 Subject: [PATCH] added service mysql --- .gitlab-ci.yml | 18 ++++++++++++++++++ create_tables.sql | 7 +++++++ 2 files changed, 25 insertions(+) create mode 100644 create_tables.sql diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 48647d1..63d548e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,12 +1,15 @@ image: node:6 +# Install node libraries before_script: - npm install +# Run JEST tests test: script: - npm test +# Publish coverage report on gitlab-pages pages: stage: deploy script: @@ -18,3 +21,18 @@ pages: - public only: - master + +# Set up MySQL test-database +services: + - mysql:latest + +# Configure test-database +variables: + MYSQL_DATABASE: db + MYSQL_ROOT_PASSWORD: password + +# Create database tables +connect: + image: mysql + script: + - echo "SELECT 'OK';" | mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql "$MYSQL_DATABASE" < create_tables.sql diff --git a/create_tables.sql b/create_tables.sql new file mode 100644 index 0000000..c56947e --- /dev/null +++ b/create_tables.sql @@ -0,0 +1,7 @@ +CREATE TABLE`person` ( + `id` int(11) NOT NULL, + `navn` varchar(256) NOT NULL, + `alder` int(3) DEFAULT NULL, + `adresse` varchar(256) NOT NULL, + `bilde_base64` longtext +) ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file -- GitLab