This repository has been archived by the owner on Mar 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
87 lines (74 loc) · 1.85 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
# SPDX-FileCopyrightText: 2022 Magenta ApS
# SPDX-License-Identifier: MPL-2.0
default:
# All jobs are interruptible by default
interruptible: true
stages:
- sync
- lint
- test
- coverage
- release
variables:
POETRY_VERSION: 1.3.2
PRECOMMIT_USE_POETRY: "true"
# Conditions
#############
.if-default-branch-refs: &if-default-branch-refs
if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
.if-tag: &if-tag
if: '$CI_COMMIT_TAG'
.if-merge-request: &if-merge-request
if: '$CI_MERGE_REQUEST_IID'
# Workflow
###########
workflow:
rules:
- <<: *if-tag
- <<: *if-default-branch-refs
- <<: *if-merge-request
include:
- project: labs/salt-automation
file:
- gitlab-ci-templates/common/no-interrupt.v1.yml
- gitlab-ci-templates/common/conventional-commits.v1.yml
- gitlab-ci-templates/common/pre-commit.v1.yml
- gitlab-ci-templates/python/pytest-meta.v1.yml
- gitlab-ci-templates/common/rules.v1.yml
Test:
extends: .pytest
variables:
PYTEST_COV_MODULE: ramqp
PYTEST_EXTRA_FLAGS: -m unittest
Integration-test:
extends: .pytest
services:
- name: rabbitmq:3
alias: rabbitmq
variables:
PYTEST_COV_MODULE: ramqp
PYTEST_EXTRA_FLAGS: -m integrationtest
Export Integration-test coverage:
extends: .export_coverage
needs:
- Test
- Integration-test
Check Integration-test coverage:
extends: .check_coverage
needs:
- Test
- Integration-test
Release to PyPI:
extends:
- .rules:semver-core
stage: release
needs: []
image: python:3-slim
variables:
POETRY_VIRTUALENVS_CREATE: "false"
POETRY_VIRTUALENVS_IN_PROJECT: "false"
before_script:
- pip install --no-cache-dir poetry
script:
- sed -i "s/^version = .*$/version = \"${CI_COMMIT_TAG}\"/g" pyproject.toml
- poetry publish --build --no-interaction --username __token__ --password ${PYPI_TOKEN}