2024-05-02 21:24:21 +02:00
|
|
|
image: maven:3-eclipse-temurin-21
|
|
|
|
|
|
|
|
variables:
|
2024-05-10 18:50:09 +02:00
|
|
|
GIT_STRATEGY: 'clone'
|
|
|
|
MAVEN_OPTS: '-Dmaven.repo.local=.m2'
|
2024-06-12 21:53:35 +02:00
|
|
|
MAVEN_ARGS: '--batch-mode --errors --fail-at-end --show-version'
|
2024-05-02 21:24:21 +02:00
|
|
|
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- .m2
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- build
|
2024-06-12 21:53:35 +02:00
|
|
|
- visualize
|
2024-05-02 21:24:21 +02:00
|
|
|
- deploy
|
2024-05-17 12:27:31 +02:00
|
|
|
|
2024-05-02 21:24:21 +02:00
|
|
|
test-backend:
|
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- cd backend
|
2024-06-12 21:53:35 +02:00
|
|
|
- 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
|
2024-05-02 21:24:21 +02:00
|
|
|
|
2024-06-20 11:19:36 +02:00
|
|
|
test-and-build-frontend:
|
2024-05-02 21:24:21 +02:00
|
|
|
stage: test
|
2024-06-20 11:19:36 +02:00
|
|
|
image: registry.reset.inso-w.at/pub/docker/cypress:latest
|
2024-05-02 21:24:21 +02:00
|
|
|
script:
|
|
|
|
- cd frontend
|
2024-06-25 21:14:57 +02:00
|
|
|
- npm ci
|
2024-05-02 21:24:21 +02:00
|
|
|
- npm run lint
|
2024-05-10 18:50:09 +02:00
|
|
|
- npm run eslint:check
|
|
|
|
- npm run prettier:check
|
2024-06-20 11:19:36 +02:00
|
|
|
- npm run test:ci
|
2024-05-02 21:24:21 +02:00
|
|
|
- npm run build
|
2024-06-16 23:03:24 +02:00
|
|
|
- npm run openapi-clients:replace-base-path-for-prod
|
2024-05-02 21:24:21 +02:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- frontend/dist
|
|
|
|
expire_in: 1 hour
|
|
|
|
|
2024-06-20 11:19:36 +02:00
|
|
|
e2e-test:
|
2024-05-02 21:24:21 +02:00
|
|
|
stage: test
|
|
|
|
image: registry.reset.inso-w.at/pub/docker/cypress:latest
|
|
|
|
script:
|
|
|
|
- cd frontend
|
2024-06-25 21:14:57 +02:00
|
|
|
- npm ci
|
2024-05-02 21:24:21 +02:00
|
|
|
- npm run start &
|
|
|
|
- cd ../backend
|
2024-06-12 21:53:35 +02:00
|
|
|
- mvn clean install -DskipTests
|
2024-05-16 12:42:16 +02:00
|
|
|
- java -jar target/*.jar --spring.profiles.active=generateData &
|
2024-05-02 21:24:21 +02:00
|
|
|
- sleep 30
|
|
|
|
- cd ../e2e
|
2024-06-25 21:14:57 +02:00
|
|
|
- npm ci
|
2024-06-12 22:22:48 +02:00
|
|
|
- npm run cypress
|
|
|
|
- npm run coverage:ci
|
2024-05-02 21:24:21 +02:00
|
|
|
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
|
2024-06-12 21:53:35 +02:00
|
|
|
- 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
|
2024-05-02 21:24:21 +02:00
|
|
|
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
|