-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
97 lines (90 loc) · 2.85 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
90
91
92
93
94
95
96
97
variables:
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=false -DdeployAtEnd=true"
SONAR_PROPS: "-Dsonar.organization=ebi-uniprot -Dsonar.qualitygate.timeout=1800 -Dsonar.qualitygate.wait=true"
SONAR_HOST_URL: "https://sonarcloud.io"
MAVEN_SETTINGS: "maven-settings.xml"
URL_MAVEN_SETTINGS: "https://gitlab.ebi.ac.uk/api/v4/projects/${CONFIG_PROJECT_ID}/repository/files/${MAVEN_SETTINGS}/raw?ref=master&private_token=${GITLAB_USER_API_TOKEN}"
UNIPROT_RESOURCES: "-Dcv.db.types.location=ftp://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/docs/dbxref.txt"
GIT_DEPTH: 0 # Tells git to fetch all the branches of the project, required by the analysis task
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
JACOCO_AGGREGATE_REPORT: "jacoco-aggregate-report/target/site/jacoco-aggregate/jacoco.xml"
image: maven:3.8.5-openjdk-17
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- .m2/repository
- .sonar/cache
stages:
- build
- test
- quality
- deploy
- bridge
core:settings:
stage: build
before_script:
- 'curl --location "${URL_MAVEN_SETTINGS}" --output ${MAVEN_SETTINGS}'
script:
- if [ ! -f ${MAVEN_SETTINGS} ];
then echo "CI settings file missing";
fi
artifacts:
when: always
expire_in: 2 days
paths:
- ./${MAVEN_SETTINGS}
rules:
- if: '$CI_COMMIT_REF_NAME == "main"'
- when: manual
allow_failure: true
core:test:
stage: test
script:
- 'mvn $MAVEN_CLI_OPTS $UNIPROT_RESOURCES install'
- 'mkdir -p ./jacoco-report'
- 'cp $JACOCO_AGGREGATE_REPORT ./jacoco-report/'
artifacts:
when: always
expire_in: 2 days
paths:
- .m2/repository
- ./*/target
- ./jacoco-report
reports:
junit:
- ./*/target/surefire-reports/TEST-*.xml
rules:
- if: '$CI_COMMIT_REF_NAME == "main"'
- when: manual
allow_failure: true
core:sonar:
stage: quality
script: mvn $MAVEN_CLI_OPTS -Dsonar.coverage.jacoco.xmlReportPaths=$(pwd)/jacoco-report/jacoco.xml sonar:sonar ${SONAR_PROPS} -Dsonar.projectKey=uniprot-core
dependencies:
- core:test
artifacts:
when: always
expire_in: 2 days
paths:
- .m2/repository
- ./target
- ./*/target
rules:
- if: '$CI_COMMIT_REF_NAME == "main"'
- when: manual
allow_failure: true
core:deploy:
stage: deploy
script: mvn $MAVEN_CLI_OPTS -DskipTests deploy -s ${MAVEN_SETTINGS}
dependencies:
- core:settings
- core:sonar
only:
- main
store:downstream:
stage: bridge
trigger: uniprot/deployment/uniprot-store
when: on_success
only:
- main