Files

132 lines
3.6 KiB
YAML

stages:
- test
- real-backend-e2e
- publish
default:
retry: 2
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_TAG'
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"'
when: never
- if: '$CI_COMMIT_BRANCH'
backend-test:
stage: test
image: maven:3.10-eclipse-temurin-25-alpine
tags:
- linux
services:
- name: docker:27.5.1-dind
alias: docker-dind
command: ['--tls=false']
variables:
HEALTHCHECK_TCP_PORT: '2375'
variables:
DOCKER_HOST: tcp://docker-dind:2375
DOCKER_TLS_CERTDIR: ''
TESTCONTAINERS_HOST_OVERRIDE: docker-dind
RUNNER_SCRIPT_TIMEOUT: 10m
timeout: 15m
interruptible: true
coverage: '/Total Line Coverage: ([0-9.]+)%/'
script:
- cd backend
- mvn clean verify
- |
awk -F"," 'NR>1 { lines_missed += $8; lines_covered += $9 } END { total = lines_missed + lines_covered; if (total > 0) printf "Total Line Coverage: %.2f%%\n", 100 * lines_covered / total }' target/site/jacoco/jacoco.csv
frontend-test:
stage: test
image: node:26-alpine
interruptible: true
coverage: '/All files\s*\|\s*([0-9.]+)/'
script:
- npm install -g bun
- cd frontend
- bun install --frozen-lockfile
- bun run lint
- bun run typecheck
- bun run typecheck:real
- bun run test --coverage --watch=false
frontend-e2e:
stage: test
image: mcr.microsoft.com/playwright:v1.63.0-noble
interruptible: true
resource_group: chromium-e2e
script:
- npm install -g bun
- cd frontend
- bun install --frozen-lockfile
- bun run e2e
real-backend-e2e:
stage: real-backend-e2e
image: docker:27.5.1-cli
tags:
- linux
services:
- name: docker:27.5.1-dind
alias: docker-dind
command: ['--tls=false']
variables:
HEALTHCHECK_TCP_PORT: '2375'
resource_group: chromium-e2e
variables:
DOCKER_HOST: tcp://docker-dind:2375
DOCKER_TLS_CERTDIR: ''
E2E_ARTIFACT_DIR: .e2e-real-artifacts
RUNNER_SCRIPT_TIMEOUT: 13m
RUNNER_AFTER_SCRIPT_TIMEOUT: 2m
timeout: 15m
interruptible: false
script:
- ./scripts/e2e-real/run.sh
artifacts:
when: always
expire_in: 7 days
paths:
- .e2e-real-artifacts/
.publish-image:
stage: publish
image: quay.io/buildah/stable:latest
variables:
STORAGE_DRIVER: vfs
BUILDAH_FORMAT: docker
before_script:
- echo "$CI_REGISTRY_PASSWORD" | buildah login --username "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
script:
- |
if [ -n "$CI_COMMIT_TAG" ]; then
IMAGE_TAG="$CI_COMMIT_REF_SLUG"
else
IMAGE_TAG="latest"
fi
buildah build \
--pull-always \
--tag "$IMAGE_NAME:$CI_COMMIT_SHA" \
--tag "$IMAGE_NAME:$IMAGE_TAG" \
"$BUILD_CONTEXT"
buildah push "$IMAGE_NAME:$CI_COMMIT_SHA"
buildah push "$IMAGE_NAME:$IMAGE_TAG"
rules:
- if: '$CI_COMMIT_TAG'
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
publish-backend-image:
extends: .publish-image
variables:
IMAGE_NAME: '$CI_REGISTRY_IMAGE/backend'
BUILD_CONTEXT: backend
publish-frontend-image:
extends: .publish-image
variables:
IMAGE_NAME: '$CI_REGISTRY_IMAGE/frontend'
BUILD_CONTEXT: frontend