4
4
pull_request :
5
5
schedule : [{cron: '3 2 1 * *'}] # M H d m w (monthly at 2:03)
6
6
jobs :
7
- check :
8
- if : github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
9
- name : Check
10
- runs-on : ubuntu-latest
11
- steps :
12
- - uses : actions/checkout@v3
13
- - uses : actions/setup-python@v4
14
- with :
15
- python-version : ' 3.x'
16
- - name : Prepare cache
17
- run : echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
18
- - uses : actions/cache@v3
19
- with :
20
- path : ~/.cache/pre-commit
21
- key : pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
22
- - name : Dependencies
23
- run : pip install -U pre-commit
24
- - uses : reviewdog/action-setup@v1
25
- - if : github.event_name == 'push' || github.event_name == 'pull_request'
26
- name : Comment
27
- run : |
28
- if [[ $EVENT == pull_request ]]; then
29
- REPORTER=github-pr-review
30
- else
31
- REPORTER=github-check
32
- fi
33
- pre-commit run -a todo | reviewdog -efm="%f:%l: %m" -name=TODO -tee -reporter=$REPORTER -filter-mode nofilter
34
- pre-commit run -a flake8 | reviewdog -f=pep8 -name=flake8 -tee -reporter=$REPORTER -filter-mode nofilter
35
- env :
36
- REVIEWDOG_GITHUB_API_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37
- EVENT : ${{ github.event_name }}
38
- - name : Lint
39
- run : pre-commit run -a --show-diff-on-failure
40
7
test :
41
8
if : github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
42
9
name : py${{ matrix.python }}-${{ matrix.os }}
43
10
strategy :
44
11
matrix :
45
12
os : [ubuntu]
46
- python : [3.7, 3.8, 3.9, '3.10', 3.11]
13
+ python : [3.7, 3.8, 3.9, '3.10', 3.11, 3.12 ]
47
14
include :
48
- - os : macos
49
- python : 3.11
50
- - os : windows
51
- python : 3.11
15
+ - {os: macos, python: 3.12}
16
+ - {os: windows, python: 3.12}
52
17
runs-on : ${{ matrix.os }}-latest
53
- defaults :
54
- run :
55
- shell : bash
18
+ defaults : {run: {shell: bash}}
56
19
steps :
57
- - uses : actions/checkout@v3
58
- with :
59
- fetch-depth : 0
60
- - uses : actions/setup-python@v4
20
+ - uses : actions/checkout@v4
21
+ with : {fetch-depth: 0}
22
+ - uses : actions/setup-python@v5
61
23
with :
62
24
python-version : ${{ matrix.python }}
63
25
- name : Install
79
41
needs : test
80
42
runs-on : ubuntu-latest
81
43
steps :
82
- - uses : actions/setup-python@v4
44
+ - uses : actions/setup-python@v5
83
45
with :
84
46
python-version : ' 3.x'
85
47
- name : Coveralls Finished
@@ -90,13 +52,14 @@ jobs:
90
52
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
91
53
deploy :
92
54
name : Deploy
93
- needs : [check, test]
55
+ needs : test
94
56
runs-on : ubuntu-latest
57
+ environment : pypi
58
+ permissions : {contents: write, id-token: write, packages: write}
95
59
steps :
96
- - uses : actions/checkout@v3
97
- with :
98
- fetch-depth : 0
99
- - uses : actions/setup-python@v4
60
+ - uses : actions/checkout@v4
61
+ with : {fetch-depth: 0}
62
+ - uses : actions/setup-python@v5
100
63
with :
101
64
python-version : ' 3.x'
102
65
- name : Install
107
70
- id : dist
108
71
uses : casperdcl/deploy-pypi@v2
109
72
with :
110
- password : ${{ secrets.TWINE_PASSWORD }}
111
73
gpg_key : ${{ secrets.GPG_KEY }}
112
74
upload : ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
113
75
- id : collect_assets
0 commit comments