From 80ab8c108d90917016279de8610529b1ef583667 Mon Sep 17 00:00:00 2001 From: David Barnett Date: Fri, 23 Aug 2024 15:10:27 -0600 Subject: [PATCH 1/2] Tooling: drop flake8, configure ruff and editorconfig --- .editorconfig | 6 ++++++ pyproject.toml | 16 ++++++++++------ setup.cfg | 9 --------- tox.ini | 4 ++-- 4 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 .editorconfig delete mode 100644 setup.cfg diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e65b127 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,6 @@ +root = true + +[*.py] +indent_style = space +indent_size = 4 +max_line_length = 80 diff --git a/pyproject.toml b/pyproject.toml index c788815..efe71ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,12 +52,16 @@ gcalcli = "gcalcli.cli:main" [tool.distutils.bdist_wheel] universal = true -[tool.isort] -profile = "google" -force_single_line = false -float_to_top = true -combine_star = true -py_version = 3 +[tool.ruff] +line-length = 80 + +[tool.ruff.lint] +# Enable Errors, Warnings, Flakes +select = ["E", "W", "F"] + +[tool.ruff.format] +# Permit mixed quote style, project currently uses a mix of both. +quote-style = "preserve" [[tool.mypy.overrides]] module = ["gcalcli"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6eb7126..0000000 --- a/setup.cfg +++ /dev/null @@ -1,9 +0,0 @@ -[flake8] -import-order-style = google -exclude = - .git, - __pycache__, - venv, - .env, - .tox, - .venv diff --git a/tox.ini b/tox.ini index 34afb90..78d1675 100644 --- a/tox.ini +++ b/tox.ini @@ -6,9 +6,9 @@ usedevelop=true deps = pytest pytest-cov coverage - flake8 + ruff vobject commands=py.test -vv --cov=./gcalcli --pyargs tests {posargs} coverage html - flake8 + ruff check From 7f43adf3a95c9d707ab7de90646dd8411dba241d Mon Sep 17 00:00:00 2001 From: David Barnett Date: Fri, 23 Aug 2024 17:17:00 -0600 Subject: [PATCH 2/2] Tooling(GH Actions): Define action to run tox tests/linters --- .editorconfig | 3 +++ .github/workflows/tests.yml | 42 +++++++++++++++++++++++++++++++++++++ tox.ini | 8 +++++++ 3 files changed, 53 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.editorconfig b/.editorconfig index e65b127..3f3789f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,3 +4,6 @@ root = true indent_style = space indent_size = 4 max_line_length = 80 + +[*.{yml,yaml}] +indent_size = 2 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..3c775ec --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,42 @@ +name: Tests (tox) + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + test: + name: test with ${{ matrix.py }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + py: + - "3.12" + - "3.11" + - "3.10" + - "3.9" + - "3.8" + os: + - ubuntu-latest + - macos-latest + - windows-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Setup python for test ${{ matrix.py }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.py }} + - name: Install tox + run: python -m pip install tox-gh>=1.2 + - name: Setup test suite + run: tox -vv --notest + - name: Run test suite + run: tox --skip-pkg-install diff --git a/tox.ini b/tox.ini index 78d1675..7fb4b71 100644 --- a/tox.ini +++ b/tox.ini @@ -12,3 +12,11 @@ deps = pytest commands=py.test -vv --cov=./gcalcli --pyargs tests {posargs} coverage html ruff check + +[gh] +python = + 3.12 = py312, type, lint + 3.11 = py311 + 3.10 = py310 + 3.9 = py39 + 3.8 = py38