Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7663adc

Browse filesBrowse files
committed
ci(poe): use poethepoet as script runner for dev and ci and use poetry dependencies groups in ci
Fix #724
1 parent b4dc832 commit 7663adc
Copy full SHA for 7663adc

10 files changed

+77
-48
lines changed

‎.github/pull_request_template.md

Copy file name to clipboardExpand all lines: .github/pull_request_template.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Please fill in the following content to let us know better about this change.
1010
## Checklist
1111

1212
- [ ] Add test cases to all the changes you introduce
13-
- [ ] Run `./scripts/format` and `./scripts/test` locally to ensure this change passes linter check and test
13+
- [ ] Run `poetry all` locally to ensure this change passes linter check and test
1414
- [ ] Test the changes on the local machine manually
1515
- [ ] Update the documentation for the changes
1616

‎.github/workflows/docspublish.yml

Copy file name to clipboardExpand all lines: .github/workflows/docspublish.yml
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
python-version: "3.x"
2020
- name: Install dependencies
2121
run: |
22-
python -m pip install -U pip poetry
22+
python -m pip install -U pip poetry poethepoet
2323
poetry --version
24-
poetry install
24+
poetry install --only main,script
2525
- name: Update CLI screenshots
2626
run: |
27-
poetry run python scripts/gen_cli_help_screenshots.py
27+
poetry doc:screenshots
2828
- name: Commit and push updated CLI screenshots
2929
run: |
3030
git config --global user.name "github-actions[bot]"
@@ -55,12 +55,14 @@ jobs:
5555
python-version: "3.x"
5656
- name: Install dependencies
5757
run: |
58-
python -m pip install -U mkdocs mkdocs-material
58+
python -m pip install -U pip poetry poethepoet
59+
poetry --version
60+
poetry install --no-root --only documentation
5961
- name: Build docs
6062
env:
6163
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6264
run: |
63-
python -m mkdocs build
65+
poetry doc:build
6466
- name: Generate Sponsors 💖
6567
uses: JamesIves/github-sponsors-readme-action@v1
6668
with:

‎.github/workflows/pythonpackage.yml

Copy file name to clipboardExpand all lines: .github/workflows/pythonpackage.yml
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ jobs:
1919
python-version: ${{ matrix.python-version }}
2020
- name: Install dependencies
2121
run: |
22-
python -m pip install -U pip poetry
22+
python -m pip install -U pip poetry poethepoet
2323
poetry --version
24-
poetry install
24+
poetry install --only main,linters,test
2525
- name: Run tests and linters
2626
run: |
2727
git config --global user.email "action@github.com"
2828
git config --global user.name "GitHub Action"
29-
SKIP=no-commit-to-branch,commitizen-branch poetry run pre-commit run --all-files --hook-stage pre-push
29+
poetry ci
3030
shell: bash
3131
- name: Upload coverage to Codecov
3232
if: runner.os == 'Linux'

‎.github/workflows/pythonpublish.yml

Copy file name to clipboardExpand all lines: .github/workflows/pythonpublish.yml
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ jobs:
1919
python-version: "3.x"
2020
- name: Install dependencies
2121
run: |
22-
python -m pip install -U pip poetry mkdocs mkdocs-material
22+
python -m pip install -U pip poetry
2323
poetry --version
24-
poetry install
2524
- name: Publish
2625
env:
27-
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
28-
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29-
run: |
30-
./scripts/publish
26+
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
27+
POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
28+
run: poetry publish --build

‎.pre-commit-config.yaml

Copy file name to clipboardExpand all lines: .pre-commit-config.yaml
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ default_install_hook_types:
55

66
default_stages:
77
- pre-commit
8-
- pre-push
98

109
repos:
1110
- repo: meta
@@ -55,21 +54,19 @@ repos:
5554
- id: commitizen-branch
5655
stages:
5756
- post-commit
58-
- pre-push
5957

6058
- repo: local
6159
hooks:
6260
- id: format
63-
name: format
61+
name: Format
6462
language: system
6563
pass_filenames: false
66-
entry: ./scripts/format
64+
entry: poetry format
6765
types: [ python ]
6866

6967
- id: linter and test
70-
name: linter and test
68+
name: Linters
7169
language: system
7270
pass_filenames: false
73-
stages: [ pre-push ]
74-
entry: ./scripts/test
71+
entry: poetry lint
7572
types: [ python ]

‎docs/contributing.md

