From 9cbca8c82b7a3c18bab03ff0e0358b948d303cc8 Mon Sep 17 00:00:00 2001 From: Jax Young Date: Thu, 6 Jun 2024 17:22:37 +0800 Subject: [PATCH] ci: add style & lint workflows --- .github/workflows/lint.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/style.yml | 21 +++++++++++++++++++++ README.md | 5 +++++ 3 files changed, 55 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/style.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..2463487 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,29 @@ +name: Lint + +on: [push] + +jobs: + check: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.10", "3.12"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{matrix.python-version}} + uses: actions/setup-python@v5 + with: + python-version: ${{matrix.python-version}} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pylint flake8 + - name: Analyze using Pylint + run: pylint src tests + - name: Analyze using Flake8 + run: flake8 src tests + ruff: + runs-on: ubuntu-latest + steps: + - name: Analyze using Ruff + uses: chartboost/ruff-action@v1 diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml new file mode 100644 index 0000000..8b07368 --- /dev/null +++ b/.github/workflows/style.yml @@ -0,0 +1,21 @@ +name: Style Check + +on: [push] + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '>=3.10' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install isort black + - name: Check using isort + run: isort --check src tests + - name: Check using black + run: black --check src tests diff --git a/README.md b/README.md index dca6524..3f373dc 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # batchlink [![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm-project.org) +[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort) +[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) +[![linting: pylint](https://img.shields.io/badge/linting-pylint-yellowgreen)](https://github.com/pylint-dev/pylint) +[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) +[![Flake8: checked](https://img.shields.io/badge/flake8-checked-blueviolet)](https://flake8.pycqa.org) Batch link files without modifying original files.