-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
116 lines (107 loc) · 2.58 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
---
stages:
- testing
- building
- publishing
image:
name: 'gitlab-registry.in2p3.fr/cc-in2p3/containers/python/3.9:rockylinux8'
entrypoint: [""]
cache: &global_cache
key: '$CI_COMMIT_SHA'
paths:
- '.cache'
policy: 'pull-push'
variables:
POETRY_CACHE_DIR: '$CI_PROJECT_DIR/.cache/pypoetry'
before_script:
- dnf install -y git
- pip3.9 install poetry
- poetry self add "poetry-dynamic-versioning[plugin]"
- poetry config http-basic.pypi_cc_in2p3_fr gitlab-ci-token "$CI_JOB_TOKEN"
- 'echo -e "machine gitlab.in2p3.fr\n login gitlab-ci-token\n password $CI_JOB_TOKEN\n" > ~/.netrc'
- poetry install
code_style_enforce:
stage: testing
script:
- poetry run poe code-format-check
- poetry run poe code-imports-format-check
- poetry run poe lint
unittest:
stage: testing
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
script:
- dnf install -y python39 python310 python311
- poetry run poe test
- cat coverage.log
artifacts:
when: always
paths:
- 'coverage.xml'
reports:
coverage_report:
coverage_format: 'cobertura'
path: 'coverage.xml'
junit: 'report.xml'
pyright:
stage: testing
image:
name: 'gitlab-registry.in2p3.fr/cc-in2p3/containers/pyright:latest'
entrypoint: [""]
allow_failure: true
script:
- poetry run poe pyright
build:
stage: building
allow_failure: false
script:
- poetry build
artifacts:
expire_in: '1 hour'
paths:
- 'dist/*.tar.gz'
- 'dist/*.whl'
cache:
<<: *global_cache
policy: 'pull'
#
# Publish package to private PyPi
#
# If this is a release, package will
# go to the "central pypi" registry
# at https://gitlab.in2p3.fr/cc-in2p3/python-package-registry
#
# If this is a development version,
# package will go to the "local project pypi"
# registry only
#
# The difference between a release and a development
# version is either a tag was used or not.
#
release-publish:
stage: publishing
dependencies:
- build
allow_failure: false
script:
- poetry publish --repository pypi_cc_in2p3_fr
only:
- '/^v\d/'
except:
- 'branches'
cache:
<<: *global_cache
policy: 'pull'
development-publish:
stage: publishing
dependencies:
- build
allow_failure: false
script:
- poetry config repositories.local_project_pypi ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi
- poetry config http-basic.local_project_pypi gitlab-ci-token "$CI_JOB_TOKEN"
- poetry publish --repository local_project_pypi
except:
- 'tags'
cache:
<<: *global_cache
policy: 'pull'