Files
WorkTime/.gitlab-ci.yml
2025-03-04 13:56:38 +01:00

117 lines
2.8 KiB
YAML

stages:
- install
- lint
- build
- test
- publish
install-mobile:
stage: install
image: node:lts-alpine
before_script:
- cd src/WorkTime.WebMobile
script:
- npm install --prefer-offline
cache:
key:
files:
- src/WorkTime.Mobile/package.json
paths:
- src/WorkTime.Mobile/node_modules
install-backend:
stage: install
image: mcr.microsoft.com/dotnet/sdk:9.0
script:
- dotnet restore
lint-mobile:
stage: lint
image: node:lts-alpine
needs: ["install-mobile"]
before_script:
- cd src/WorkTime.WebMobile
script:
- npm run lint
cache:
key:
files:
- src/WorkTime.Mobile/package.json
paths:
- src/WorkTime.Mobile/node_modules
policy: pull
build-mobile:
stage: build
image: node:lts-alpine
needs: ["lint-mobile"]
before_script:
- cd src/WorkTime.WebMobile
script:
- npm run build
artifacts:
paths:
- $CI_PROJECT_DIR/src/WorkTime.Mobile/www
expire_in: 10 minutes
cache:
key:
files:
- src/WorkTime.Mobile/package.json
paths:
- src/WorkTime.Mobile/node_modules
policy: pull
build-backend:
stage: build
image: mcr.microsoft.com/dotnet/sdk:9.0
script:
- dotnet restore
- dotnet build --configuration Release --no-restore
artifacts:
paths:
- "**/bin/Release"
expire_in: 10 minutes
dependencies:
- install-backend
test-backend:
stage: test
image: mcr.microsoft.com/dotnet/sdk:9.0
script:
- dotnet test --verbosity normal
dependencies:
- build-backend
publish-mobile:
stage: publish
needs: ["build-mobile"]
image: docker:latest
services:
- name: docker:dind
alias: docker
before_script:
- cd src/WorkTime.WebMobile
script:
- export VERSION=$(echo $CI_COMMIT_TAG | sed 's/^v//')
- docker login -u leon.hoppe -p ${CI_REGISTRY_PASSWORD} registry.leon-hoppe.de
- docker build -t registry.leon-hoppe.de/leon.hoppe/worktime/mobile:$VERSION -t registry.leon-hoppe.de/leon.hoppe/worktime/mobile:latest .
- docker push registry.leon-hoppe.de/leon.hoppe/worktime/mobile:$VERSION
- docker push registry.leon-hoppe.de/leon.hoppe/worktime/mobile:latest
only:
- tags
publish-backend:
stage: publish
image: docker:latest
services:
- name: docker:dind
alias: docker
script:
- export VERSION=$(echo $CI_COMMIT_TAG | sed 's/^v//')
- docker login -u leon.hoppe -p ${CI_REGISTRY_PASSWORD} registry.leon-hoppe.de
- docker build -t registry.leon-hoppe.de/leon.hoppe/worktime/api:$VERSION -t registry.leon-hoppe.de/leon.hoppe/worktime/api:latest -f src/WorkTime.Api/Dockerfile .
- docker push registry.leon-hoppe.de/leon.hoppe/worktime/api:$VERSION
- docker push registry.leon-hoppe.de/leon.hoppe/worktime/api:latest
only:
- tags