-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
81 lines (74 loc) · 2.57 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
image: docker:20.10.16
variables:
# Замените этот путь на свой Registry
REGISTRY_PATH: registry.gitlab.com/microarch-ru/ddd-in-practice/templates/delivery-template
APP_NAME: DeliveryApp
services:
- docker:20.10.16-dind
stages:
- tests
- build
# Убеждаемся что логика Core не нарушена
unit tests:
image: mcr.microsoft.com/dotnet/sdk:8.0
stage: tests
variables:
test_path: "./Tests/$APP_NAME.UnitTests"
script:
- "cd $test_path"
- dotnet test
# Убеждаемся что приложение корректно взаимодействует с инфраструктурой
#integration tests:
# image: mcr.microsoft.com/dotnet/sdk:8.0
# stage: tests
# variables:
# test_path: "./Tests/$APP_NAME.IntegrationTests"
# # Instruct Testcontainers to use the daemon of DinD.
# DOCKER_HOST: "tcp://docker:2375"
# # Instruct Docker not to start over TLS.
# DOCKER_TLS_CERTDIR: ""
# # Improve performance with overlayfs.
# DOCKER_DRIVER: overlay2
# services:
# - name: docker:dind
# # explicitly disable tls to avoid docker startup interruption
# command: ["--tls=false"]
# script:
# - dotnet restore $APP_NAME.sln -s 'https://api.nuget.org/v3/index.json' -s $NUGET_SOURCE
# - "cd $test_path"
# - dotnet test
# tags:
# - docker
# Убеждаемся что API приложения и он сам работает корректно
#component tests:
# image: mcr.microsoft.com/dotnet/sdk:8.0
# stage: tests
# variables:
# test_path: "./Tests/$APP_NAME.ComponentTests"
# # Instruct Testcontainers to use the daemon of DinD.
# DOCKER_HOST: "tcp://docker:2375"
# # Instruct Docker not to start over TLS.
# DOCKER_TLS_CERTDIR: ""
# # Improve performance with overlayfs.
# DOCKER_DRIVER: overlay2
# services:
# - name: docker:dind
# # explicitly disable tls to avoid docker startup interruption
# command: ["--tls=false"]
# script:
# - dotnet restore $APP_NAME.sln -s 'https://api.nuget.org/v3/index.json' -s $NUGET_SOURCE
# - "cd $test_path"
# - dotnet test
# tags:
# - docker
# Собираем Docker Image и помещаем в Gitlab Registry (хранилище артефактов)
docker-build:
stage: build
except:
refs:
- tags
before_script:
- docker login $REGISTRY_PATH -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD
script:
- docker build -t $REGISTRY_PATH:latest .
- docker push $REGISTRY_PATH:latest