Skip to content

Commit 22edfa1

Browse files
Update CI (#480)
1 parent 6570cb3 commit 22edfa1

File tree

14 files changed

+120
-102
lines changed

14 files changed

+120
-102
lines changed

.github/dependabot.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
version: 2
22
updates:
3-
- package-ecosystem: pip
4-
directory: "/"
5-
schedule:
6-
interval: daily
7-
open-pull-requests-limit: 10
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "monthly"

.github/workflows/ci.yml

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,15 @@ jobs:
2121
- name: Checkout
2222
uses: actions/checkout@v2
2323
- name: Setup Python
24-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v4
2525
with:
2626
python-version: 3.8
27-
- name: Cache PyPI
28-
uses: actions/cache@v2
29-
with:
30-
key: pip-lint-${{ hashFiles('requirements-dev.txt') }}
31-
path: ~/.cache/pip
32-
restore-keys: |
33-
pip-lint-
27+
cache: 'pip'
28+
cache-dependency-path: '**/requirements*.txt'
3429
- name: Pre-Commit hooks
35-
uses: pre-commit/action@v2.0.0
30+
uses: pre-commit/action@v3.0.0
3631
- name: Install dependencies
37-
uses: py-actions/py-dependency-install@v3.0.0
32+
uses: py-actions/py-dependency-install@v3
3833
with:
3934
path: requirements-dev.txt
4035
- name: Install itself
@@ -65,35 +60,25 @@ jobs:
6560
- name: Checkout
6661
uses: actions/checkout@v2
6762
- name: Setup Python ${{ matrix.pyver }}
68-
uses: actions/setup-python@v2
63+
uses: actions/setup-python@v4
6964
with:
7065
python-version: ${{ matrix.pyver }}
71-
- name: Get pip cache dir
72-
id: pip-cache
73-
run: |
74-
echo "::set-output name=dir::$(pip cache dir)" # - name: Cache
75-
- name: Cache PyPI
76-
uses: actions/cache@v2
77-
with:
78-
key: pip-ci-${{ runner.os }}-${{ matrix.pyver }}-${{ hashFiles('requirements-dev.txt') }}
79-
path: ${{ steps.pip-cache.outputs.dir }}
80-
restore-keys: |
81-
pip-ci-${{ runner.os }}-${{ matrix.pyver }}-
66+
cache: 'pip'
67+
cache-dependency-path: '**/requirements*.txt'
8268
- name: Install dependencies
83-
uses: py-actions/py-dependency-install@v3.0.0
69+
uses: py-actions/py-dependency-install@v3
8470
with:
8571
path: requirements-dev.txt
8672
- name: Run unittests
87-
run: pytest --cov=aiohttp_debugtoolbar --cov-report xml --cov-report html --cov-report term
73+
run: pytest --cov-report=xml tests
8874
env:
8975
COLOR: 'yes'
9076
- run: python -m coverage xml
9177
- name: Upload coverage
92-
uses: codecov/codecov-action@v1
78+
uses: codecov/codecov-action@v3
9379
with:
9480
file: ./coverage.xml
9581
flags: unit
96-
fail_ci_if_error: false
9782

9883
check: # This job does nothing and is only used for the branch protection
9984
if: always()
@@ -118,18 +103,23 @@ jobs:
118103
- name: Checkout
119104
uses: actions/checkout@v2
120105
- name: Setup Python
121-
uses: actions/setup-python@v2
106+
uses: actions/setup-python@v4
122107
with:
123108
python-version: 3.8
124109
- name: Install dependencies
125110
run:
126-
python -m pip install -U build pip wheel twine
111+
python -m pip install -U build setuptools wheel twine
127112
- name: Make dists
128113
run:
129114
python -m build
130-
- name: PyPI upload
131-
env:
132-
TWINE_USERNAME: __token__
133-
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
134-
run: |
135-
twine upload dist/*
115+
- name: Make Release
116+
uses: aio-libs/[email protected]
117+
with:
118+
changes_file: CHANGES.rst
119+
name: aiohttp-debugtoolbar
120+
version_file: aiohttp_debugtoolbar/__init__.py
121+
github_token: ${{ secrets.GITHUB_TOKEN }}
122+
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
123+
dist_dir: dist
124+
fix_issue_regex: "`#(\\d+) <https://github.com/aio-libs/aiohttp-debugtoolbar/issues/\\1>`"
125+
fix_issue_repl: "(#\\1)"

.github/workflows/codeql.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
schedule:
9+
- cron: "33 2 * * 2"
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ python ]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v2
31+
with:
32+
languages: ${{ matrix.language }}
33+
queries: +security-and-quality
34+
35+
- name: Autobuild
36+
uses: github/codeql-action/autobuild@v2
37+
38+
- name: Perform CodeQL Analysis
39+
uses: github/codeql-action/analyze@v2
40+
with:
41+
category: "/language:${{ matrix.language }}"

.pre-commit-config.yaml

Lines changed: 23 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,29 @@
11
repos:
2-
- repo: local
3-
hooks:
4-
- id: changelogs-rst
5-
name: changelog filenames
6-
language: fail
7-
entry: >-
8-
Changelog files must be named
9-
####.(bugfix|feature|removal|doc|misc)(.#)?(.rst)?
10-
exclude: >-
11-
^CHANGES/(\.TEMPLATE\.rst|\.gitignore|\d+\.(bugfix|feature|removal|doc|misc)(\.\d+)?(\.rst)?|README\.rst)$
12-
files: ^CHANGES/
13-
- id: changelogs-user-role
14-
name: Changelog files should use a non-broken :user:`name` role
15-
language: pygrep
16-
entry: :user:([^`]+`?|`[^`]+[\s,])
17-
pass_filenames: true
18-
types: [file, rst]
192
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: 'v4.0.1'
3+
rev: 'v4.4.0'
214
hooks:
225
- id: check-merge-conflict
236
- repo: https://github.com/asottile/yesqa
24-
rev: v1.3.0
7+
rev: v1.5.0
258
hooks:
269
- id: yesqa
2710
additional_dependencies:
28-
- flake8-bandit==3.0.0
29-
- flake8-bugbear==22.1.11
30-
- flake8-import-order==0.18.1
31-
- flake8-requirements==1.5.1
11+
- flake8-bandit==4.1.1
12+
- flake8-bugbear==23.7.10
13+
- flake8-import-order==0.18.2
14+
- flake8-requirements==1.7.8
3215
- repo: https://github.com/psf/black
33-
rev: '22.1.0'
16+
rev: '23.7.0'
3417
hooks:
3518
- id: black
36-
language_version: python3
19+
language_version: python3 # Should be a command that runs python
3720
- repo: https://github.com/pre-commit/pre-commit-hooks
38-
rev: 'v4.0.1'
21+
rev: 'v4.4.0'
3922
hooks:
4023
- id: end-of-file-fixer
4124
exclude: >-
4225
^docs/[^/]*\.svg$
4326
- id: requirements-txt-fixer
44-
exclude: >-
45-
^requirements/constraints[.]txt$
4627
- id: trailing-whitespace
4728
- id: file-contents-sorter
4829
files: |
@@ -55,37 +36,34 @@ repos:
5536
- id: check-xml
5637
- id: check-executables-have-shebangs
5738
- id: check-toml
39+
- id: check-xml
5840
- id: check-yaml
5941
- id: debug-statements
6042
- id: check-added-large-files
6143
- id: check-symlinks
62-
- id: fix-byte-order-marker
63-
- id: fix-encoding-pragma
64-
args: ['--remove']
44+
- id: debug-statements
6545
- id: detect-aws-credentials
6646
args: ['--allow-missing-credentials']
6747
- id: detect-private-key
6848
exclude: ^examples/
69-
- repo: https://github.com/asottile/pyupgrade
70-
rev: 'v2.29.0'
71-
hooks:
72-
- id: pyupgrade
73-
args: ['--py36-plus']
7449
- repo: https://github.com/PyCQA/flake8
75-
rev: '4.0.1'
50+
rev: '6.1.0'
7651
hooks:
7752
- id: flake8
78-
additional_dependencies:
79-
- flake8-bandit==3.0.0
80-
- flake8-bugbear==22.1.11
81-
- flake8-import-order==0.18.1
82-
- flake8-requirements==1.5.1
8353
exclude: "^docs/"
84-
- repo: git://github.com/Lucas-C/pre-commit-hooks-markup
54+
additional_dependencies:
55+
- flake8-bandit==4.1.1
56+
- flake8-bugbear==23.7.10
57+
- flake8-import-order==0.18.2
58+
- flake8-requirements==1.7.8
59+
- repo: https://github.com/asottile/pyupgrade
60+
rev: 'v3.10.1'
61+
hooks:
62+
- id: pyupgrade
63+
args: ['--py36-plus']
64+
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
8565
rev: v1.0.1
8666
hooks:
8767
- id: rst-linter
8868
files: >-
8969
^[^/]+[.]rst$
90-
exclude: >-
91-
^CHANGES\.rst$

aiohttp_debugtoolbar/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
if sys.version_info >= (3, 8):
77
from typing import Literal, TypedDict
88
else:
9-
from typing_extensions import Literal, TypedDict # noqa: I900
9+
from typing_extensions import Literal, TypedDict
1010

1111
import aiohttp_jinja2
1212
import jinja2

aiohttp_debugtoolbar/middlewares.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ async def middleware(request: web.Request, handler: Handler) -> web.StreamRespon
148148
# Intercept http redirect codes and display an html page with a
149149
# link to the target.
150150
if response.status in REDIRECT_CODES and getattr(response, "location", None):
151-
152151
context = {
153152
"redirect_to": response.location,
154153
"redirect_code": response.status,

aiohttp_debugtoolbar/panels/base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ def dom_id(self):
102102
Javascript to implement custom styles and actions."""
103103
return "pDebug%sPanel" % (self.name.replace(" ", ""))
104104

105-
async def process_response(self, response):
105+
async def process_response(self, response): # noqa: B027
106106
"""Receives the response generated by the request.
107107
108-
Override this method to track properties of the response."""
109-
pass
108+
Override this method to track properties of the response.
109+
"""
110110

111111
def wrap_handler(self, handler, context_switcher):
112112
"""May be overridden to monitor the entire lifecycle of the request.

aiohttp_debugtoolbar/panels/logger.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def emit(self, record):
2020

2121

2222
class LoggingPanel(DebugPanel):
23-
2423
name = "logging"
2524
template = "logger.jinja2"
2625
title = "Log Messages"

aiohttp_debugtoolbar/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ def replace_insensitive(string, target, replacement):
7070

7171

7272
def render(template_name, app, context, *, app_key=TEMPLATE_KEY, **kw):
73-
7473
lookup = app[app_key]
7574
template = lookup.get_template(template_name)
7675
c = context.copy()

examples/extra_panels/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async def basic_handler(request):
3939

4040
# testing for Redis
4141
if "redis" in request.app:
42-
with (await request.app["redis"]) as redis:
42+
with await request.app["redis"] as redis:
4343
await redis.set("TEST", "VAR", expire=5)
4444
assert b"VAR" == (await redis.get("TEST")) # noqa: S101
4545

0 commit comments

Comments
 (0)