provs/.gitlab-ci.yml

60 lines
1.4 KiB
YAML
Raw Normal View History

2021-02-14 09:12:50 +00:00
image: openjdk:11-jdk-slim
2021-02-10 19:24:43 +00:00
stages:
- build
- test
- publish
before_script:
- echo "---------- Start CI ----------"
- export GRADLE_USER_HOME=`pwd`/.gradle
- chmod +x gradlew
build:
stage: build
script:
- echo "---------- build stage ----------"
- ./gradlew --build-cache assemble
artifacts:
paths:
- build/libs/*.jar
expire_in: 1 week
test:
stage: test
2021-02-25 18:57:06 +00:00
image: docker:latest
2021-02-10 19:24:43 +00:00
services:
- docker:dind
dependencies:
- build
2021-02-25 18:57:06 +00:00
before_script:
- echo "---------- BEFORE -------------"
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
2021-02-10 19:24:43 +00:00
script:
2021-02-25 18:57:06 +00:00
- echo "---------- TEST -------------"
- apk update && apk add bash openjdk11
- export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker run --privileged -dit --name provs_test -v /var/run/docker.sock:/var/run/docker.sock $CI_REGISTRY_IMAGE
- docker inspect -f '{{.State.Running}}' provs_test
- ./gradlew test -Dtestdockerwithoutsudo=true
artifacts:
when: on_failure
paths:
- build/reports/tests/test
reports:
junit: build/test-results/test/TEST-*.xml
2021-02-10 19:24:43 +00:00
2021-04-27 16:32:08 +00:00
publish:
stage: publish
2021-02-10 19:24:43 +00:00
script:
- ./gradlew jar
2021-04-27 16:32:08 +00:00
- ./gradlew publish
2021-02-10 19:24:43 +00:00
artifacts:
paths:
- build/libs/*.jar
expire_in: 2 months
after_script:
2021-02-25 18:57:06 +00:00
- echo "---------- End CI ----------"