Skip to content

Commit f2fb7e4

Browse files
authored
Update support matrix
Also fix a bunch of zizmor findings (pin actions, restrict permissions), and switch the tests to a "unified" job so it's less of a pain to manage the test matrix.
2 parents fdcddf1 + 0c54802 commit f2fb7e4

File tree

8 files changed

+63
-42
lines changed

8 files changed

+63
-42
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,32 @@ on:
44
push:
55
pull_request:
66

7+
permissions: {}
8+
79
jobs:
810
checks:
911
runs-on: ubuntu-latest
1012
steps:
1113
- name: Checkout working copy
12-
uses: actions/checkout@v4
14+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 6.0.1
1315
with:
1416
submodules: true
1517
fetch-depth: 0
1618
persist-credentials: false
1719
- name: ruff check
18-
uses: chartboost/ruff-action@v1
20+
uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # 3.5.1
21+
with:
22+
version: "latest"
1923
- name: ruff format
2024
if: always()
21-
uses: chartboost/ruff-action@v1
25+
uses: astral-sh/ruff-action@57714a7c8a2e59f32539362ba31877a1957dded1 # 3.5.1
2226
with:
23-
args: format --diff
27+
version: "latest"
28+
args: format --check --diff
2429
- name: Set up Python
2530
id: setup_python
2631
if: always()
27-
uses: actions/setup-python@v5
32+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # 6.1.0
2833
with:
2934
python-version: "3.x"
3035
- name: Install mypy
@@ -44,12 +49,12 @@ jobs:
4449

