Skip to content

Commit c74c5e5

Browse files
authored
ci: Align GitLab CI/CD config with GitHub Actions. (#179)
1 parent df7c7cf commit c74c5e5

File tree

10 files changed

+187
-161
lines changed

10 files changed

+187
-161
lines changed
File renamed without changes.

.gitlab-ci.yml

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,79 +3,4 @@ stages:
33
- release
44
default:
55
image: python:3.11
6-
ci:
7-
artifacts:
8-
reports:
9-
coverage_report:
10-
coverage_format: cobertura
11-
path: coverage.xml
12-
coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
13-
image: python:$PYTHON_VERSION
14-
interruptible: true
15-
only:
16-
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
17-
- main
18-
- merge_requests
19-
parallel:
20-
matrix:
21-
- PYTHON_VERSION:
22-
- '3.8'
23-
- '3.9'
24-
- '3.10'
25-
- '3.11'
26-
script:
27-
- env | sort
28-
- make dev
29-
- make lint test docs build
30-
stage: ci
31-
lint_title:
32-
interruptible: true
33-
only:
34-
- merge_requests
35-
script:
36-
- |
37-
if ! echo "$CI_MERGE_REQUEST_TITLE" | grep -Pq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*"; then
38-
echo "The title does not conform to the Conventional Commit."
39-
echo "Please refer to 'https://www.conventionalcommits.org/'"
40-
exit 1
41-
fi
42-
stage: ci
43-
package:
44-
only:
45-
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
46-
script:
47-
- env | sort
48-
- make dev-package
49-
- make build
50-
- make upload
51-
stage: release
52-
variables:
53-
TWINE_NON_INTERACTIVE: 'true'
54-
pages:
55-
artifacts:
56-
paths:
57-
- public
58-
except:
59-
refs:
60-
- schedules
61-
only:
62-
changes:
63-
- docs/**/*
64-
refs:
65-
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
66-
script:
67-
- env | sort
68-
- make dev-docs
69-
- make docs
70-
stage: release
71-
release:
72-
image: registry.gitlab.com/gitlab-org/release-cli:latest
73-
only:
74-
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
75-
release:
76-
description: $CI_COMMIT_TAG_MESSAGE
77-
name: $CI_COMMIT_TAG
78-
tag_name: $CI_COMMIT_TAG
79-
script:
80-
- env | sort
81-
stage: release
6+
include: .gitlab/ci/**.yml

.gitlab/ci/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
ci:
2+
artifacts:
3+
reports:
4+
coverage_report:
5+
coverage_format: cobertura
6+
path: coverage.xml
7+
coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
8+
image: python:$PYTHON_VERSION
9+
interruptible: true
10+
only:
11+
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
12+
- main
13+
- merge_requests
14+
parallel:
15+
matrix:
16+
- PYTHON_VERSION:
17+
- '3.8'
18+
- '3.9'
19+
- '3.10'
20+
- '3.11'
21+
script:
22+
- env | sort
23+
- make dev
24+
- make lint test docs build
25+
stage: ci

.gitlab/ci/mr.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
lint_title:
2+
interruptible: true
3+
only:
4+
- merge_requests
5+
script:
6+
- |
7+
if ! echo "$CI_MERGE_REQUEST_TITLE" | grep -Pq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*"; then
8+
echo "The title does not conform to the Conventional Commit."
9+
echo "Please refer to 'https://www.conventionalcommits.org/'"
10+
exit 1
11+
fi
12+
stage: ci

.gitlab/ci/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
docs:
2+
artifacts:
3+
paths:
4+
- public
5+
- docs/changelog.md
6+
- release-notes.md
7+
only:
8+
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
9+
script:
10+
- env | sort
11+
- make dev-docs
12+
- make docs
13+
- make release-notes > release-notes.md
14+
stage: release
15+
package:
16+
needs:
17+
- release
18+
only:
19+
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
20+
script:
21+
- env | sort
22+
- make dev-package
23+
- make build
24+
- make upload
25+
stage: release
26+
variables:
27+
TWINE_NON_INTERACTIVE: 'true'
28+
pages:
29+
artifacts:
30+
paths:
31+
- public
32+
needs:
33+
- release
34+
- docs
35+
only:
36+
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
37+
script:
38+
- env | sort
39+
stage: release
40+
release:
41+
image: registry.gitlab.com/gitlab-org/release-cli:latest
42+
needs:
43+
- docs
44+
only:
45+
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
46+
release:
47+
description: release-notes.md
48+
tag_name: $CI_COMMIT_TAG
49+
script:
50+
- env | sort
51+
stage: release
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,6 @@
1-
[% from pathjoin("includes", "version_compare.jinja") import version_between -%]
21
stages:
32
- ci
43
- release
54
default:
65
image: python:{{ default_py }}
7-
ci:
8-
artifacts:
9-
reports:
10-
coverage_report:
11-
coverage_format: cobertura
12-
path: coverage.xml
13-
coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
14-
image: python:$PYTHON_VERSION
15-
interruptible: true
16-
only:
17-
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
18-
- main
19-
- merge_requests
20-
parallel:
21-
matrix:
22-
- PYTHON_VERSION:
23-
[%- if version_between("3.8", min_py, max_py) %]
24-
- '3.8'
25-
[%- endif %]
26-
[%- if version_between("3.9", min_py, max_py) %]
27-
- '3.9'
28-
[%- endif %]
29-
[%- if version_between("3.10", min_py, max_py) %]
30-
- '3.10'
31-
[%- endif %]
32-
[%- if version_between("3.11", min_py, max_py) %]
33-
- '3.11'
34-
[%- endif %]
35-
script:
36-
- env | sort
37-
- make dev
38-
- make lint test docs build
39-
stage: ci
40-
lint_title:
41-
interruptible: true
42-
only:
43-
- merge_requests
44-
script:
45-
- |
46-
if ! echo "$CI_MERGE_REQUEST_TITLE" | grep -Pq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*"; then
47-
echo "The title does not conform to the Conventional Commit."
48-
echo "Please refer to 'https://www.conventionalcommits.org/'"
49-
exit 1
50-
fi
51-
stage: ci
52-
package:
53-
only:
54-
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
55-
script:
56-
- env | sort
57-
- make dev-package
58-
- make build
59-
- make upload
60-
stage: release
61-
variables:
62-
TWINE_NON_INTERACTIVE: 'true'
63-
pages:
64-
artifacts:
65-
paths:
66-
- public
67-
except:
68-
refs:
69-
- schedules
70-
only:
71-
changes:
72-
- docs/**/*
73-
refs:
74-
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
75-
script:
76-
- env | sort
77-
- make dev-docs
78-
- make docs
79-
stage: release
80-
release:
81-
image: registry.gitlab.com/gitlab-org/release-cli:latest
82-
only:
83-
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
84-
release:
85-
description: $CI_COMMIT_TAG_MESSAGE
86-
name: $CI_COMMIT_TAG
87-
tag_name: $CI_COMMIT_TAG
88-
script:
89-
- env | sort
90-
stage: release
6+
include: .gitlab/ci/**.yml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[% from pathjoin("includes", "version_compare.jinja") import version_between -%]
2+
ci:
3+
artifacts:
4+
reports:
5+
coverage_report:
6+
coverage_format: cobertura
7+
path: coverage.xml
8+
coverage: /(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/
9+
image: python:$PYTHON_VERSION
10+
interruptible: true
11+
only:
12+
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
13+
- main
14+
- merge_requests
15+
parallel:
16+
matrix:
17+
- PYTHON_VERSION:
18+
[%- if version_between("3.8", min_py, max_py) %]
19+
- '3.8'
20+
[%- endif %]
21+
[%- if version_between("3.9", min_py, max_py) %]
22+
- '3.9'
23+
[%- endif %]
24+
[%- if version_between("3.10", min_py, max_py) %]
25+
- '3.10'
26+
[%- endif %]
27+
[%- if version_between("3.11", min_py, max_py) %]
28+
- '3.11'
29+
[%- endif %]
30+
script:
31+
- env | sort
32+
- make dev
33+
- make lint test docs build
34+
stage: ci
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
lint_title:
2+
interruptible: true
3+
only:
4+
- merge_requests
5+
script:
6+
- |
7+
if ! echo "$CI_MERGE_REQUEST_TITLE" | grep -Pq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(\w+\))?!?:\s.*"; then
8+
echo "The title does not conform to the Conventional Commit."
9+
echo "Please refer to 'https://www.conventionalcommits.org/'"
10+
exit 1
11+
fi
12+
stage: ci
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
docs:
2+
artifacts:
3+
paths:
4+
- public
5+
- docs/changelog.md
6+
- release-notes.md
7+
only:
8+
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
9+
script:
10+
- env | sort
11+
- make dev-docs
12+
- make docs
13+
- make release-notes > release-notes.md
14+
stage: release
15+
package:
16+
needs:
17+
- release
18+
only:
19+
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
20+
script:
21+
- env | sort
22+
- make dev-package
23+
- make build
24+
- make upload
25+
stage: release
26+
variables:
27+
TWINE_NON_INTERACTIVE: 'true'
28+
pages:
29+
artifacts:
30+
paths:
31+
- public
32+
needs:
33+
- release
34+
- docs
35+
only:
36+
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
37+
script:
38+
- env | sort
39+
stage: release
40+
release:
41+
image: registry.gitlab.com/gitlab-org/release-cli:latest
42+
needs:
43+
- docs
44+
only:
45+
- /^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)$/
46+
release:
47+
description: release-notes.md
48+
tag_name: $CI_COMMIT_TAG
49+
script:
50+
- env | sort
51+
stage: release

0 commit comments

Comments
 (0)