From e3165e251942fb6a303df822679618352429c5a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 5 Nov 2024 12:40:30 +0100 Subject: [PATCH] chore: Sync with WeblateOrg/meta --- .github/renovate.json | 17 ++++++++++++- .github/workflows/pre-commit.yml | 42 +++++++++++++++++++------------- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index dade2cd..2964a8d 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -2,6 +2,9 @@ "labels": [ "dependencies" ], + "lockFileMaintenance": { + "enabled": true + }, "rangeStrategy": "widen", "dependencyDashboard": true, "automerge": true, @@ -94,7 +97,7 @@ { "customType": "regex", "fileMatch": [ - "^Dockerfile$" + "^.*Dockerfile$" ], "matchStrings": [ "ENV WEBLATE_VERSION=(?.*?)\\n" @@ -103,6 +106,18 @@ "datasourceTemplate": "pypi", "versioningTemplate": "pep440" }, + { + "customType": "regex", + "fileMatch": [ + "^.*Dockerfile$" + ], + "matchStrings": [ + "ENV UV_VERSION=(?.*?)\\n" + ], + "depNameTemplate": "uv", + "datasourceTemplate": "pypi", + "versioningTemplate": "pep440" + }, { "customType": "regex", "fileMatch": [ diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index f7ab830..7d54ba8 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -29,32 +29,40 @@ jobs: - name: Setup Python uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - uses: astral-sh/setup-uv@v3 - - name: detect PEP 735 - id: pep735 + - name: detect method + id: detect run: | - if grep -q dependency-groups pyproject.toml ; then - echo "found=1" >> $GITHUB_OUTPUT + if test -f requirements-lint.txt ; then + echo "method=requirements" >> $GITHUB_OUTPUT + elif test -f pyproject.toml && grep -q dependency-groups pyproject.toml ; then + echo "method=pep735" >> $GITHUB_OUTPUT + elif test -f pyproject.toml && grep -q dependency-groups pyproject.toml ; then + echo "method=pyproject" >> $GITHUB_OUTPUT else - echo "found=0" >> $GITHUB_OUTPUT + echo "method=uvx" >> $GITHUB_OUTPUT fi - - name: pre-commit - if: ${{ steps.pep735.outputs.found == 1 }} + - name: pre-commit (PEP 735) + if: steps.detect.outputs.method == 'pep735' run: uv run --only-group pre-commit pre-commit run --all env: RUFF_OUTPUT_FORMAT: github REUSE_OUTPUT_FORMAT: github + - name: pre-commit (uvx) + if: steps.detect.outputs.method == 'uvx' + run: uvx pre-commit run --all + env: + RUFF_OUTPUT_FORMAT: github + REUSE_OUTPUT_FORMAT: github - name: Install dependencies - if: ${{ steps.pep735.outputs.found == 0 }} - run: | - if [ -f requirements-lint.txt ] ; then - uv pip install --system -r requirements-lint.txt - else - uv pip install --system $(sed -n 's/.*"\(pre-commit==\([^"]*\)\)".*/\1/p' pyproject.toml) - fi - - name: pre-commit - if: ${{ steps.pep735.outputs.found == 0 }} + if: steps.detect.outputs.method == 'requirements' + run: uv pip install --system -r requirements-lint.txt + - name: Install dependencies + if: steps.detect.outputs.method == 'pyproject' + run: uv pip install --system $(sed -n 's/.*"\(pre-commit==\([^"]*\)\)".*/\1/p' pyproject.toml) + - name: pre-commit (installed) + if: steps.detect.outputs.method == 'requirements' || steps.detect.outputs.method == 'pyproject' run: pre-commit run --all env: RUFF_OUTPUT_FORMAT: github