44 pull_request :
55 schedule : [{cron: '3 2 1 * *'}] # M H d m w (monthly at 2:03)
66jobs :
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
407 test :
418 if : github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
429 name : py${{ matrix.python }}-${{ matrix.os }}
4310 strategy :
4411 matrix :
4512 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 ]
4714 include :
48- - os : macos
49- python : 3.11
50- - os : windows
51- python : 3.11
52- runs-on : ${{ matrix.os }}-latest
53- defaults :
54- run :
55- shell : bash
15+ - {os: macos, python: 3.12}
16+ - {os: windows, python: 3.12}
17+ runs-on : ${{ matrix.os }}-${{ matrix.python == 3.7 && '22.04' || 'latest' }}
18+ defaults : {run: {shell: bash}}
5619 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
6123 with :
6224 python-version : ${{ matrix.python }}
6325 - name : Install
@@ -74,13 +36,12 @@ jobs:
7436 COVERALLS_REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7537 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7638 finish :
77- if : github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
7839 name : Coverage
7940 continue-on-error : ${{ github.event_name != 'push' }}
8041 needs : test
8142 runs-on : ubuntu-latest
8243 steps :
83- - uses : actions/setup-python@v4
44+ - uses : actions/setup-python@v5
8445 with :
8546 python-version : ' 3.x'
8647 - name : Coveralls Finished
@@ -90,20 +51,20 @@ jobs:
9051 env :
9152 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
9253 deploy :
93- needs : [check, test]
54+ needs : test
9455 runs-on : ubuntu-latest
56+ environment : pypi
57+ permissions : {contents: write, id-token: write, packages: write}
9558 steps :
96- - uses : actions/checkout@v3
97- with :
98- fetch-depth : 0
99- - uses : actions/setup-python@v4
59+ - uses : actions/checkout@v4
60+ with : {fetch-depth: 0}
61+ - uses : actions/setup-python@v5
10062 with :
10163 python-version : ' 3.x'
10264 - id : dist
10365 uses : casperdcl/deploy-pypi@v2
10466 with :
10567 build : true
106- password : ${{ secrets.PYPI_TOKEN }}
10768 gpg_key : ${{ secrets.GPG_KEY }}
10869 upload : ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
10970 - if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
0 commit comments