Skip to content

Commit eeb8fed

Browse files
committed
⚡ update dependencies and update ci/cd
1 parent e55a099 commit eeb8fed

5 files changed

Lines changed: 69 additions & 69 deletions

File tree

README.md

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@ project with gitlab ci/cd included.
1515

1616
> You need to set these variables in the repository settings.
1717
18-
- **PAKAGE_REGISTRY** - url on package registry. Needed for package uploading
19-
from ci/cd.
20-
> You can take it from pyproject.toml after project generation
21-
> _tool.semantic_release.repository_url_
22-
- **GL_TOKEN** - personal access token for GitLab. Needed for making version
18+
- **`GL_TOKEN`** - personal access token for GitLab. Needed for making version
2319
bumping commits from ci/cd.
24-
- **DEPLOY_TOKEN_NAME** - Name of the access token for package registry. Needed for package uploading
25-
from ci/cd.
26-
- **DEPLOY_TOKEN** - The access token for package registry. Needed for package uploading
27-
from ci/cd.
20+
- **`REPOSITORY_USERNAME`** - Name of the access token for package registry.
21+
Needed for package uploading from ci/cd.
22+
- **`REPOSITORY_PASSWORD`** - The access token for package registry. Needed for
23+
package uploading from ci/cd.
2824

2925
## 🧸 Summarise
3026

@@ -36,21 +32,47 @@ project with gitlab ci/cd included.
3632
## ✨ Features
3733

3834
- [x] GitLab CI/CD
39-
- - [x] Linters (pre-commit)
40-
- - - [x] Trailing-whitespace
41-
- - - [x] Pyupgrade
42-
- - - [x] Prettier
43-
- - - [x] Isort
44-
- - - [x] Black
45-
- - - [x] Flake 8
46-
- - - [x] Mypy
47-
- - - [x] Pylint
48-
- - - [x] Docstring formatter
49-
- - - [x] Autoflake
50-
- - - [x] Poetry check
51-
- - [x] Tests
52-
- - [x] Release (tag version bumping)
53-
- - [ ] Documentation (TODO)
35+
-
36+
- [x] Linters (pre-commit)
37+
-
38+
-
39+
- [x] Trailing-whitespace
40+
-
41+
-
42+
- [x] Pyupgrade
43+
-
44+
-
45+
- [x] Prettier
46+
-
47+
-
48+
- [x] Isort
49+
-
50+
-
51+
- [x] Black
52+
-
53+
-
54+
- [x] Flake 8
55+
-
56+
-
57+
- [x] Mypy
58+
-
59+
-
60+
- [x] Pylint
61+
-
62+
-
63+
- [x] Docstring formatter
64+
-
65+
-
66+
- [x] Autoflake
67+
-
68+
-
69+
- [x] Poetry check
70+
-
71+
- [x] Tests
72+
-
73+
- [x] Release (tag version bumping)
74+
-
75+
- [ ] Documentation (TODO)
5476
- [x] Pre-commit hooks
5577
- [x] Readme
5678
- [x] Contributing

{{cookiecutter.package_name}}/.gitlab-ci.yml

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ stages:
22
- lint # Check package with linters
33
- test # Run test
44
- test-build # Run test build
5-
- deploy-version # Deploy and create version tag
6-
- deploy-package # Deploy package
5+
- deploy # Deploy new version of package to registry
76

87
# Official language image. Look for the different tagged releases at:
98
# https://hub.docker.com/r/library/python/tags/
@@ -14,8 +13,6 @@ variables:
1413
PIP_CACHE_DIR: $CI_PROJECT_DIR/.cache/pip # Set folder in working dir for cache
1514
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit # Set folder in working dir for cache
1615
TOX_TESTENV_PASSENV: PIP_CACHE_DIR PRE_COMMIT_HOME # For cache the dependencies
17-
BOT_NAME: "semantic-release <semantic-release>" # Name of the bot who make commits with version bump
18-
RELEASE_BRANCH: "{{cookiecutter.release_branch}}" # Name of the branch where the release is made
1916

2017
# Runs on 1) merge request in main branch
2118
# 2) commit in main branch
@@ -31,7 +28,7 @@ lint:
3128
- .tox
3229
- ${PRE_COMMIT_HOME}
3330
rules:
34-
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH) && $CI_COMMIT_AUTHOR != $BOT_NAME
31+
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)
3532

3633
# Runs on 1) merge request in main branch
3734
# 2) commit in main branch
@@ -51,7 +48,7 @@ test:
5148
- .reports/py310-report.html
5249
expire_in: 1 week
5350
rules:
54-
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH) && $CI_COMMIT_AUTHOR != $BOT_NAME
51+
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)
5552

5653
# Runs on 1) merge request in main branch
5754
# 2) commit in main branch
@@ -66,44 +63,27 @@ test-build:
6663
paths:
6764
- ${PIP_CACHE_DIR}
6865
rules:
69-
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH) && $CI_COMMIT_AUTHOR != $BOT_NAME
66+
- if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH)
7067

