-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
69 lines (63 loc) · 1.95 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
image: gradle:jdk17
stages:
- build
- test
- deploy
- deploy-release
# Disable the Gradle daemon for Continuous Integration servers as correctness
# is usually a priority over speed in CI environments. Using a fresh
# runtime for each build is more reliable since the runtime is completely
# isolated from any previous builds.
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
build:
script:
- ./gradlew --version
- ./gradlew check --info
deploy:
stage: deploy
script:
- 'PROJECTVERSION=$(grep "^version = \"[0-9A-Z.-]*\"" build.gradle | cut -d"=" -f2 | sed "s/[\" ]//g")'
- echo VERSION=${PROJECTVERSION} > build.info
- echo BUILDNUMBER=${CI_JOB_ID} >> build.info
- echo COMMIT_SHA=${CI_COMMIT_SHORT_SHA} >> build.info
- date +'TIMESTAMP=%Y%m%d%H%M%S' >> build.info
- cat build.info
- ./gradlew installDist
artifacts:
paths:
- build.info
- build/install/oersi-etl/bin/*
- build/install/oersi-etl/lib/*
- data/maps/*
- data/production/*
- data/sharedFixes/*
expire_in: 1 day # Except latest, see Settings > CI/CD > Artifacts
only:
- branches
- tags
sonar:
image: gradle:jdk17
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
script:
- ./gradlew check jacocoTestReport sonarqube --info
only:
- merge_requests
- develop
- master
- sonar
deploy release:
stage: deploy-release
dependencies:
- deploy
script:
- BUILDNUMBER=$(grep "BUILDNUMBER=" build.info | cut -d'=' -f2)
- 'wget -O etl.zip ${CI_PROJECT_URL}/-/jobs/${BUILDNUMBER}/artifacts/download'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file etl.zip "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/etl/${CI_COMMIT_TAG}/etl.zip"'
only:
- tags