-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.gitlab-ci.yml
89 lines (79 loc) · 2.13 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
variables:
VERSION: "6.0.1"
stages:
- build
- test
- check
- deploy
.gradle_script: &gradle_script
- GRADLE_USER_HOME="$(pwd)/.gradle"
- export GRADLE_USER_HOME
- mkdir -p $GRADLE_USER_HOME
default:
tags:
- balrogrunner8
image: eclipse-temurin:23.0.1_11-jdk-alpine
before_script:
- *gradle_script
cache: &global_cache
key: MaDKit-$CI_PROJECT_ID
paths:
- MaDKit/build
- gradle/wrapper/
- .gradle
build:
stage: build
script: ./gradlew --build-cache assemble
test:
stage: test
script: ./gradlew --build-cache check
artifacts:
when: on_failure
reports:
junit: MaDKit/build/test-results/test/**/TEST-*.xml
sonarqube-check:
stage: check
cache:
<<: *global_cache
policy: pull
variables:
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
script: ./gradlew sonar
allow_failure: true
rules:
- if: $CI_COMMIT_BRANCH == 'main'
deploy-javadoc:
stage: deploy
image: finalgene/openssh
cache:
<<: *global_cache
policy: pull
script:
- apk add --no-cache lftp #install the lftp package
- lftp -u $WEB_USER,$WEB_PASS -e "set ftp:ssl-allow 0; mkdir -p web/javadoc/$VERSION; mirror -R MaDKit/build/docs/javadoc web/javadoc/$VERSION; bye;" sftp://cwbq.ftp.infomaniak.com
environment: production
rules:
- if: $CI_COMMIT_TAG
.deploy_gpg_job: &deploy_gpg_job
stage: deploy
cache:
<<: *global_cache
policy: pull
before_script:
- *gradle_script
- cat "$GPG_SECRET_KEY" | base64 --decode | gpg --pinentry-mode loopback --passphrase $GPG_signing --import
- echo "test" | gpg --clearsign --batch --pinentry-mode loopback --passphrase $GPG_signing
environment: production
deploy-production:
extends: .deploy_gpg_job
script:
- ./gradlew -Pversion="$CI_COMMIT_TAG" publish
rules:
- if: $CI_COMMIT_TAG
deploy-staging:
extends: .deploy_gpg_job
script:
- ./gradlew -Pversion="$VERSION-SNAPSHOT" publish
rules:
- if: $CI_COMMIT_BRANCH == 'main'