Copy file name to clipboardExpand all lines: docs/contributing.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ If you're a first-time contributor, you can check the issues with [good first is
1616
1. Fork [the repository](https://github.com/commitizen-tools/commitizen).
1717
2. Clone the repository from your GitHub.
1818
3. Setup development environment through [poetry](https://python-poetry.org/) (`poetry install`).
19-
4. Setup [pre-commit](https://pre-commit.com/) hook (`poetry run pre-commit install`)
19+
4. Setup [pre-commit](https://pre-commit.com/) hook (`poetry setup-pre-commit`)
2020
5. Check out a new branch and add your modification.
2121
6. Add test cases for all your changes.
2222
(We use [CodeCov](https://codecov.io/) to ensure our test coverage does not drop.)
2323
7. Use [commitizen](https://github.com/commitizen-tools/commitizen) to do git commit. We follow [conventional commits](https://www.conventionalcommits.org/).
24-
8. Run `./scripts/format` and `./scripts/test` to ensure you follow the coding style and the tests pass.
25-
9. Optionally, update the `./docs/README.md` or `docs/images/cli_help` (through running `scripts/gen_cli_help_screenshots.py`).
24+
8. Run `poetry all` to ensure you follow the coding style and the tests pass.
25+
9. Optionally, update the `./docs/README.md` or `docs/images/cli_help` (through running `poetry doc:screenshots`).
2626
9. **Do not** update the `CHANGELOG.md`, it will be automatically created after merging to `master`.
2727
10. **Do not** update the versions in the project, they will be automatically updated.
28-
10. If your changes are about documentation. Run `poetry run mkdocs serve` to serve documentation locally and check whether there is any warning or error.
28+
10. If your changes are about documentation. Run `poetry doc` to serve documentation locally and check whether there is any warning or error.
2929
11. Send a [pull request](https://github.com/commitizen-tools/commitizen/pulls) 🙏
3030

3131
## Use of GitHub Labels

‎pyproject.toml

Copy file name to clipboardExpand all lines: pyproject.toml
+54Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ version_scheme = "pep440"
9999
[tool.poetry]
100100
packages = [{ include = "commitizen" }, { include = "commitizen/py.typed" }]
101101

102+
[tool.poetry.requires-plugins]
103+
"poethepoet" = ">=0.32.2"
104+
102105
[tool.poetry.group.dev.dependencies]
103106
ipython = "^8.0"
104107

@@ -161,6 +164,9 @@ omit = [
161164

162165
[tool.pytest.ini_options]
163166
addopts = "--strict-markers"
167+
testpaths = [
168+
"tests/",
169+
]
164170

165171
[tool.ruff]
166172
line-length = 88
@@ -202,3 +208,51 @@ ignore_missing_imports = true
202208
skip = '.git*,*.svg,*.lock'
203209
check-hidden = true
204210
ignore-words-list = 'asend'
211+
212+
[tool.poe]
213+
poetry_command = ""
214+
215+
[tool.poe.tasks]
216+
format.help = "Format the code"
217+
format.sequence = [
218+
{cmd = "ruff check --fix commitizen tests"},
219+
{cmd = "ruff format commitizen tests"},
220+
]
221+
222+
lint.help = "Lint the code"
223+
lint.sequence = [
224+
{cmd = "ruff check commitizen/ tests/ --fix"},
225+
{cmd = "mypy commitizen/ tests/"},
226+
]
227+
228+
test.help = "Run the test suite"
229+
test.cmd = "pytest -n 3 --dist=loadfile"
230+
231+
cover.help = "Run the test suite with coverage"
232+
cover.ref = "test --cov-report term-missing --cov-report=xml:coverage.xml --cov=commitizen"
233+
234+
all.help = "Run all tasks"
235+
all.sequence = [
236+
"format",
237+
"lint",
238+
"cover",
239+
]
240+
241+
"doc:screenshots".help = "Render documentation screeenshots"
242+
"doc:screenshots".script = "scripts.gen_cli_help_screenshots:gen_cli_help_screenshots"
243+
244+
"doc:build".help = "Build the documentation"
245+
"doc:build".cmd = "mkdocs build"
246+
247+
doc.help = "Live documentation server"
248+
doc.cmd = "mkdocs serve"
249+
250+
ci.help = "Run all tasks in CI"
251+
ci.sequence = [
252+
{cmd="pre-commit run --all-files"},
253+
"cover",
254+
]
255+
ci.env = {SKIP = "no-commit-to-branch"}
256+
257+
setup-pre-commit.help = "Install pre-commit hooks"
258+
setup-pre-commit.cmd = "pre-commit install"

‎scripts/format

Copy file name to clipboardExpand all lines: scripts/format
-10Lines changed: 0 additions & 10 deletions
This file was deleted.

‎scripts/publish

Copy file name to clipboardExpand all lines: scripts/publish
-2Lines changed: 0 additions & 2 deletions
This file was deleted.

‎scripts/test

Copy file name to clipboardExpand all lines: scripts/test
-10Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.