Skip to content

Proposal: Dev & CI workflow improvement #1354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Please fill in the following content to let us know better about this change.
## Checklist

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

Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/docspublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install -U pip poetry
python -m pip install -U pip poetry poethepoet
poetry --version
poetry install
poetry install --only main,script
- name: Update CLI screenshots
run: |
poetry run python scripts/gen_cli_help_screenshots.py
poetry doc:screenshots
- name: Commit and push updated CLI screenshots
run: |
git config --global user.name "github-actions[bot]"
Expand Down Expand Up @@ -55,12 +55,14 @@ jobs:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install -U mkdocs mkdocs-material
python -m pip install -U pip poetry poethepoet
poetry --version
poetry install --no-root --only documentation
- name: Build docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python -m mkdocs build
poetry doc:build
- name: Generate Sponsors 💖
uses: JamesIves/github-sponsors-readme-action@v1
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install -U pip poetry
python -m pip install -U pip poetry poethepoet
poetry --version
poetry install
poetry install --only main,linters,test
- name: Run tests and linters
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
SKIP=no-commit-to-branch,commitizen-branch poetry run pre-commit run --all-files --hook-stage pre-push
poetry ci
shell: bash
- name: Upload coverage to Codecov
if: runner.os == 'Linux'
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ jobs:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install -U pip poetry mkdocs mkdocs-material
python -m pip install -U pip poetry
poetry --version
poetry install
- name: Publish
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
./scripts/publish
POETRY_HTTP_BASIC_PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably could migrate to trusted publisher in the future

POETRY_HTTP_BASIC_PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: poetry publish --build
11 changes: 4 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ default_install_hook_types:

default_stages:
- pre-commit
- pre-push

repos:
- repo: meta
Expand Down Expand Up @@ -55,21 +54,19 @@ repos:
- id: commitizen-branch
stages:
- post-commit
- pre-push

- repo: local
hooks:
- id: format
name: format
name: Format
language: system
pass_filenames: false
entry: ./scripts/format
entry: poetry format
types: [ python ]

- id: linter and test
name: linter and test
name: Linters
language: system
pass_filenames: false
stages: [ pre-push ]
entry: ./scripts/test
entry: poetry lint
types: [ python ]
8 changes: 4 additions & 4 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ If you're a first-time contributor, you can check the issues with [good first is
1. Fork [the repository](https://github.com/commitizen-tools/commitizen).
2. Clone the repository from your GitHub.
3. Setup development environment through [poetry](https://python-poetry.org/) (`poetry install`).
4. Setup [pre-commit](https://pre-commit.com/) hook (`poetry run pre-commit install`)
4. Setup [pre-commit](https://pre-commit.com/) hook (`poetry setup-pre-commit`)
5. Check out a new branch and add your modification.
6. Add test cases for all your changes.
(We use [CodeCov](https://codecov.io/) to ensure our test coverage does not drop.)
7. Use [commitizen](https://github.com/commitizen-tools/commitizen) to do git commit. We follow [conventional commits](https://www.conventionalcommits.org/).
8. Run `./scripts/format` and `./scripts/test` to ensure you follow the coding style and the tests pass.
9. Optionally, update the `./docs/README.md` or `docs/images/cli_help` (through running `scripts/gen_cli_help_screenshots.py`).
8. Run `poetry all` to ensure you follow the coding style and the tests pass.
9. Optionally, update the `./docs/README.md` or `docs/images/cli_help` (through running `poetry doc:screenshots`).
9. **Do not** update the `CHANGELOG.md`, it will be automatically created after merging to `master`.
10. **Do not** update the versions in the project, they will be automatically updated.
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.
10. If your changes are about documentation. Run `poetry doc` to serve documentation locally and check whether there is any warning or error.
11. Send a [pull request](https://github.com/commitizen-tools/commitizen/pulls) 🙏

## Use of GitHub Labels
Expand Down
130 changes: 116 additions & 14 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading