Skip to content

Commit

Permalink
Stop using deprecated packages in CI (#630)
Browse files Browse the repository at this point in the history
* Stop using deprecated packages in CI

pep517 has been deprecated for a long time and we don't need it anymore,
courtesy of importlib.metadata.

* News fragment

* Try a fake version to look at the output

* Silence pip version warnings

The default pip versions are good enought, nowadays.

* Add debug output & give better name

* Revert "Try a fake version to look at the output"

This reverts commit 3aadb6a.
  • Loading branch information
hynek authored Jul 31, 2024
1 parent 11f9297 commit 68a7a3b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ defaults:
run:
shell: bash

env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"

jobs:
build:
name: ${{ matrix.task.name}} - ${{ matrix.os.name }} ${{ matrix.python.name }}
Expand Down Expand Up @@ -250,18 +253,15 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pep517
python-version: 3.12

- name: Display structure of files to be pushed
run: ls --recursive dist/

- name: Check matched tag version and branch version - on tag
run: python admin/check_tag_version_match.py "${{ github.ref }}"
- name: Ensure tag and package versions match.
run: |
python -Im pip install dist/*.whl
python -I admin/check_tag_version_match.py "${{ github.ref }}"
- name: Publish to PyPI - on tag
uses: pypa/gh-action-pypi-publish@a56da0b891b3dc519c7ee3284aff1fad93cc8598
Expand Down
16 changes: 9 additions & 7 deletions admin/check_tag_version_match.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#
# Used during the release process to make sure that we release based on a
# tag that has the same version as the current twisted.__version.
# tag that has the same version as the current packaging metadata.
#
# Designed to be conditionally called inside GitHub Actions release job.
# Tags should use PEP440 version scheme.
#
# To be called as: admin/check_tag_version_match.py refs/tags/twisted-20.3.0
# To be called as: admin/check_tag_version_match.py refs/tags/20.3.0
#

import sys

import pep517.meta
from importlib import metadata


TAG_PREFIX = "refs/tags/"
Expand All @@ -18,7 +19,8 @@
print("No tag check requested.")
sys.exit(0)

branch_version = pep517.meta.load(".").version
pkg_version = metadata.version("towncrier")
print(f"Package version is {pkg_version}.")
run_version = sys.argv[1]

if not run_version.startswith(TAG_PREFIX):
Expand All @@ -27,9 +29,9 @@

run_version = run_version[len(TAG_PREFIX) :] # noqa: E203

if run_version != branch_version:
print(f"Branch is at '{branch_version}' while tag is '{run_version}'")
if run_version != pkg_version:
print(f"Package is at '{pkg_version}' while tag is '{run_version}'")
exit(1)

print(f"All good. Branch and tag versions match for '{branch_version}'.")
print(f"All good. Package and tag versions match for '{pkg_version}'.")
sys.exit(0)
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[build-system]
requires = [
"hatchling",
]
requires = ["hatchling"]
build-backend = "hatchling.build"


Expand Down
Empty file.

0 comments on commit 68a7a3b

Please sign in to comment.