-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
70 lines (62 loc) · 1.84 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
image: docker:git
services:
- docker:dind
stages:
- build
- test
- package
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
- export COMMITS=$(git rev-list --all --count)
- if [ -z $LATEST_VERSION_TAG ]; then export LATEST_VERSION_TAG=$CI_COMMIT_REF_NAME; fi
- echo LATEST_VERSION_TAG = $LATEST_VERSION_TAG
cache:
paths:
- .gradle/wrapper
gradle-build:
stage: build
image: openjdk:17-jdk
script: "./gradlew clean build -x test"
artifacts:
expire_in: '7 day'
paths:
- build/
gradle-test:
stage: test
image: openjdk:17-jdk
script: "./gradlew test"
artifacts:
expire_in: '7 day'
reports:
junit:
- build/test-results/test/TEST-*.xml
paths:
- build/
docker-build:
stage: package
only:
- tags
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $CONTAINER_IMAGE:latest || true
- docker pull $CONTAINER_IMAGE:$LATEST_VERSION_TAG || true
- docker build --cache-from $CONTAINER_IMAGE:latest -t $CI_REGISTRY_IMAGE:$LATEST_VERSION_TAG -t $CI_REGISTRY_IMAGE:latest .
- docker push $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:$LATEST_VERSION_TAG
create-badges:
stage: build
image: python:3.6.6
only:
- master
script:
- echo "Python other dependencies installation"
- pip install anybadge #https://github.com/jongracecox/anybadge
- echo commits $COMMITS latest_version $LATEST_VERSION_TAG
- mkdir badges
- anybadge -o -l "latest version" -v $LATEST_VERSION_TAG -f badges/latestversion.svg -c green
- anybadge -o -l "commits" -v $COMMITS -f badges/commits.svg -c lightgrey
- anybadge -o -l "licence" -v "Apache License" -f badges/license.svg -c yellowgreen
- anybadge -o -l "awesomeness" -v "110%" -f badges/awesomeness.svg -c orange
artifacts:
paths:
- badges/*.svg