-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
116 lines (102 loc) · 3.18 KB
/
.gitlab-ci.yml
File metadata and controls
116 lines (102 loc) · 3.18 KB
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:
- build
- test
- release
- cleanup
include:
- component: "$CI_SERVER_FQDN/ees/rdp/generic-components/rdp-cicd-components/kaniko@main"
inputs:
stage-test-image: release
variables:
CONTAINER_TEST_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
# =============================================================================
# Execute the unit tests
# =============================================================================
test-unit-pg14:
extends: .test-unit
variables:
TS_VERSION: "2.18.0-pg14"
RDP_EXPECTED_POSTGRES_VERSION: "14\\..*"
test-unit-pg16:
extends: .test-unit
variables:
TS_VERSION: "2.18.0-pg16"
RDP_EXPECTED_POSTGRES_VERSION: "16\\..*"
test-unit-pg17:
extends: .test-unit
variables:
TS_VERSION: "2.18.0-pg17"
RDP_EXPECTED_POSTGRES_VERSION: "17\\..*"
.test-unit:
stage: test
variables:
TS_VERSION: "2.18.0-pg14"
PYTHON_VERSION: "3.11"
RDP_POSTGRES_HOST: "postgres"
POSTGRES_DB: "rdp_db"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRES_USER: "${POSTGRES_USER}"
RDP_POSTGRES_URL: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres/rdp_db"
RDP_POSTGRES_URL_INIT: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres"
services:
- name: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/timescale/timescaledb:${TS_VERSION}
alias: postgres
tags:
- ito
# - docker
# - x86_64
image: ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/python:${PYTHON_VERSION}
script:
- pip install -r requirements-dev.txt
- poetry install --all-extras --with dev
- PYTHONPATH="${PYTHONPATH}:.:tests" poetry run pytest --junitxml=report.xml --log-cli-level=DEBUG tests
artifacts: # Collect test results
when: always
paths:
- report.xml
reports:
junit: report.xml
# =============================================================================
# Build the installable package
# =============================================================================
.build-package:
stage: release
tags:
- ito
# - docker
# - x86_64
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/python:3.10
variables:
VERSION_FORMAT: "{base}.post{distance}.dev+{commit}"
script:
- pip install -r requirements-dev.txt
# Guess the version number (no versioneer needed)
- DST_VERSION=$(dunamai from git --format "${VERSION_FORMAT}")
- echo Write destination version $DST_VERSION
- poetry version "$DST_VERSION"
# Build the project
- poetry build
# Push the package
- poetry config repositories.gitlab-intern ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi
- poetry config http-basic.gitlab-intern gitlab-ci-token ${CI_JOB_TOKEN}
- poetry publish --repository gitlab-intern
build-package-main:
extends: .build-package
variables:
VERSION_FORMAT: "{base}.post{distance}+{commit}"
only:
- main
- master
build-package-release:
extends: .build-package
variables:
VERSION_FORMAT: "{base}"
only:
- tags
build-package-development:
extends: .build-package
variables:
VERSION_FORMAT: "{base}.post{distance}.dev+{commit}"
only:
- development
- 4-create-an-installable-python-package