Skip to content

Commit

Permalink
Test .whl files with build-and-inspect-python-package action
Browse files Browse the repository at this point in the history
  • Loading branch information
cvzi committed Sep 16, 2024
1 parent 872264d commit 3704676
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 36 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build & test whl

on: [push]

jobs:

build-package:
name: Build & verify package
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: hynek/build-and-inspect-python-package@v2
id: baipp

outputs:
python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }}

testwheel:
name: Test whl
runs-on: ubuntu-latest
needs: build-package
strategy:
max-parallel: 4
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
- "3.13-dev"
steps:

- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Extract source tarball
run: tar xf dist/*.tar.gz --strip-components=1
- name: Remove source code
run: rm -R emoji
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: python -Im pip install tox
- name: Run tox on wheel
run: python -Im tox run --installpkg dist/*.whl
40 changes: 25 additions & 15 deletions .github/workflows/pypipublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,35 @@ on:
types: [published]

jobs:
deploy:
build-package:
name: Build & verify package
runs-on: ubuntu-latest
permissions:
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
with:
attest-build-provenance-github: 'true'

deploy:
name: Publish to pypi.org
environment:
name: pypi
url: https://pypi.org/project/emoji/
runs-on: ubuntu-latest
needs: build-package
permissions:
id-token: write
attestations: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build wheel
- name: Build package
run: |
python -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.14
- name: Download package built by build-and-inspect-python-package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Upload package to PyPI
uses: pypa/gh-action-pypi-publish@v1.10.1
10 changes: 9 additions & 1 deletion .github/workflows/pythonTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ jobs:
strategy:
max-parallel: 8
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "pypy-3.10", "3.11", "3.12", "3.13-dev"]
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "pypy-3.10"
- "3.11"
- "3.12"
- "3.13-dev"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/updateGithubPages.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: updateGithubPages
name: Update GithubPages documentation

on:
workflow_dispatch:
Expand Down
49 changes: 30 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ description = "Emoji for Python"
readme = "README.rst"
requires-python = ">=3.7"
authors = [
{name = "Taehoon Kim", email = "carpedm20@gmail.com"},
{name = "Kevin Wurster", email = "wursterk@gmail.com"},
{ name = "Taehoon Kim", email = "carpedm20@gmail.com" },
{ name = "Kevin Wurster", email = "wursterk@gmail.com" },
]
keywords = ["emoji"]
classifiers = [
Expand All @@ -32,31 +32,26 @@ classifiers = [
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Multimedia :: Graphics :: Presentation",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed"
]
dependencies = [
"typing_extensions >= 4.7.0",
"Typing :: Typed",
]
dependencies = ["typing_extensions >= 4.7.0"]
dynamic = ["version"]

[project.urls]
homepage = "https://github.com/carpedm20/emoji/"
repository = "https://github.com/carpedm20/emoji/"

[project.optional-dependencies]
dev = [
"pytest>=7.4.4",
"coverage",
]
dev = ["pytest>=7.4.4", "coverage"]

[tool.setuptools.packages.find]
include = ["emoji*"]

[tool.setuptools.package-data]
emoji = ["py.typed"]
emoji = ["py.typed", "unicode_codes/emoji.json", "unicode_codes/emoji_*.json"]

[tool.setuptools.dynamic]
version = {attr = "emoji.__version__"}
version = { attr = "emoji.__version__" }

[tool.pytest.ini_options]
pythonpath = [".", "utils"]
Expand All @@ -68,12 +63,12 @@ pythonPlatform = "All"
typeCheckingMode = "strict"
extraPaths = ["utils"]
exclude = [
"**/__pycache__",
".git",
".venv",
"build",
"utils/gh-pages",
"utils/get_codes_from_unicode_emoji_data_files.py",
"**/__pycache__",
".git",
".venv",
"build",
"utils/gh-pages",
"utils/get_codes_from_unicode_emoji_data_files.py",
]


Expand All @@ -83,4 +78,20 @@ line-length = 88
quote-style = "single"
[tool.ruff.lint]
select = ["E4", "E7", "E9", "F", "B", "Q"]
ignore =["Q000", "Q003"]
ignore = ["Q000", "Q003"]

[tool.tox]
legacy_tox_ini = """
[tox]
minversion = 4.15.0
[testenv]
description = Run the tests with pytest
package = wheel
wheel_build_env = .pkg
changedir = tests
deps =
pytest>=6
commands =
pytest {tty:--color=yes} --basetemp="{envtmpdir}" {posargs}
"""

0 comments on commit 3704676

Please sign in to comment.