Skip to content

Commit

Permalink
move changelog&version check to pre-commit and separate CI job that s…
Browse files Browse the repository at this point in the history
…kips on skip-release label
  • Loading branch information
jakkdl committed Nov 17, 2024
1 parent 4fa719f commit 3c32b1a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,21 @@ jobs:
- name: Run tests
run: python -m tox -e flake8_7 -- --onlyfuzz --no-cov -n auto

check_release:
runs-on: ubuntu-latest
strategy:
fail-fast: false
if: ${{ ! contains(github.event.issue.labels.*.name, 'skip-release') }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
- name: Test changelog & version python tests/test_changelog_and_version.py --ensure-tag

release:
runs-on: ubuntu-latest
needs: [pyright, test]
if: github.repository == 'python-trio/flake8-async' && github.ref == 'refs/heads/main'
needs: [pyright, test, check_release]
if: github.repository == 'python-trio/flake8-async' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3
Expand All @@ -77,5 +88,4 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: |
python tests/test_changelog_and_version.py --ensure-tag
python -m build && twine upload --skip-existing dist/*
16 changes: 15 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ default_language_version:
python: python3.12
# pyright requires internet connection to run, which the pre-commit ci app doesn't have.
# it instead runs in a github action
# check-relase-changelog is run in CI to be able to access PR labels
ci:
skip: [pyright]
skip: [pyright, check-release-changelog]

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand Down Expand Up @@ -100,3 +101,16 @@ repos:
rev: v1.0.0
hooks:
- id: sphinx-lint

- repo: local
hooks:
- id: check-release-changelog
name: check-release-changelog
language: system
entry: python3 tests/check_changelog_and_version.py
files: flake8_async/__init__.py|docs/changelog.rst

- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
2 changes: 1 addition & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog

`CalVer, YY.month.patch <https://calver.org/>`_

24.10.2
24.10.3
=======
- :ref:`ASYNC101 <async101>` and :ref:`ASYNC119 <async119>` are now silenced for decorators in :ref:`transform-async-generator-decorators`
- :ref:`ASYNC102 <async102>` now also warns about ``await()`` inside ``__aexit__``.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ def update_version() -> None:


if __name__ == "__main__":
test_last_release_against_changelog()
test_version_increments_are_correct()

update_version()
if "--ensure-tag" in sys.argv:
ensure_tagged()

0 comments on commit 3c32b1a

Please sign in to comment.