61 lines
1.1 KiB
YAML
61 lines
1.1 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_DATABASE: "aitrainer"
|
|
|
|
|
|
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
|
|
- echo "SELECT 'OK';" | mysql -uroot -p "$MYSQL_ROOT_PASSWORD" -h mysql "SHOW DATABASES;"
|
|
|
|
|
|
|
|
test:
|
|
stage: test
|
|
image: openjdk:latest
|
|
script:
|
|
- ./gradlew check -Pargs='spring.profiles.active=deploy'
|
|
|
|
deploy:
|
|
stage: deploy
|
|
script:
|
|
- ./deploy
|
|
|
|
after_script:
|
|
- echo "End CI"
|