4550
steps:
4651
- name: Checkout working copy
47-
uses: actions/checkout@v4
52+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 6.0.1
4853
with:
4954
submodules: true
5055
persist-credentials: false
5156
- name: Set up Python
52-
uses: actions/setup-python@v5
57+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # 6.1.0
5358
with:
5459
python-version: "3.x"
5560
- name: Install dependency
@@ -60,14 +65,14 @@ jobs:
6065
run: |
6166
python -mbuild
6267
- name: Upload sdist
63-
uses: actions/upload-artifact@v4
68+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # 6.0.0
6469
with:
6570
name: sdist
6671
path: dist/*.tar.gz
6772
retention-days: 1
6873

6974
- name: Upload wheel
70-
uses: actions/upload-artifact@v4
75+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # 6.0.0
7176
with:
7277
name: wheel
7378
path: dist/*.whl
@@ -84,31 +89,31 @@ jobs:
8489
- sdist
8590
- source
8691
python-version:
87-
- "3.9"
8892
- "3.10"
8993
- "3.11"
9094
- "3.12"
9195
- "3.13"
92-
- "pypy-3.10"
96+
- "3.14"
97+
- "3.14t"
9398
- "pypy-3.11"
94-
- "graalpy-24"
99+
- "graalpy-25"
95100
include:
96101
- source: sdist
97102
artifact: dist/*.tar.gz
98103
- source: wheel
99104
artifact: dist/*.whl
100105
- opts: ""
101-
- python-version: graalpy-24
106+
- python-version: graalpy-25
102107
opts: "--experimental-options --engine.CompileOnly='~tregex re'"
103108
steps:
104109
- name: Checkout working copy
105-
uses: actions/checkout@v4
110+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 6.0.1
106111
with:
107112
submodules: true
108113
fetch-depth: 0
109114
persist-credentials: false
110115
- name: Set up Python ${{ matrix.python-version }}
111-
uses: actions/setup-python@v5
116+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # 6.1.0
112117
with:
113118
python-version: ${{ matrix.python-version }}
114119
allow-prereleases: true
@@ -132,11 +137,20 @@ jobs:
132137
- run: 'python -mpip install --only-binary :all: google-re2 || true'
133138
- name: download ${{ matrix.source }} artifact
134139
if: matrix.artifact
135-
uses: actions/download-artifact@v4
140+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # 7.0.0
136141
with:
137142
name: ${{ matrix.source }}
138143
path: dist/
139144
- name: install package in environment
140145
run: python -m pip install ${{ matrix.artifact || '.' }}
141146
- name: run tests
142147
run: python ${{ matrix.opts }} -m pytest -v -Werror -Wignore::ImportWarning --doctest-glob="*.rst" -ra
148+
# necessary to create a unified CI result and not have to update
149+
# branch protection rules every time the matrix gets updated
150+
results:
151+
name: "CI Results"
152+
needs: ["checks", "test"]
153+
runs-on: ubuntu-latest
154+
permissions: {}
155+
steps:
156+
- run: exit 0

.github/workflows/release-builtins.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Publish ua-parser builtins
22

33
run-name: Publish ${{ inputs.tag || 'master' }} to ${{ inputs.environment || 'pypy (scheduled)' }}
44

5+
permissions: {}
6+
57
on:
68
schedule:
79
# schedule a dev release on every 1st of the month, at 2034 UTC
@@ -23,13 +25,13 @@ jobs:
2325
outputs:
2426
release: ${{ steps.check.outputs.release }}
2527
steps:
26-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 6.0.1
2729
with:
2830
submodules: true
2931
fetch-depth: 0
3032
persist-credentials: false
3133
- name: Set up Python
32-
uses: actions/setup-python@v5
34+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # 6.1.0
3335
with:
3436
python-version: "3.x"
3537

@@ -70,7 +72,7 @@ jobs:
7072
mv ua-parser-builtins/dist .
7173
- name: Store the distribution packages
7274
if: ${{ steps.check.outputs.release == 'true' }}
73-
uses: actions/upload-artifact@v4
75+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # 6.0.0
7476
with:
7577
name: python-package-distributions
7678
path: dist/
@@ -90,12 +92,12 @@ jobs:
9092

9193
steps:
9294
- name: Download all the dists
93-
uses: actions/download-artifact@v4
95+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # 7.0.0
9496
with:
9597
name: python-package-distributions
9698
path: dist/
9799
- name: Publish
98-
uses: pypa/gh-action-pypi-publish@release/v1
100+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0
99101
with:
100102
repository-url: https://test.pypi.org/legacy/
101103
skip-existing: true
@@ -114,11 +116,11 @@ jobs:
114116

115117
steps:
116118
- name: Download all the dists
117-
uses: actions/download-artifact@v4
119+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # 7.0.0
118120
with:
119121
name: python-package-distributions
120122
path: dist/
121123
- name: Publish
122-
uses: pypa/gh-action-pypi-publish@release/v1
124+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0
123125
with:
124126
verbose: true

.github/workflows/release-main.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
release:
66
types: [created]
77

8+
permissions: {}
9+
810
env:
911
ENVNAME: ${{ github.event_name == 'release' && 'pypi' || 'testpypi' }}
1012

@@ -21,11 +23,11 @@ jobs:
2123

2224
steps:
2325
- name: Checkout working copy
24-
uses: actions/checkout@v4
26+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 6.0.1
2527
with:
2628
persist-credentials: false
2729
- name: Set up Python
28-
uses: actions/setup-python@v5
30+
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # 6.1.0
2931
with:
3032
python-version: "3.x"
3133
- name: Install dependency
@@ -36,15 +38,15 @@ jobs:
3638
run: python -mbuild
3739
- name: Publish to testpypi
3840
if: ${{ env.ENVNAME == 'testpypi' }}
39-
uses: pypa/gh-action-pypi-publish@release/v1 # zizmor: ignore[use-trusted-publishing]
41+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0
4042
with:
4143
repository-url: https://test.pypi.org/legacy/
4244
skip-existing: true
4345
verbose: true
4446
password: ${{ secrets.PUBLISH_TOKEN }}
4547
- name: Publish to pypi
4648
if: ${{ env.ENVNAME == 'pypi' }}
47-
uses: pypa/gh-action-pypi-publish@release/v1 # zizmor: ignore[use-trusted-publishing]
49+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # 1.13.0
4850
with:
4951
verbose: true
5052
password: ${{ secrets.PUBLISH_TOKEN }}

.github/workflows/zizmor.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
pull_request:
66

7+
permissions: {}
8+
79
jobs:
810
zizmor:
911
runs-on: ubuntu-latest
@@ -13,20 +15,20 @@ jobs:
1315

1416
steps:
1517
- name: Checkout repository
16-
uses: actions/checkout@v4
18+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 6.0.1
1719
with:
1820
persist-credentials: false
1921

2022
- name: Install the latest version of uv
21-
uses: astral-sh/setup-uv@v5
23+
uses: astral-sh/setup-uv@681c641aba71e4a1c380be3ab5e12ad51f415867 # 7.1.6
2224

2325
- name: Run zizmor
2426
run: uvx zizmor --format sarif . > results.sarif
2527
env:
2628
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2729

2830
- name: Upload SARIF file
29-
uses: github/codeql-action/upload-sarif@v3
31+
uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # 4.31.9
3032
with:
3133
sarif_file: results.sarif
3234
category: zizmor

.github/zizmor.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
rules:
2+
use-trusted-publishing:
3+
ignore:
4+
- release-main.yml # can't do that until pypi/support#6661

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "ua-parser"
77
description = "Python port of Browserscope's user agent parser"
88
version = "1.0.1"
99
readme = "README.rst"
10-
requires-python = ">=3.9"
10+
requires-python = ">=3.10"
1111
dependencies = ["ua-parser-builtins"]
1212

1313
license = {text = "Apache 2.0"}
@@ -33,11 +33,11 @@ classifiers = [
3333
"Topic :: Internet :: WWW/HTTP",
3434
"Topic :: Software Development :: Libraries :: Python Modules",
3535
"Programming Language :: Python",
36-
"Programming Language :: Python :: 3.9",
3736
"Programming Language :: Python :: 3.10",
3837
"Programming Language :: Python :: 3.11",
3938
"Programming Language :: Python :: 3.12",
4039
"Programming Language :: Python :: 3.13",
40+
"Programming Language :: Python :: 3.14",
4141
"Programming Language :: Python :: Implementation :: CPython",
4242
"Programming Language :: Python :: Implementation :: PyPy",
4343
"Programming Language :: Python :: Implementation :: GraalPy",
@@ -81,7 +81,7 @@ combine-as-imports = true
8181
"tests/test_legacy.py" = ["PT030"]
8282

8383
[tool.mypy]
84-
python_version = "3.9"
84+
python_version = "3.10"
8585
files = "src,tests"
8686

8787
# can't use strict because it's only global

tox.ini

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[tox]
22
min_version = 4.0
3-
env_list = py3{9,10,11,12,13}
4-
pypy{310,311}
5-
graalpy
3+
env_list = py3{10,11,12,13,14,14t}
4+
pypy{311}
5+
graalpy3{11,12}
66
check, format, typecheck
77

88
[testenv]
@@ -21,7 +21,7 @@ deps =
2121
commands =
2222
pytest -Werror --doctest-glob="*.rst" {posargs}
2323

24-
[testenv:py3{9,10,11,12,13}]
24+
[testenv:py3{10,11,12,13,14}]
2525
labels = test, cpy
2626
deps =
2727
pytest
@@ -30,9 +30,6 @@ deps =
3030
ua-parser-rs
3131
./ua-parser-builtins
3232

33-
[testenv:pypy{310,311}]
34-
labels = test, pypy
35-
3633
[testenv:check]
3734
labels = check
3835
package = skip

ua-parser-builtins/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "ua-parser-builtins"
77
description = "Precompiled rules for User Agent Parser"
88
readme = "README.md"
99
dependencies = []
10-
requires-python = ">=3.9"
10+
requires-python = ">=3.10"
1111
license = {text = "Apache 2.0"}
1212
urls = {repository = "https://github.com/ua-parser/uap-python"}
1313
dynamic = ["version"]
@@ -25,11 +25,11 @@ classifiers = [
2525
"Topic :: Internet :: WWW/HTTP",
2626
"Topic :: Software Development :: Libraries :: Python Modules",
2727
"Programming Language :: Python :: 3",
28-
"Programming Language :: Python :: 3.9",
2928
"Programming Language :: Python :: 3.10",
3029
"Programming Language :: Python :: 3.11",
3130
"Programming Language :: Python :: 3.12",
3231
"Programming Language :: Python :: 3.13",
32+
"Programming Language :: Python :: 3.14",
3333
"Programming Language :: Python :: Implementation :: CPython",
3434
"Programming Language :: Python :: Implementation :: PyPy",
3535
"Programming Language :: Python :: Implementation :: GraalPy",

0 commit comments

Comments
 (0)