forked from Spyro-Soft/scargo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
143 lines (128 loc) · 4.12 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
133
134
135
136
137
138
139
140
141
142
143
image: spyrosoftsa/scargo-dev:1.4
stages:
- build
- check
- test
- docu
- publish
.merge_request:
rules:
- if: $CI_COMMIT_MESSAGE =~ /(?i)^(WIP:|Draft:)/
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^(WIP:|Draft:)/'
when: never
- when: always
.merge_request_main:
rules:
- if: $CI_COMMIT_MESSAGE =~ /(?i)^(WIP|Draft:)/
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TITLE =~ /^(WIP|Draft:)/'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME =~ /^(master|main)$/'
when: always
- when: never
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
#______________________________________________________________________________________________BUILD
debug:
stage: build
extends: .merge_request
script:
- flit build
#template
.release:
stage: build
only:
refs:
- master
script:
- flit build
artifacts:
expire_in: 1 hour
paths:
- dist/
#_______________________________________________________________________________________________UNIT TESTS
unit test:
stage: test
extends: .merge_request
allow_failure: false
script:
- ./run.py -u
#_______________________________________________________________________________________________INTEGRATION TESTS
integration test:
stage: test
extends: .merge_request
allow_failure: false
script:
- ./run.py -t
#______________________________________________________________________________________________COPYRIGHTS
copy rights:
stage: check
extends: .merge_request
allow_failure: true
script:
- ./common_dev/scripts/copyrights.py -C scargo/
#______________________________________________________________________________________________TODO
todo:
stage: check
extends: .merge_request
allow_failure: true
script:
- ./common_dev/scripts/todo_check.py -C scargo -C tests
#______________________________________________________________________________________________FORMAT
black:
stage: check
extends: .merge_request
allow_failure: false
script:
- black --check --diff scargo tests common_dev run.py clean.py
isort:
stage: check
extends: .merge_request
allow_failure: false
script:
- isort --profile=black --check --diff scargo tests common_dev run.py clean.py
#______________________________________________________________________________________________CYCLOMATIC
cyclomatic:
stage: check
extends: .merge_request
allow_failure: true
script:
- ./common_dev/scripts/cyclomatic.py
#______________________________________________________________________________________________DOCU
docu:
stage: docu
extends: .merge_request
allow_failure: false
script:
- make -C./docs html
#______________________________________________________________________________________________LINT
pylint:
stage: check
extends: .merge_request
allow_failure: false
script:
- ./common_dev/scripts/pylintchecker.py -c scargo/ -s 9.95 --exclude=tests/
#______________________________________________________________________________________________CHECK_TAG
check_tag:
stage: publish
extends: .merge_request_main
script:
- git config --global --add safe.directory "${CI_PROJECT_DIR}"
- git fetch --tags
- tag=release_$(grep -w __version__ scargo/__init__.py | grep -Eo "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")
- if [[ $(git tag -l "$tag") ]]; then echo "tag $tag exist"; exit 1; else echo "tag $tag does not exist "; fi
#______________________________________________________________________________________________RELEASING
releasing:
stage: publish
image: registry.gitlab.com/gitlab-org/release-cli:latest
only:
- master
- main
script:
- tag=release_$(grep -w __version__ scargo/__init__.py | grep -Eo "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+")
- echo "this is release"
- echo $tag
- release-cli create --name "${tag}" --description "${CI_COMMIT_TAG_MESSAGE:-No release notes.}" --tag-name "${tag}"