Skip to content

Commit a74145a

Browse files
authored
Merge pull request #1 from khasbilegt/qa-github-action-setup
Create qa.yml
2 parents ec269af + 36a6831 commit a74145a

File tree

5 files changed

+175
-5
lines changed

5 files changed

+175
-5
lines changed

.github/workflows/qa.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Package QA
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.9", "3.10", "3.11", "3.12"]
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
- name: Set Up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Load cached Poetry installation
25+
id: cached-poetry
26+
uses: actions/cache@v3
27+
with:
28+
path: ~/.local
29+
key: poetry-0
30+
- name: Install and configure Poetry
31+
if: steps.cached-poetry.outputs.cache-hit != 'true'
32+
uses: snok/install-poetry@v1
33+
with:
34+
virtualenvs-in-project: true
35+
- name: Load cached venv
36+
id: cached-poetry-dependencies
37+
uses: actions/cache@v3
38+
with:
39+
path: .venv
40+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
41+
- name: Install dependencies
42+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
43+
run: poetry install --no-interaction --no-root
44+
- name: Run Ruff Linter
45+
run: poetry run ruff check --output-format=github .
46+
- name: Run Ruff Formatter
47+
run: poetry run ruff format --check .
48+
- name: Run mypy
49+
run: poetry run mypy qpay
50+
- name: Run tests
51+
run: poetry run pytest --cov=. --cov-report=xml
52+
- name: Upload coverage reports to Codecov
53+
uses: codecov/codecov-action@v4.0.1
54+
with:
55+
token: ${{ secrets.CODECOV_TOKEN }}
56+
slug: khasbilegt/qpay-python
57+
file: ./coverage.xml
58+
fail_ci_if_error: true

.pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ repos:
44
hooks:
55
- id: ruff
66
- id: ruff-format
7+
- repo: https://github.com/pre-commit/mirrors-mypy
8+
rev: v1.9.0
9+
hooks:
10+
- id: mypy
11+
args: ["--explicit-package-bases"]
12+
additional_dependencies: [types-requests, pydantic]

poetry.lock

+104-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = ["khasbilegt <khasbilegt.ts@gmail.com>"]
66
readme = "README.md"
77

88
[tool.poetry.dependencies]
9-
python = "^3.11"
9+
python = "^3.9"
1010
requests = "^2.31.0"
1111
pydantic = "^2.7.0"
1212

@@ -17,6 +17,8 @@ pre-commit = "^3.5.0"
1717
pytest = "^7.4.3"
1818
requests-mock = "^1.12.1"
1919
pytest-cov = "^5.0.0"
20+
mypy = "^1.9.0"
21+
types-requests = "^2.31.0.20240406"
2022

2123

2224

qpay/exceptions.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
from typing import Union
2+
13
import requests
24

35

46
class QPayException(Exception):
57
def __init__(
68
self,
79
message: str,
8-
request: requests.Request | requests.PreparedRequest | None,
9-
response: requests.Response | None,
10+
request: Union[requests.Request, requests.PreparedRequest, None],
11+
response: Union[requests.Response, None],
1012
) -> None:
1113
self.message = message
1214
self.request = request

0 commit comments

Comments
 (0)