From 8afbb791f00ade199d07a8bb19d430f889080c82 Mon Sep 17 00:00:00 2001 From: lighting9999 Date: Wed, 13 Aug 2025 13:13:06 +0800 Subject: [PATCH 1/5] Upgrade python workflows to Morden --- .github/workflows/lint_python.yml | 24 ----------------- .github/workflows/python.yml | 45 +++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 24 deletions(-) delete mode 100644 .github/workflows/lint_python.yml create mode 100644 .github/workflows/python.yml diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml deleted file mode 100644 index b90bd664f4a..00000000000 --- a/.github/workflows/lint_python.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: python -on: [pull_request, push] -jobs: - lint_python: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - run: pip install --upgrade pip wheel - - run: pip install bandit black codespell flake8 flake8-2020 flake8-bugbear - flake8-comprehensions isort mypy pytest pyupgrade safety - - run: bandit --recursive --skip B101 . || true # B101 is assert statements - - run: black --check . || true - - run: codespell || true # --ignore-words-list="" --skip="*.css,*.js,*.lock" - - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - - run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 - --show-source --statistics - - run: isort --check-only --profile black . || true - - run: pip install -r requirements.txt || pip install --editable . || true - - run: mkdir --parents --verbose .mypy_cache - - run: mypy --ignore-missing-imports --install-types --non-interactive . || true - - run: pytest . || pytest --doctest-modules . - - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true - - run: safety check diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml new file mode 100644 index 00000000000..754171418e7 --- /dev/null +++ b/.github/workflows/python.yml @@ -0,0 +1,45 @@ +name: Python + +on: [pull_request, push] + +jobs: + lint_test: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.13' + + - name: Cache Python dependencies + id: cache-pip + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-python-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-python- + + - name: Install dependencies and linters + run: | + python -m pip install --upgrade pip + pip install ruff bandit mypy pytest codespell -r requirements.txt || pip install --editable . + + - name: Run Ruff checks with ignored rules + run: | + ruff check . --ignore B904,B905,EM101,EXE001,G004,ISC001,PLC0415,PLC1901,PLW060,PLW1641,PLW2901,PT011,PT018,PT028,S101,S311,SIM905,SLF001,UP038 + + - name: Run Mypy type checks + run: mypy . --ignore-missing-imports || true + + - name: Run Codespell check + run: codespell || true + + - name: Run Bandit security scan + run: bandit -r . || true + + - name: Run Pytest tests + run: pytest \ No newline at end of file From 97a44c78bf1f4a22e22e8578cfac281effba2cdc Mon Sep 17 00:00:00 2001 From: lighting9999 Date: Wed, 13 Aug 2025 13:17:40 +0800 Subject: [PATCH 2/5] fix bugs --- .github/workflows/python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 754171418e7..57985cc25bf 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -26,7 +26,7 @@ jobs: - name: Install dependencies and linters run: | python -m pip install --upgrade pip - pip install ruff bandit mypy pytest codespell -r requirements.txt || pip install --editable . + pip install ruff bandit mypy pytest codespell - name: Run Ruff checks with ignored rules run: | From 5d4736fc45c17fb9366c2e9c6ed92ce959a1c5db Mon Sep 17 00:00:00 2001 From: lighting9999 Date: Wed, 13 Aug 2025 13:21:26 +0800 Subject: [PATCH 3/5] fix --- .github/workflows/python.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 57985cc25bf..efc4645b34a 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -23,11 +23,17 @@ jobs: restore-keys: | ${{ runner.os }}-python- - - name: Install dependencies and linters + - name: Install all dependencies and tools run: | python -m pip install --upgrade pip pip install ruff bandit mypy pytest codespell + - name: Run Codespell check + run: codespell || true + + - name: Run Bandit security scan + run: bandit -r . || true + - name: Run Ruff checks with ignored rules run: | ruff check . --ignore B904,B905,EM101,EXE001,G004,ISC001,PLC0415,PLC1901,PLW060,PLW1641,PLW2901,PT011,PT018,PT028,S101,S311,SIM905,SLF001,UP038 @@ -35,11 +41,5 @@ jobs: - name: Run Mypy type checks run: mypy . --ignore-missing-imports || true - - name: Run Codespell check - run: codespell || true - - - name: Run Bandit security scan - run: bandit -r . || true - - name: Run Pytest tests run: pytest \ No newline at end of file From e0ba3b72f4f70075dfa73ebb2d283a0f25ac1cd8 Mon Sep 17 00:00:00 2001 From: lighting9999 Date: Wed, 13 Aug 2025 13:24:04 +0800 Subject: [PATCH 4/5] fix --- .github/workflows/python.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index efc4645b34a..474131e2c94 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -1,4 +1,4 @@ -name: Python +name: Python Checks on: [pull_request, push] @@ -29,7 +29,7 @@ jobs: pip install ruff bandit mypy pytest codespell - name: Run Codespell check - run: codespell || true + run: codespell --skip "*.json,*.txt,*.pdf" || true - name: Run Bandit security scan run: bandit -r . || true From 67a34ef5d2e8c29bc36081973c3c7d3093fe72e9 Mon Sep 17 00:00:00 2001 From: lighting9999 Date: Wed, 13 Aug 2025 13:57:17 +0800 Subject: [PATCH 5/5] Update python.yml --- .github/workflows/python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 474131e2c94..1cf5c058cc7 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -3,7 +3,7 @@ name: Python Checks on: [pull_request, push] jobs: - lint_test: + Test: runs-on: ubuntu-latest steps: - name: Checkout repository