diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 78ec0e4..ae0b102 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -10,8 +10,8 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2.10.2 + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 id: filter with: filters: | @@ -20,10 +20,10 @@ jobs: - 'tox.ini' - name: Setup Python - uses: actions/setup-python@v2.2.2 + uses: actions/setup-python@v5 if: steps.filter.outputs.python == 'true' with: - python-version: "3.12" + python-version: "3.13" - name: Install Dependencies if: steps.filter.outputs.python == 'true' @@ -44,17 +44,14 @@ jobs: strategy: matrix: toxenv: - - py311-unittest - - py312-unittest + - py313-unittest include: - - toxenv: py311-unittest - python-version: "3.11" - - toxenv: py312-unittest - python-version: "3.12" + - toxenv: py313-unittest + python-version: "3.13" steps: - - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2.10.2 + - uses: actions/checkout@v4 + - uses: dorny/paths-filter@v3 id: filter with: filters: | @@ -63,7 +60,7 @@ jobs: - 'tox.ini' - name: Set up Python - uses: actions/setup-python@v2.2.2 + uses: actions/setup-python@v5 if: steps.filter.outputs.python == 'true' with: python-version: "${{ matrix.python-version }}" @@ -79,14 +76,8 @@ jobs: run: | tox -e ${{ matrix.toxenv }} - - name: Dump Test Coverage - if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'py312-unittest' - run: | - pip install coverage - coverage xml - - name: Store Test Coverage - if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'py312-unittest' + if: steps.filter.outputs.python == 'true' && matrix.toxenv == 'py313-unittest' uses: actions/upload-artifact@v4 with: name: coverage @@ -101,10 +92,10 @@ jobs: - unittest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: dorny/paths-filter@v2.10.2 + - uses: dorny/paths-filter@v3 id: filter with: filters: | @@ -113,10 +104,10 @@ jobs: - 'tox.ini' - name: Setup Python - uses: actions/setup-python@v2.2.2 + uses: actions/setup-python@v5 if: steps.filter.outputs.python == 'true' with: - python-version: "3.12" + python-version: "3.13" - name: Install Coverage & diff_cover if: steps.filter.outputs.python == 'true' @@ -135,7 +126,7 @@ jobs: run: | coverage report -# - name: Check Coverage Diff -# if: steps.filter.outputs.python == 'true' -# run: | -# diff-cover ./coverage.xml --compare-branch=origin/main --fail-under=100 + - name: Coverage Diff + if: steps.filter.outputs.python == 'true' + run: | + diff-cover coverage.xml --compare-branch=origin/main || true diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..a93eee6 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +python 3.13.11 diff --git a/Dockerfile b/Dockerfile index 2e0842e..5b1bbb7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM python:alpine AS base +FROM python:3.13-alpine AS base RUN apk update && apk upgrade diff --git a/am_bot/cogs/starboard.py b/am_bot/cogs/starboard.py index ac3005d..5b68747 100644 --- a/am_bot/cogs/starboard.py +++ b/am_bot/cogs/starboard.py @@ -110,9 +110,11 @@ async def on_raw_reaction_add( "inline": False, } ], - "color": 3375061 - if self._last_message.embeds[0].color == 16769024 - else 16769024, + "color": ( + 3375061 + if self._last_message.embeds[0].color == 16769024 + else 16769024 + ), "timestamp": datetime.utcnow() .replace(tzinfo=timezone.utc) .isoformat(), diff --git a/pyproject.toml b/pyproject.toml index 1caf3e0..c1f4e10 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ name = "am_bot" authors = [ {name = "ARKModding", email = "no-reply@arkmodding.net"}, ] -requires-python = ">=3.8" +requires-python = ">=3.10" readme = "README.md" classifiers = [] dynamic = [ @@ -40,21 +40,24 @@ exclude_dirs = [ [tool.black] line-length = 79 -target-version = ['py312'] +target-version = ['py313'] include = '\.pyi?$' [tool.isort] profile = "black" line_length = 79 lines_after_imports = 2 -skip = [".tox", "venv"] +skip = [".tox", "venv", ".venv"] [tool.ruff] exclude = [ "venv", + ".venv", "__init__.py", ] line-length = 79 + +[tool.ruff.lint] select = [ "B", "C", @@ -63,6 +66,9 @@ select = [ "W", ] +[tool.coverage.run] +relative_files = true + [tool.setuptools.dynamic] dependencies = {file = ["requirements.txt"]} description = {file = ["README.md"]} diff --git a/tox.ini b/tox.ini index f31a11a..8336ddb 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] skipsdist=True # Run these envs when tox is invoked without -e -envlist=lint,py{38,39,310,311,312}-unittest +envlist=lint,py{310,311,312,313}-unittest [testenv] @@ -22,11 +22,10 @@ envlist=lint,py{38,39,310,311,312}-unittest recreate=False basepython= - py38: python3.8 - py39: python3.9 py310: python3.10 py311: python3.11 py312: python3.12 + py313: python3.13 deps= lint: {[lint-config]deps} @@ -56,7 +55,7 @@ deps= commands= black . --check isort --check-only --diff . - ruff . --no-fix + ruff check . --no-fix bandit -r am_bot @@ -74,6 +73,8 @@ deps= commands= coverage erase coverage run -m pytest {posargs} + coverage xml -o {toxinidir}/coverage.xml + coverage report [testenv:lint]