Skip to content

Commit 0d25087

Browse files
committed
Upgrade GitHub Actions workflows
Run against modern Python versions
1 parent f1a7e28 commit 0d25087

File tree

2 files changed

+47
-33
lines changed

2 files changed

+47
-33
lines changed

.github/workflows/publish.yml

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

7+
permissions:
8+
contents: read
9+
710
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python ${{ matrix.python-version }}
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
cache: pip
23+
cache-dependency-path: setup.py
24+
- name: Install dependencies
25+
run: |
26+
pip install '.[test]'
27+
- name: Run tests
28+
run: |
29+
pytest
830
deploy:
931
runs-on: ubuntu-latest
32+
needs: [test]
33+
environment: release
34+
permissions:
35+
id-token: write
1036
steps:
11-
- uses: actions/checkout@v2
37+
- uses: actions/checkout@v4
1238
- name: Set up Python
13-
uses: actions/setup-python@v2
14-
with:
15-
python-version: '3.8'
16-
- uses: actions/cache@v2
17-
name: Configure pip caching
39+
uses: actions/setup-python@v5
1840
with:
19-
path: ~/.cache/pip
20-
key: ${{ runner.os }}-publish-pip-${{ hashFiles('**/setup.py') }}
21-
restore-keys: |
22-
${{ runner.os }}-publish-pip-
41+
python-version: "3.12"
42+
cache: pip
43+
cache-dependency-path: setup.py
2344
- name: Install dependencies
2445
run: |
25-
pip install -e '.[test]'
26-
pip install setuptools wheel twine
27-
- name: Run tests
28-
run: pytest
29-
- name: Publish
30-
if: success()
31-
env:
32-
TWINE_USERNAME: __token__
33-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
46+
pip install setuptools wheel build
47+
- name: Build
3448
run: |
35-
python setup.py sdist bdist_wheel
36-
twine upload dist/*
49+
python -m build
50+
- name: Publish
51+
uses: pypa/gh-action-pypi-publish@release/v1
3752

.github/workflows/test.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
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]
13+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
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@v5
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: setup.py
2422
- name: Install dependencies
2523
run: |
26-
pip install -e '.[test]'
24+
pip install '.[test]'
2725
- name: Run tests
2826
run: |
2927
pytest --cov-fail-under=100 --cov asgi_csrf
@@ -32,3 +30,4 @@ jobs:
3230
if: always()
3331
env:
3432
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
33+

0 commit comments

Comments
 (0)