71-
# Runs on 1) commit not from bot in main branch (not runs on version bump)
72-
deploy-version:
68+
# Runs on 1) commit in main branch
69+
deploy:
7370
needs:
7471
- lint
7572
- test
7673
- test-build
7774
script:
7875
- echo "This is the deploy-version version stage"
76+
- echo "Install poetry"
7977
- pip install poetry
80-
- echo "Poetry installed"
78+
- echo "Install python-semantic-release"
8179
- pip install python-semantic-release
82-
- echo "Python-semantic-release installed"
80+
- echo "Set semantic-release git credentials"
8381
- git config --global user.email "semantic-release@gmail.com"
8482
- git config --global user.name "semantic-release"
85-
- echo "Set semantic-release git credentials"
86-
- export GL_TOKEN && semantic-release publish
83+
- semantic-release publish
8784
- echo "Publishing version done!"
8885
cache:
8986
paths:
9087
- ${PIP_CACHE_DIR}
9188
rules:
92-
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_AUTHOR != $BOT_NAME
93-
94-
# Runs on 1) commit from bot in main branch (version bump)
95-
deploy-package:
96-
script:
97-
- echo "This is the build package stage"
98-
- pip install poetry
99-
- echo "Poetry installed"
100-
- poetry build
101-
- echo "The package was build"
102-
- poetry config repositories.gitlab $PAKAGE_REGISTRY
103-
- poetry publish --repository gitlab -u $DEPLOY_TOKEN_NAME -p $DEPLOY_TOKEN
104-
- echo "Publishing package done!"
105-
cache:
106-
paths:
107-
- ${PIP_CACHE_DIR}
108-
rules:
109-
- if: $CI_COMMIT_BRANCH == $RELEASE_BRANCH && $CI_COMMIT_AUTHOR == $BOT_NAME
89+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

{{cookiecutter.package_name}}/.pre-commit-config.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
repos:
22
# Trailing-whitespace
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v4.2.0
4+
rev: v4.3.0
55
hooks:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
88
# Pyupgrade
99
- repo: https://github.com/asottile/pyupgrade
10-
rev: v2.32.1
10+
rev: v3.2.2
1111
hooks:
1212
- id: pyupgrade
1313
args: [--py38-plus]
1414
# Prettier
1515
- repo: https://github.com/pre-commit/mirrors-prettier
16-
rev: v2.6.2
16+
rev: v3.0.0-alpha.4
1717
hooks:
1818
- id: prettier
1919
args:
@@ -28,20 +28,20 @@ repos:
2828
name: isort (python)
2929
# Black
3030
- repo: https://github.com/psf/black.git
31-
rev: 22.3.0
31+
rev: 22.10.0
3232
hooks:
3333
- id: black
3434
name: black
3535
# Flake 8
3636
- repo: https://github.com/pycqa/flake8
37-
rev: 4.0.1
37+
rev: 5.0.4
3838
hooks:
3939
- id: flake8
4040
args:
4141
- --max-line-length=120
4242
# Mypy
4343
- repo: https://github.com/pre-commit/mirrors-mypy
44-
rev: v0.960
44+
rev: v0.991
4545
hooks:
4646
- id: mypy
4747
language_version: python
@@ -51,18 +51,18 @@ repos:
5151
- --ignore-missing-imports
5252
# Pylint
5353
- repo: https://github.com/pycqa/pylint
54-
rev: v2.14.0-b1
54+
rev: v2.15.6
5555
hooks:
5656
- id: pylint
5757
exclude: tests/functional/|tests/input|tests(/\w*)*data/|doc/
5858
# Docstring formatter
5959
- repo: https://github.com/DanielNoord/pydocstringformatter
60-
rev: v0.6.0
60+
rev: v0.7.2
6161
hooks:
6262
- id: pydocstringformatter
6363
# Autoflake
6464
- repo: https://github.com/myint/autoflake
65-
rev: v1.4
65+
rev: v1.7.7
6666
hooks:
6767
- id: autoflake
6868
args:
@@ -73,7 +73,7 @@ repos:
7373
- --remove-unused-variables
7474
# Poetry check
7575
- repo: https://github.com/python-poetry/poetry
76-
rev: 1.2.2
76+
rev: 1.2.0rc1
7777
hooks:
7878
- id: poetry-check
7979
# - id: poetry-lock

{{cookiecutter.package_name}}/poetry.toml

Lines changed: 0 additions & 3 deletions
This file was deleted.

{{cookiecutter.package_name}}/pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ build-backend = "poetry.core.masonry.api"
3434
[tool.semantic_release]
3535
version_toml = ["pyproject.toml:tool.poetry.version"]
3636
branch = "{{cookiecutter.release_branch}}"
37+
version_source = "tag"
3738
hvcs = "gitlab"
3839
build_command = "poetry build"
39-
upload_to_pypi = false
40+
upload_to_repository = true
4041
repository = "gitlab"
4142
commit_parser = "semantic_release.history.emoji_parser"
4243
repository_url = "https://{{cookiecutter.gitlab_host}}/api/v4/projects/{{cookiecutter.package_registry_repository_id}}/packages/pypi"

0 commit comments

Comments
 (0)