forked from I2P_Developers/i2p.i2p
69 lines
2.4 KiB
YAML
69 lines
2.4 KiB
YAML
image: openjdk:8-alpine
|
|
|
|
stages:
|
|
- test
|
|
- build
|
|
|
|
cache:
|
|
key: ${CI_COMMIT_REF_SLUG}
|
|
paths:
|
|
- $HOME/.gradle/caches/
|
|
- $HOME/.gradle/wrapper/
|
|
- .gradle
|
|
|
|
test:
|
|
stage: test
|
|
coverage: '/Total.*?([0-9]{1,3})%/'
|
|
before_script:
|
|
- apk add --no-cache grep
|
|
script:
|
|
- ./gradlew codeCoverageReport
|
|
# The actual output that will be parsed by the code coverage
|
|
- grep -oP "Total.*?%" build/reports/jacoco/html/index.html
|
|
only:
|
|
- master
|
|
- merge_requests
|
|
- tags
|
|
|
|
# Make sure we can build a docker image
|
|
# It's cached for later jobs
|
|
build_docker:
|
|
stage: build
|
|
image: docker:19.03.12
|
|
services:
|
|
- docker:19.03.12-dind
|
|
script:
|
|
# Try to load latest branch image from local tar or from registry
|
|
- docker load -i ci-exports/$CI_COMMIT_REF_SLUG.tar || docker pull $CI_REGISTRY_IMAGE:latest || true
|
|
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:latest .
|
|
- mkdir -p ci-exports/
|
|
- docker save $CI_REGISTRY_IMAGE:latest > ci-exports/$CI_COMMIT_REF_SLUG.tar
|
|
variables:
|
|
# When using dind service, we need to instruct docker to talk with
|
|
# the daemon started inside of the service. The daemon is available
|
|
# with a network connection instead of the default
|
|
# /var/run/docker.sock socket. Docker 19.03 does this automatically
|
|
# by setting the DOCKER_HOST in
|
|
# https://github.com/docker-library/docker/blob/d45051476babc297257df490d22cbd806f1b11e4/19.03/docker-entrypoint.sh#L23-L29
|
|
#
|
|
# The 'docker' hostname is the alias of the service container as described at
|
|
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services.
|
|
#
|
|
# Specify to Docker where to create the certificates, Docker will
|
|
# create them automatically on boot, and will create
|
|
# `/certs/client` that will be shared between the service and job
|
|
# container, thanks to volume mount from config.toml
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
# Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
|
|
DOCKER_HOST: tcp://docker:2376
|
|
cache:
|
|
# The same key should be used across branches
|
|
key: "$CI_COMMIT_REF_SLUG"
|
|
paths:
|
|
- ci-exports/
|
|
only:
|
|
- master
|
|
- merge_requests
|
|
- tags
|
|
|