workouttest_server/.gitlab-ci.yml
2020-05-12 14:47:46 +02:00

63 lines
1.4 KiB
YAML

services:
- mysql:latest
stages:
- build
- prepare
- test
# - deploy
variables:
# Configure mysql environment variables (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE: "aitrainer"
MYSQL_ROOT_PASSWORD: "andio2009"
MYSQL_USER: "aitrainer"
MYSQL_PASSWORD: "andio2009"
before_script:
- echo `pwd` # debug
- echo "$CI_BUILD_NAME, $CI_BUILD_REF_NAME $CI_BUILD_STAGE" # debug
- export GRADLE_USER_HOME=`pwd`/.gradle
cache:
paths:
- .gradle/wrapper
- .gradle/caches
build:
stage: build
image: openjdk:latest
script:
- ./gradlew assemble
artifacts:
paths:
- build/libs/*.jar
expire_in: 1 week
only:
- master
connect:
stage: prepare
image: mysql:latest
script:
- apt-get update && apt-get --assume-yes install mysql-client
- mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql -e "use $MYSQL_DATABASE; show tables;"
- mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql -e "use $MYSQL_DATABASE; DROP table CUSTOMER; DROP table EXERCISES; DROP table EXERCISE_TYPE; DROP table exercise_ages;"
- mysql --user=root --password="$MYSQL_ROOT_PASSWORD" --host=mysql < "data/db/install.sql" #first time
test:
stage: test
image: openjdk:latest
script:
- export spring_profiles_active=test
- ./gradlew check
#deploy:
# stage: deploy
# script:
# - ./deploy
after_script:
- echo "End CI"