Gitlab ci docs

This commit is contained in:
Oystein Kristoffer Tveit 2021-03-01 15:24:05 +01:00
parent f358c305ee
commit 65398e5db7
2 changed files with 28 additions and 22 deletions

View File

@ -22,8 +22,8 @@ cache:
stages: stages:
- build - build
- test - test
- coverage - docs
- report - postprocessing
- deploy - deploy
build: build:
@ -49,47 +49,45 @@ unittest:
- target/failsafe-reports/TEST-*.xml - target/failsafe-reports/TEST-*.xml
generate-coverage: generate-coverage:
stage: coverage stage: docs
script: script:
- 'mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report' - 'mvn clean jacoco:prepare-agent test jacoco:report'
- 'cat target/site/jacoco/index.html' - 'cat target/site/jacoco/index.html'
coverage: '/Total.*?([0-9]{1,3})%/' coverage: '/Total.*?([0-9]{1,3})%/'
artifacts: artifacts:
paths: paths:
- target/site/ - target/site/jacoco
- target/site/jacoco/jacoco.xml
report-coverage: process-coverage:
stage: report stage: postprocessing
image: haynes/jacoco2cobertura:1.0.4 image: haynes/jacoco2cobertura:1.0.4
needs: [generate-coverage]
script: script:
# convert report from jacoco to cobertura # convert report from jacoco to cobertura
- 'python /opt/cover2cover.py target/site/jacoco/jacoco.xml src/main/java > target/site/cobertura.xml' - 'python /opt/cover2cover.py target/site/jacoco/jacoco.xml src/main/java > target/site/cobertura.xml'
# read the <source></source> tag and prepend the path to every filename attribute # read the <source></source> tag and prepend the path to every filename attribute
- 'python /opt/source2filename.py target/site/cobertura.xml' - 'python /opt/source2filename.py target/site/cobertura.xml'
needs: [generate-coverage]
artifacts: artifacts:
reports: reports:
cobertura: target/site/cobertura.xml cobertura: target/site/cobertura.xml
generate-apidocs:
stage: docs
script:
- 'mvn clean javadoc:javadoc'
artifacts:
paths:
- target/site/apidocs
pages: pages:
stage: deploy stage: deploy
needs: [generate-coverage] needs: [generate-coverage, generate-apidocs]
script: script:
- mv target/site/* public/ - mv target/site/jacoco public/
- mv target/site/apidocs public/
artifacts: artifacts:
paths: paths:
- public - public
expire_in: 30 days expire_in: 30 days
only: only:
- master - master
# integrationtest-job:
# stage: test
# dependencies:
# - build-job
# script:
# - "mvn verify $MAVEN_CLI_OPTS"
# artifacts:
# paths:
# - target/

View File

@ -65,6 +65,14 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- JavaDoc -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<type>maven-plugin</type>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>