Skip to content

Commit 90a346f

Browse files
authored
Modernize CI and configuration (#59)
* Drop EOL Python versions and add 3.12, 3.13 * Add `pre-commit` configuration * Add `tox` configuration * Use standard `test` and `deploy` workflows * Move `CHANGELOG.rst` to its own file. * Add `RELEASE.rst`
1 parent 76c4d58 commit 90a346f

30 files changed

+550
-405
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Keep GitHub Actions up to date with GitHub's Dependabot...
2+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
3+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
4+
version: 2
5+
updates:
6+
- package-ecosystem: github-actions
7+
directory: /
8+
groups:
9+
github-actions:
10+
patterns:
11+
- "*" # Group all Actions updates into a single larger pull request
12+
schedule:
13+
interval: weekly

.github/workflows/build-package.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: deploy
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release version'
8+
required: true
9+
default: '1.2.3'
10+
11+
jobs:
12+
13+
package:
14+
runs-on: ubuntu-latest
15+
# Required by attest-build-provenance-github.
16+
permissions:
17+
id-token: write
18+
attestations: write
19+
env:
20+
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Build and Check Package
26+
uses: hynek/[email protected]
27+
with:
28+
attest-build-provenance-github: 'true'
29+
30+
31+
deploy:
32+
needs: package
33+
runs-on: ubuntu-latest
34+
environment: deploy
35+
permissions:
36+
id-token: write # For PyPI trusted publishers.
37+
contents: write # For tag and release notes.
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Download Package
43+
uses: actions/download-artifact@v4
44+
with:
45+
name: Packages
46+
path: dist
47+
48+
- name: Publish package to PyPI
49+
uses: pypa/[email protected]
50+
with:
51+
attestations: true
52+
53+
- name: Push tag
54+
run: |
55+
git config user.name "pytest bot"
56+
git config user.email "[email protected]"
57+
git tag --annotate --message=v${{ github.event.inputs.version }} v${{ github.event.inputs.version }} ${{ github.sha }}
58+
git push origin v${{ github.event.inputs.version }}
59+
60+
- name: GitHub Release
61+
uses: softprops/action-gh-release@v2
62+
with:
63+
body_path: scripts/latest-release-notes.md
64+
files: dist/*
65+
tag_name: v${{ github.event.inputs.version }}

.github/workflows/publish-package.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "test-me-*"
8+
9+
pull_request:
10+
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
18+
package:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
id-token: write
22+
attestations: write
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Build and Check Package
26+
uses: hynek/[email protected]
27+
28+
test:
29+
30+
needs: [package]
31+
32+
runs-on: ${{ matrix.os }}
33+
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
38+
os: [ubuntu-latest, windows-latest]
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Download Package
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: Packages
47+
path: dist
48+
49+
- name: Set up Python
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: ${{ matrix.python }}
53+
54+
- name: Install tox
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install tox
58+
59+
- name: Test
60+
shell: bash
61+
run: |
62+
tox run -e py --installpkg `find dist/*.tar.gz`

.pre-commit-config.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: rst
5+
name: rst
6+
entry: rst-lint --encoding utf-8
7+
files: ^(CHANGELOG.rst|README.rst|HOWTORELEASE.rst)$
8+
language: python
9+
additional_dependencies: [pygments, restructuredtext_lint]
10+
- repo: https://github.com/astral-sh/ruff-pre-commit
11+
rev: v0.3.3
12+
hooks:
13+
- id: ruff
14+
args: ["--fix"]
15+
- id: ruff-format

CHANGELOG.rst

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
--------------
3+
Changelog
4+
--------------
5+
6+
UNRELEASED
7+
++++++++++
8+
9+
* Dropped support for EOL Python versions and added support for Python 3.13.
10+
11+
v1.1.1 (2024-01-20)
12+
+++++++++++++++++++
13+
14+
* Fixes #54 - ``AttributeError`` when cacheprovider plugin disabled. Thanks @jhanm12
15+
16+
17+
v1.1.0 (2022-12-03)
18+
+++++++++++++++++++
19+
20+
* Fixes xdist support (thanks @matejsp)
21+
22+
23+
v1.0.4 (2018-11-30)
24+
+++++++++++++++++++
25+
26+
* Fixes issues with doctests reported in #36 - ``class``, ``package`` and ``module`` didn't work
27+
because ``DoctestItem`` doesn't have ``cls`` or ``module`` attributes. Thanks @tobywf.
28+
* Deprecate ``none`` bucket type. **Update**: this was a mistake, it will be kept for backwards compatibility.
29+
* With tox, run tests of pytest-random-order with both pytest 3 and 4.
30+
31+
v1.0.3 (2018-11-16)
32+
+++++++++++++++++++
33+
34+
* Fixes compatibility issues with pytest 4.0.0, works with pytest 3.0+ as before.
35+
* Tests included in the source distribution.
36+
37+
v1.0.0 (2018-10-20)
38+
+++++++++++++++++++
39+
40+
* Plugin no longer alters the test order by default. You will have to either 1) pass ``--random-order``,
41+
or ``--random-order-bucket=<bucket>``, or ``--random-order-seed=<seed>``, or
42+
2) edit your pytest configuration file and add one of these options
43+
there under ``addopts``, or 3) specify these flags in environment variable ``PYTEST_ADDOPTS``.
44+
* Python 3.5+ is required. If you want to use this plugin with Python 2.7, use v0.8.0 which is stable and fine
45+
if you are happy with it randomising the test order by default.
46+
* The name under which the plugin registers itself is changed from ``random-order`` (hyphen) to ``random_order``
47+
(underscore). This addresses the issue of consistency when disabling or enabling this plugin via the standard
48+
``-p`` flag. Previously, the plugin could be disabled by passing ``-p no:random-order`` yet re-enabled
49+
only by passing ``-p pytest_random_order.plugin``. Now they are ``-p no:random_order``
50+
to disable and ``-p random_order.plugin`` to enable (The ``.plugin`` bit, I think, is required because
51+
pytest probably thinks it's an unrelated thing to ``random_order`` and import it, yet without it it's the
52+
same thing so doesn't import it).
53+
54+
55+
v0.8.0
56+
++++++
57+
58+
* pytest cache plugin's ``--failed-first`` works now.

MANIFEST.in

Lines changed: 0 additions & 6 deletions
This file was deleted.

README.rst

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -228,58 +228,6 @@ pass undeservedly, you can disable it:
228228
Note that randomisation is disabled by default. By passing ``-p no:random_order`` you are stopping the plugin
229229
from being registered so its hooks won't be registered and its command line options won't appear in ``--help``.
230230

231-
--------------
232-
Changelog
233-
--------------
234-
235-
v1.1.1 (2024-01-20)
236-
+++++++++++++++++++
237-
238-
* Fixes #54 - ``AttributeError`` when cacheprovider plugin disabled. Thanks @jhanm12
239-
240-
241-
v1.1.0 (2022-12-03)
242-
+++++++++++++++++++
243-
244-
* Fixes xdist support (thanks @matejsp)
245-
246-
247-
v1.0.4 (2018-11-30)
248-
+++++++++++++++++++
249-
250-
* Fixes issues with doctests reported in #36 - ``class``, ``package`` and ``module`` didn't work
251-
because ``DoctestItem`` doesn't have ``cls`` or ``module`` attributes. Thanks @tobywf.
252-
* Deprecate ``none`` bucket type. **Update**: this was a mistake, it will be kept for backwards compatibility.
253-
* With tox, run tests of pytest-random-order with both pytest 3 and 4.
254-
255-
v1.0.3 (2018-11-16)
256-
+++++++++++++++++++
257-
258-
* Fixes compatibility issues with pytest 4.0.0, works with pytest 3.0+ as before.
259-
* Tests included in the source distribution.
260-
261-
v1.0.0 (2018-10-20)
262-
+++++++++++++++++++
263-
264-
* Plugin no longer alters the test order by default. You will have to either 1) pass ``--random-order``,
265-
or ``--random-order-bucket=<bucket>``, or ``--random-order-seed=<seed>``, or
266-
2) edit your pytest configuration file and add one of these options
267-
there under ``addopts``, or 3) specify these flags in environment variable ``PYTEST_ADDOPTS``.
268-
* Python 3.5+ is required. If you want to use this plugin with Python 2.7, use v0.8.0 which is stable and fine
269-
if you are happy with it randomising the test order by default.
270-
* The name under which the plugin registers itself is changed from ``random-order`` (hyphen) to ``random_order``
271-
(underscore). This addresses the issue of consistency when disabling or enabling this plugin via the standard
272-
``-p`` flag. Previously, the plugin could be disabled by passing ``-p no:random-order`` yet re-enabled
273-
only by passing ``-p pytest_random_order.plugin``. Now they are ``-p no:random_order``
274-
to disable and ``-p random_order.plugin`` to enable (The ``.plugin`` bit, I think, is required because
275-
pytest probably thinks it's an unrelated thing to ``random_order`` and import it, yet without it it's the
276-
same thing so doesn't import it).
277-
278-
279-
v0.8.0
280-
++++++
281-
282-
* pytest cache plugin's ``--failed-first`` works now.
283231

284232
-------
285233
Credits

RELEASING.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Here are the steps on how to make a new release.
2+
3+
1. Create a ``release-VERSION`` branch from ``upstream/main``.
4+
2. Update ``CHANGELOG.rst``.
5+
3. Push the branch to ``upstream``.
6+
4. Once all tests pass, start the ``deploy`` workflow manually or via:
7+
8+
```
9+
gh workflow run deploy.yml --repo pytest-dev/pytest-mock --ref release-VERSION -f version=VERSION
10+
```
11+
12+
5. Merge the PR.

0 commit comments

Comments
 (0)