-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
132 lines (124 loc) · 4.91 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
stages:
- build
- test
- deploy
workflow:
rules:
# If merge request exists: Run as (detached) merge request pipeline (- if: $CI_PIPELINE_SOURCE == "merge_request_event")
# Never run normal pipeline when merge request exists / never run both (- if: $CI_OPEN_MERGE_REQUESTS)
# Otherwise: Run as normal pipeline (- when: always)
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_OPEN_MERGE_REQUESTS
when: never
- when: always
variables:
# https://docs.cypress.io/guides/continuous-integration/gitlab-ci#Install-Job
# https://github.com/cypress-io/cypress/issues/2821#issuecomment-444109124
# https://github.com/cypress-io/cypress/issues/1281#issuecomment-404823001
npm_config_cache: '$CI_PROJECT_DIR/.npm'
CYPRESS_CACHE_FOLDER: '$CI_PROJECT_DIR/cache/Cypress'
cache:
key:
files:
- FS.TimeTracking.UI.Angular/package-lock.json
paths:
- $npm_config_cache
build:
stage: build
interruptible: true
image: srv-docker-1:5000/schicksoftware/dotnet8.0-jre17-nodejs20.0:latest
tags: [ linux, docker ]
script:
- Build/scripts/timetracking.build.ps1
rules:
# If merge request exists: Run as (detached) merge request pipeline (- if: $CI_PIPELINE_SOURCE == "merge_request_event")
# If tag is pushed: Run as normal pipeline (- if: $CI_COMMIT_TAG)
# On unprotected branch: Enable manual start of normal pipeline (- if: $CI_COMMIT_REF_PROTECTED == "false")
# Otherwise run always (merge / fast forward / ...) (- when: always)
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_REF_PROTECTED == "false"
when: manual
- when: always
test:
stage: test
needs: []
interruptible: true
image: srv-docker-1:5000/schicksoftware/dotnet8.0-jre17-nodejs20.0:latest
tags: [ linux, docker ]
script:
- Build/scripts/timetracking.test.ps1
rules:
# If merge request exists: Don't allow to fail (- if: $CI_PIPELINE_SOURCE == "merge_request_event")
# If tag is pushed: Run as normal pipeline (- if: $CI_COMMIT_TAG)
# On unprotected branch: Allow fail (- if: $CI_COMMIT_REF_PROTECTED == "false")
# Else: Don't allow to fail (default)
# On unprotected branch: Enable manual start (- if: $CI_COMMIT_REF_PROTECTED == "false")
# Otherwise run always (merge / fast forward / ...) (- when: always)
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
allow_failure: false
- if: $CI_COMMIT_TAG
allow_failure: false
- if: $CI_COMMIT_REF_PROTECTED == "false"
allow_failure: false
when: manual
- when: always
artifacts:
name: "test-results"
paths:
- ./**/TestResults/*.trx
- ./**/TestResults/*.html
- ./FS.TimeTracking.UI.Angular/cypress/screenshots
- ./FS.TimeTracking.UI.Angular/cypress/videos
expire_in: 1 week
when: always
deploy_docker:
stage: deploy
interruptible: true
image: docker:20.10.12
services:
- name: docker:20.10.12-dind
command: [ "--insecure-registry=srv-docker-1:5000" ]
variables:
DOCKER_TLS_CERTDIR: "/certs"
tags: [ linux, docker-in-docker ]
script:
- docker info
- docker build -t timetracking --build-arg CI_PROJECT_NAME="$CI_PROJECT_NAME" --build-arg CI_COMMIT_REF_NAME="$CI_COMMIT_REF_NAME" -f Build/docker/timetracking.docker .
- docker tag timetracking srv-docker-1:5000/schicksoftware/timetracking:$CI_COMMIT_TAG
- docker tag timetracking srv-docker-1:5000/schicksoftware/timetracking:latest
- docker push srv-docker-1:5000/schicksoftware/timetracking:$CI_COMMIT_TAG
- docker push srv-docker-1:5000/schicksoftware/timetracking:latest
rules:
# Run only when version-tag is pushed (- if: $CI_COMMIT_TAG =~ /^\d+\.\d+.*$/)
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+.*$/
deploy_windows:
stage: deploy
image: srv-docker-1:5000/schicksoftware/dotnet8.0-jre17-nodejs20.0:latest
tags: [ linux, docker ]
interruptible: true
script:
- Build/scripts/timetracking.publish.ps1 -version "$env:CI_COMMIT_REF_NAME" -runtime win-x64 -publshFolder "$env:CI_PROJECT_NAME-$env:CI_COMMIT_REF_NAME"
rules:
# Run only when version-tag is pushed (- if: $CI_COMMIT_TAG =~ /^\d+\.\d+.*$/)
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+.*$/
artifacts:
name: "$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME-win-x64"
paths:
- "$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME"
expire_in: 1 month
deploy_linux:
stage: deploy
interruptible: true
image: srv-docker-1:5000/schicksoftware/dotnet8.0-jre17-nodejs20.0:latest
tags: [ linux, docker ]
script:
- Build/scripts/timetracking.publish.ps1 -version "$env:CI_COMMIT_REF_NAME" -runtime linux-x64 -publshFolder "$env:CI_PROJECT_NAME-$env:CI_COMMIT_REF_NAME"
rules:
# Run only when version-tag is pushed (- if: $CI_COMMIT_TAG =~ /^\d+\.\d+.*$/)
- if: $CI_COMMIT_TAG =~ /^\d+\.\d+.*$/
artifacts:
name: "$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME-linux-x64"
paths:
- "$CI_PROJECT_NAME-$CI_COMMIT_REF_NAME"
expire_in: 1 month