Skip to content

Commit 606db09

Browse files
committed
update CIs
1 parent 689b5d4 commit 606db09

4 files changed

Lines changed: 51 additions & 46 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,50 @@
11
name: publish
22
concurrency:
33
group: ${{ github.workflow }}
4-
cancel-in-progress: true
54
on: # yamllint disable-line rule:truthy
65
release:
76
types: [published]
87

98
jobs:
10-
build:
9+
build-wheels:
1110
if: ${{ github.repository == 'Dandelion-Science/python-evdev' }}
12-
name: build py${{ matrix.python-version }}
13-
runs-on: codebuild-dandelion-linux-amd64-${{ github.run_id }}-${{ github.run_attempt }}
11+
name: wheels on ${{ matrix.os }}
12+
# evdev is Linux-only (needs <linux/input.h>); no macOS/Windows wheels are
13+
# possible. Native runners build their own arch (archs = "native"), no QEMU.
14+
runs-on: ${{ matrix.os }}
1415
strategy:
1516
fail-fast: false
1617
matrix:
17-
python-version: ["3.13", "3.13t", "3.14", "3.14t"]
18-
timeout-minutes: 15
19-
permissions:
20-
id-token: write
21-
contents: read
18+
os: [ubuntu-latest, ubuntu-24.04-arm]
19+
timeout-minutes: 30
2220
steps:
23-
- uses: aws-actions/configure-aws-credentials@v6
24-
with:
25-
aws-region: ${{ vars.AWS_REGION }}
26-
role-to-assume: ${{ vars.ARN_IAM_ROLE_GHA_CORE }}
2721
- uses: actions/checkout@v7
2822
with:
2923
fetch-depth: 0
30-
- uses: Dandelion-Science/github-actions/setup-uv@main
31-
with:
32-
python-version: ${{ matrix.python-version }}
33-
- run: uv build --wheel
24+
- uses: pypa/cibuildwheel@v4.1.0
3425
- uses: actions/upload-artifact@v4
3526
with:
36-
name: dist-${{ matrix.python-version }}
37-
path: dist/
27+
name: cibw-wheels-${{ matrix.os }}
28+
path: ./wheelhouse/*.whl
3829

3930
build-sdist:
4031
if: ${{ github.repository == 'Dandelion-Science/python-evdev' }}
41-
runs-on: codebuild-dandelion-linux-arm64-${{ github.run_id }}-${{ github.run_attempt }}
32+
runs-on: ubuntu-slim
4233
timeout-minutes: 15
43-
permissions:
44-
id-token: write
45-
contents: read
4634
steps:
47-
- uses: aws-actions/configure-aws-credentials@v6
48-
with:
49-
aws-region: ${{ vars.AWS_REGION }}
50-
role-to-assume: ${{ vars.ARN_IAM_ROLE_GHA_CORE }}
5135
- uses: actions/checkout@v7
5236
with:
5337
fetch-depth: 0
54-
- uses: Dandelion-Science/github-actions/setup-uv@main
38+
- uses: astral-sh/setup-uv@v7
5539
- run: uv build --sdist
5640
- uses: actions/upload-artifact@v4
5741
with:
58-
name: dist-sdist
59-
path: dist/
42+
name: cibw-sdist
43+
path: dist/*.tar.gz
6044

6145
publish:
62-
if: ${{ github.repository == 'Dandelion-Science/python-evdev' }}
63-
needs: [build, build-sdist]
64-
runs-on: codebuild-dandelion-linux-arm64-${{ github.run_id }}-${{ github.run_attempt }}
46+
needs: [build-wheels, build-sdist]
47+
runs-on: ubuntu-slim
6548
timeout-minutes: 15
6649
permissions:
6750
id-token: write
@@ -74,6 +57,7 @@ jobs:
7457
- uses: actions/download-artifact@v4
7558
with:
7659
path: dist
60+
pattern: cibw-*
7761
merge-multiple: true
7862
- uses: softprops/action-gh-release@v3
7963
with:
@@ -92,4 +76,4 @@ jobs:
9276
env:
9377
UV_PUBLISH_USERNAME: aws
9478
UV_PUBLISH_PASSWORD: ${{ env.AWS_CODEARTIFACT_TOKEN }}
95-
UV_PUBLISH_URL: ${{ vars.CODEARTIFACT_DANDELION_PYPI_REPOSITORY_URL }}
79+
UV_PUBLISH_URL: ${{ vars.CODEARTIFACT_PYPI_STORE_REPOSITORY_URL }}

.github/workflows/pytest.yaml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,23 @@ jobs:
1212
pytest:
1313
if: ${{ !cancelled() && github.repository == 'Dandelion-Science/python-evdev' && (github.event_name != 'pull_request' || github.event.pull_request.draft == false) }}
1414
name: py${{ matrix.python-version }}
15-
runs-on: codebuild-dandelion-linux-arm64-${{ github.run_id }}-${{ github.run_attempt }}
15+
runs-on: ubuntu-latest
1616
strategy:
1717
fail-fast: false
1818
matrix:
1919
python-version: ["3.13", "3.13t", "3.14", "3.14t"]
2020
timeout-minutes: 30
21-
permissions:
22-
id-token: write
23-
contents: read
2421
steps:
25-
- uses: aws-actions/configure-aws-credentials@v6
26-
with:
27-
aws-region: ${{ vars.AWS_REGION }}
28-
role-to-assume: ${{ vars.ARN_IAM_ROLE_GHA_CORE }}
2922
- uses: actions/checkout@v7
3023
with:
3124
fetch-depth: 0
32-
- uses: Dandelion-Science/github-actions/setup-uv@main
25+
- uses: astral-sh/setup-uv@v7
3326
with:
3427
activate-environment: true
3528
python-version: ${{ matrix.python-version }}
3629
- run: uv sync -q --no-default-groups --group test
37-
- run: pytest tests/test_ecodes.py tests/test_events.py tests/test_util.py
30+
# test_uinput.py needs root (opens /dev/uinput) and does not skip without it,
31+
# so the rest of the suite runs as the normal user and uinput runs under sudo.
32+
- run: pytest tests --ignore=tests/test_uinput.py
33+
- run: sudo modprobe uinput
3834
- run: sudo .venv/bin/pytest tests/test_uinput.py

pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,25 @@ line-length = 120
3737
[tool.ruff.lint]
3838
ignore = ["E265", "E241", "F403", "F401", "E401", "E731"]
3939

40+
[tool.cibuildwheel]
41+
# evdev is Linux-only (needs <linux/input.h>): no macOS/Windows wheels exist.
42+
# Build CPython 3.11-3.14 incl. the free-threaded 3.13t/3.14t builds; glibc only
43+
# (musllinux skipped), CPython only (no PyPy).
44+
build = ["cp311-*", "cp312-*", "cp313-*", "cp314-*", "cp313t-*", "cp314t-*"]
45+
enable = ["cpython-freethreading"]
46+
skip = ["*-musllinux*", "pp*"]
47+
archs = "native"
48+
build-frontend = "build[uv]"
49+
# Smoke-test that the wheel imports and every compiled extension loads.
50+
test-command = "python -c \"import evdev, evdev.ecodes, evdev._input, evdev._uinput, evdev._ecodes\""
51+
52+
[tool.cibuildwheel.linux]
53+
# manylinux images are glibc/AlmaLinux based and normally ship kernel-headers
54+
# (pulled in by glibc-devel), but evdev's build hard-fails without <linux/input.h>;
55+
# ensure they are present. No-op when already installed.
56+
before-all = "yum install -y kernel-headers || true"
57+
repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel}"
58+
4059
[tool.bumpversion]
4160
current_version = "1.9.3"
4261
commit = true

tests/test_free_threaded.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@
55
import pytest
66

77

8-
def _is_freethreaded_build():
8+
def _is_freethreaded_build() -> bool:
99
import sysconfig
10+
1011
return bool(sysconfig.get_config_var("Py_GIL_DISABLED"))
1112

1213

1314
@pytest.mark.skipif(not _is_freethreaded_build(), reason="requires free-threaded Python build")
1415
def test_evdev_does_not_reenable_gil():
16+
# Run with PYTHON_GIL unset (not 0): PYTHON_GIL=0 force-disables the GIL
17+
# regardless of the module, which would make this pass even for a C extension
18+
# that has not declared Py_MOD_GIL_NOT_USED. We want the default behavior so
19+
# importing a non-free-threaded extension actually re-enables the GIL and fails.
20+
env = {k: v for k, v in os.environ.items() if k != "PYTHON_GIL"}
1521
result = subprocess.run(
1622
[sys.executable, "-c", "import sys; import evdev; assert not sys._is_gil_enabled()"],
1723
capture_output=True,
1824
text=True,
19-
env={**os.environ, "PYTHON_GIL": "0"},
25+
env=env,
2026
)
2127
assert result.returncode == 0, f"evdev re-enabled the GIL:\n{result.stderr}"

0 commit comments

Comments
 (0)