From b14cb1493854b3a61590a939b7718c16a9275db8 Mon Sep 17 00:00:00 2001 From: frgmt Date: Mon, 6 Jan 2025 11:18:01 +0900 Subject: [PATCH] Fix github workflow --- .github/workflows/lint-and-test.yml | 29 +++++++++++++---------------- pyproject.toml | 25 +++++++++++++++++++++++++ requirements.txt | 2 +- 3 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 pyproject.toml diff --git a/.github/workflows/lint-and-test.yml b/.github/workflows/lint-and-test.yml index 41d3553..3927de1 100644 --- a/.github/workflows/lint-and-test.yml +++ b/.github/workflows/lint-and-test.yml @@ -13,14 +13,11 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 black + pip install ruff black - - name: Lint with flake8 + - name: Lint with Ruff run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + ruff check . - name: Lint with Black run: | @@ -29,12 +26,11 @@ jobs: test: strategy: matrix: - python_version: 3.8, 3.9, '3.10'] - django_version: [3.2, 4.0, 4.1.0, 4.2.2] + python_version: ['3.10', 3.11, 3.12] + django_version: [3.2, 4.0, 4.1.0, 4.2.2, 5.0, 5.1.4] exclude: - # Ignore Django 4 on Python 3.7 - - python_version: 3.8 - django_version: 4.2.2 + - python_version: 3.12 + django_version: 3.2 runs-on: ubuntu-latest steps: @@ -49,7 +45,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -q Django==${{ matrix.django_version }} - pip install coverage + pip install coverage pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Run tests @@ -57,7 +53,8 @@ jobs: coverage3 run --source='./encrypted_fields' manage.py test coverage xml - - name: "Upload coverage to Codecov" - uses: codecov/codecov-action@v2 - with: - fail_ci_if_error: true +# - name: "Upload coverage to Artifact" +# uses: actions/upload-artifact@v4 +# with: +# name: coverage +# path: coverage.xml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..5754d10 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +################## +# ruff +################## +[tool.ruff] +fix = true +lint.fixable = ["ALL"] +lint.ignore = ["A003", "COM812", "D", "DJ008", "ERA001", "ISC001", "PLC2401", "PLC2403", "PT011", "RUF001", "S101", "S105", "S608", "SIM103", "TC001", "TC002", "TC003", "UP040"] +lint.select = ["ALL"] +lint.unfixable = ["ERA001", "F401"] +include = ["encrypted_fields/*.py", "package_test/*.py"] +target-version = "py312" + +################## +# mypy +################## +[tool.mypy] +mypy_path = "$MYPY_CONFIG_FILE_DIR" +packages = ["encrypted_fields"] +python_version = "3.12" + +strict = true +warn_unreachable = true +warn_no_return = true +ignore_missing_imports = true +disallow_untyped_decorators = false \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 7cf0930..de8bfbc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ cffi==1.14.6 cryptography==35.0.0 pycparser==2.20 -Django>=2.2 +Django>=3.2