1
0
Fork 0
mirror of https://codeberg.org/beerbrawl/beerbrawl.git synced 2024-09-22 21:20:52 +02:00
beerbrawl/.gitlab-ci.yml
Christoph Heiss 3552218e4a
chore(#136): e2e: fix coverage reporting
Signed-off-by: Christoph Heiss <e11907069@student.tuwien.ac.at>
2024-06-25 22:18:01 +02:00

123 lines
3.3 KiB
YAML

image: maven:3-eclipse-temurin-21
variables:
GIT_STRATEGY: 'clone'
MAVEN_OPTS: '-Dmaven.repo.local=.m2'
MAVEN_ARGS: '--batch-mode --errors --fail-at-end --show-version'
cache:
paths:
- .m2
stages:
- test
- build
- visualize
- deploy
test-backend:
stage: test
script:
- cd backend
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report
- cd target/site/jacoco/
- awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' jacoco.csv
coverage: /\d+.\d+ % covered/
artifacts:
paths:
- backend/target/site/jacoco/jacoco.xml
reports:
junit:
- backend/target/surefire-reports/TEST-*.xml
coverage-backend:
stage: visualize
image: haynes/jacoco2cobertura:1.0.10
script:
- cd backend
- 'python /opt/cover2cover.py target/site/jacoco/jacoco.xml src/main/java/ > target/site/coverage.xml'
needs:
- test-backend
dependencies:
- test-backend
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: backend/target/site/coverage.xml
test-and-build-frontend:
stage: test
image: registry.reset.inso-w.at/pub/docker/cypress:latest
script:
- cd frontend
- npm ci
- npm run lint
- npm run eslint:check
- npm run prettier:check
- npm run test:ci
- npm run build
- npm run openapi-clients:replace-base-path-for-prod
coverage: /^Statements\s*:\s*([^%]+)/
artifacts:
paths:
- frontend/dist
expire_in: 1 hour
e2e-test:
stage: test
image: registry.reset.inso-w.at/pub/docker/cypress:latest
script:
- cd frontend
- npm ci
- npm run start &
- cd ../backend
- mvn clean install -DskipTests
- java -jar target/*.jar --spring.profiles.active=generateData &
- sleep 30
- cd ../e2e
- npm ci
- npm run cypress:ci
- npm run coverage:ci
coverage: /^Statements\s*:\s*([^%]+)/
artifacts:
when: always
expire_in: 1 hour
reports:
junit:
- '**/cypress/results/*.xml'
paths:
- '**/cypress/videos/*.mp4'
- '**/cypress/screenshots/*.png'
- '**/cypress/reports/html/**'
gitinspector:
stage: test
image: registry.reset.inso-w.at/pub/docker/gitinspector:latest
script:
- /gitinspector/gitinspector.py -f css,html,js,json,kt,java,md,sh,ts,txt,xml,yml -F html --grading -w --since 2022-01-01 > gitinspector.html
artifacts:
paths:
- gitinspector.html
expire_in: 1 hour
build-image:
stage: build
script:
- mkdir -p backend/src/main/resources/static/
- cp -rv frontend/dist/sepr-group-phase/browser/* gitinspector.html backend/src/main/resources/static/
- cd backend
- mvn clean install -DskipTests
- mvn jib:build -Djib.to.image=registry.reset.inso-w.at/$CI_PROJECT_PATH -Djib.to.tags=$CI_PIPELINE_ID -Djib.to.auth.username=$CI_REGISTRY_USER -Djib.to.auth.password=$CI_REGISTRY_PASSWORD
only:
- master
deploy:
stage: deploy
environment:
name: development
script: |
curl -H 'X-DeployToken: '$DEPLOY_TOKEN -H 'Content-type: application/json' -vf -XPUT --data '{"image": "'$CI_PROJECT_PATH'", "tag": "'$CI_PIPELINE_ID'"}' https://reset.inso.tuwien.ac.at/api/dockerDeployment
only:
- master