-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
168 lines (158 loc) · 4.4 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# SPDX-FileCopyrightText: 2023 Ross Patterson <[email protected]>
#
# SPDX-License-Identifier: MIT
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Docker.gitlab-ci.yml
variables:
# Variables controlling behavior:
PUID: "1001"
PGID: "1001"
# Project specific values:
PROJECT_NAMESPACE: "rpatterson"
# TEMPLATE: Cleanup once fixed entrypoint has been merged from the project template:
# fix(docker): Entrypoint user should not change
PROJECT_NAME: "prunerr"
# Uncomment to get more debugging output:
# DEBUG: "true"
default:
image:
name: "registry.gitlab.com/rpatterson/prunerr:build-host"
entrypoint:
- "docker-entrypoint.sh"
services:
- "docker:dind"
# TODO: Debug stale venv issues and restore cache after fixing.
stages:
- "build-test"
- "release"
- "release-bump"
- "release-version"
- "scheduled"
- "merge-upgrade"
build-test:
stage: "build-test"
rules:
- if: >-
$CI_COMMIT_BRANCH != null
&& (
$CI_COMMIT_BRANCH !~ /^(develop|main)$/
|| (
$CI_COMMIT_BRANCH == "develop"
&& $CI_COMMIT_TITLE =~
/^build\(release\): Version [0-9]+\.[0-9]+\.[0-9]+.* → [0-9]+\.[0-9]+\.[0-9]+[^0-9].+$/
) || (
$CI_COMMIT_BRANCH == "main"
&& $CI_COMMIT_TITLE =~
/^build\(release\): Version [0-9]+\.[0-9]+\.[0-9]+.* → [0-9]+\.[0-9]+\.[0-9]+$/
)
)
&& $CI_PIPELINE_SOURCE != "schedule"
interruptible: true
parallel:
matrix:
- PYTHON_MINORS:
- "3.11"
- "3.12"
- "3.10"
- "3.9"
- "3.8"
script:
# Delegate steps agnostic of the CI/CD platform to the `./Makefile`:
- >-
init-job.sh entrypoint.sh make -e
test-push test-lint
build-docker-$PYTHON_MINORS
test-docker-$PYTHON_MINORS
release-docker-$PYTHON_MINORS test-clean
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
# Upload build artifacts:
# https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html
paths:
- "./build/reports/"
reports:
junit:
- "./build/reports/*/*unit.xml"
coverage_report:
coverage_format: "cobertura"
path: "./build/reports/*/*cov*.xml"
release:
stage: "release"
needs: ["build-test"]
# Avoid unnecessary artifact downloads:
# https://docs.gitlab.com/ee/ci/yaml/#dependencies
dependencies: []
variables:
DOCKER_BUILD_PULL: "true"
rules:
- if: >-
(
(
$CI_COMMIT_BRANCH == "develop"
&& $CI_COMMIT_TITLE =~
/^build\(release\): Version [0-9]+\.[0-9]+\.[0-9]+.* → [0-9]+\.[0-9]+\.[0-9]+[^0-9].+$/
) || (
$CI_COMMIT_BRANCH == "main"
&& $CI_COMMIT_TITLE =~
/^build\(release\): Version [0-9]+\.[0-9]+\.[0-9]+.* → [0-9]+\.[0-9]+\.[0-9]+$/
)
)
&& $CI_PROJECT_NAMESPACE == $PROJECT_NAMESPACE
script:
- >-
init-job.sh entrypoint.sh make -e release-pkgs test-clean
artifacts:
paths:
- "./dist/prunerr-*"
merge-upgrade:
stage: "merge-upgrade"
needs: ["build-test"]
rules:
- if: >-
$CI_COMMIT_BRANCH =~ /^.+-upgrade$/
script:
- >-
init-job.sh entrypoint.sh make -e VCS_BRANCH_SUFFIX="upgrade" devel-merge
release-bump:
stage: "release-bump"
needs: []
dependencies: []
variables:
DOCKER_BUILD_PULL: "true"
rules:
- if: >-
(
(
$CI_COMMIT_BRANCH == "main"
&& $CI_COMMIT_TITLE !~
/^build\(release\): Version [0-9]+\.[0-9]+\.[0-9]+.* → [0-9]+\.[0-9]+\.[0-9]+$/
) || (
$CI_COMMIT_BRANCH == "develop"
&& $CI_COMMIT_TITLE !~
/^build\(release\): Version [0-9]+\.[0-9]+\.[0-9]+.* → [0-9]+\.[0-9]+\.[0-9].*$/
)
)
&& $CI_PIPELINE_SOURCE != "schedule"
script:
- >-
init-job.sh entrypoint.sh make -e test-push release-bump
# Workaround GitLab's handling of pipeline status when pushing both a branch and a tag:
release-version:
stage: "release-version"
needs: []
dependencies: []
rules:
- if: >-
$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+.*$/
inherit:
default: false
script:
- >-
true
scheduled:
stage: "scheduled"
rules:
- if: >-
$CI_PIPELINE_SOURCE == "schedule"
script:
- >-
init-job.sh entrypoint.sh make -e $SCHEDULED_TARGETS