Skip to content

Commit dd1c723

Browse files
committed
Upgrade GitHub Actions workflows
1 parent 052f83a commit dd1c723

3 files changed

Lines changed: 35 additions & 43 deletions

File tree

.github/workflows/publish.yml

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,49 @@ on:
44
release:
55
types: [created]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
test:
912
runs-on: ubuntu-latest
1013
strategy:
1114
matrix:
12-
python-version: [3.6, 3.7, 3.8, 3.9]
15+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1316
steps:
14-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1518
- name: Set up Python ${{ matrix.python-version }}
16-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v6
1720
with:
1821
python-version: ${{ matrix.python-version }}
19-
- uses: actions/cache@v2
20-
name: Configure pip caching
21-
with:
22-
path: ~/.cache/pip
23-
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
24-
restore-keys: |
25-
${{ runner.os }}-pip-
22+
cache: pip
23+
cache-dependency-path: pyproject.toml
2624
- name: Install dependencies
2725
run: |
28-
pip install -e '.[test]'
26+
pip install '.[test]'
2927
- name: Run tests
3028
run: |
31-
pytest
29+
python -m pytest
3230
deploy:
3331
runs-on: ubuntu-latest
3432
needs: [test]
33+
environment: release
34+
permissions:
35+
id-token: write
3536
steps:
36-
- uses: actions/checkout@v2
37+
- uses: actions/checkout@v4
3738
- name: Set up Python
38-
uses: actions/setup-python@v2
39-
with:
40-
python-version: '3.9'
41-
- uses: actions/cache@v2
42-
name: Configure pip caching
39+
uses: actions/setup-python@v6
4340
with:
44-
path: ~/.cache/pip
45-
key: ${{ runner.os }}-publish-pip-${{ hashFiles('**/setup.py') }}
46-
restore-keys: |
47-
${{ runner.os }}-publish-pip-
41+
python-version: "3.12"
42+
cache: pip
43+
cache-dependency-path: pyproject.toml
4844
- name: Install dependencies
4945
run: |
50-
pip install setuptools wheel twine
51-
- name: Publish
52-
env:
53-
TWINE_USERNAME: __token__
54-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
46+
pip install setuptools wheel build
47+
- name: Build
5548
run: |
56-
python setup.py sdist bdist_wheel
57-
twine upload dist/*
49+
python -m build
50+
- name: Publish
51+
uses: pypa/gh-action-pypi-publish@release/v1
5852

.github/workflows/readme-toc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Check out repo
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v4
1717
- name: Update TOC
1818
run: npx markdown-toc README.md -i
1919
- name: Commit and push if README changed

.github/workflows/test.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
name: Test
22

3-
on: [push]
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
47

58
jobs:
69
test:
710
runs-on: ubuntu-latest
811
strategy:
912
matrix:
10-
python-version: [3.6, 3.7, 3.8, 3.9]
13+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1114
steps:
12-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v4
1316
- name: Set up Python ${{ matrix.python-version }}
14-
uses: actions/setup-python@v2
17+
uses: actions/setup-python@v6
1518
with:
1619
python-version: ${{ matrix.python-version }}
17-
- uses: actions/cache@v2
18-
name: Configure pip caching
19-
with:
20-
path: ~/.cache/pip
21-
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
22-
restore-keys: |
23-
${{ runner.os }}-pip-
20+
cache: pip
21+
cache-dependency-path: pyproject.toml
2422
- name: Install dependencies
2523
run: |
26-
pip install -e '.[test]'
24+
pip install '.[test]'
2725
- name: Run tests
2826
run: |
29-
pytest
27+
python -m pytest
3028

0 commit comments

Comments
 (0)