1
0
Fork 0
mirror of https://codeberg.org/beerbrawl/beerbrawl.git synced 2024-09-23 01:30:52 +02:00
beerbrawl/.gitlab-ci.yml
2024-06-19 21:20:19 +02:00

94 lines
2.3 KiB
YAML

image: maven:3-eclipse-temurin-21
variables:
GIT_STRATEGY: 'clone'
MAVEN_OPTS: '-Dmaven.repo.local=.m2'
cache:
paths:
- .m2
stages:
- test
- build
- deploy
test-backend:
stage: test
script:
- cd backend
- mvn -B clean install
test-frontend:
stage: test
image: registry.reset.inso-w.at/pub/docker/node-non-root-20
script:
- cd frontend
- npm ci --legacy-peer-deps
- npm run lint
- npm run eslint:check
- npm run prettier:check
- npm run build
- npm run openapi-clients:replace-base-path-for-prod
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 --legacy-peer-deps
- npm run test:ci
- npm run start &
- cd ../backend
- mvn -B clean install -DskipTests
- java -jar target/*.jar --spring.profiles.active=generateData &
- sleep 30
- cd ../e2e
- npm ci --legacy-peer-deps
- npm run prettier:check
- npx cypress run
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 -B clean install -DskipTests
- mvn -B 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