diff --git a/.github/workflows/lua.yaml b/.github/workflows/lua.yaml
index 89fdd02..fec2d26 100644
--- a/.github/workflows/lua.yaml
+++ b/.github/workflows/lua.yaml
@@ -53,30 +53,6 @@ jobs:
nvim --version
make luatest
- stylua:
- name: Check Lua style
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
- - name: Install stylua
- uses: baptiste0928/cargo-install@v3
- with:
- crate: stylua
- features: lua54
- - run: stylua --version
- - run: stylua --color always --check ./lua/ ./plugin/ ./tests/
-
- luacheck:
- name: Lint Lua
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
- - name: Luacheck linter
- uses: lunarmodules/luacheck@cc089e3f65acdd1ef8716cc73a3eca24a6b845e4 # ratchet:lunarmodules/luacheck@v1
- with:
- args: ./lua/
-
typecheck:
name: Typecheck
runs-on: ubuntu-latest
diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml
new file mode 100644
index 0000000..b90dba6
--- /dev/null
+++ b/.github/workflows/pre-commit.yaml
@@ -0,0 +1,38 @@
+name: pre-commit
+
+on:
+ pull_request:
+ types: [labeled, opened, reopened, synchronize]
+ push:
+ branches: [main, test-me-*]
+
+jobs:
+ pre-commit:
+ if: "github.event.action != 'labeled' || github.event.label.name == 'pre-commit ci run'"
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - run: gh pr edit ${{ github.event.number }} --remove-label 'pre-commit ci run'
+ if: github.event.action == 'labeled' && github.event.label.name == 'pre-commit ci run'
+ env:
+ GH_TOKEN: ${{ github.token }}
+ - uses: actions/setup-python@v3
+ with:
+ python-version: '3.11'
+ - name: Install uv
+ uses: astral-sh/setup-uv@v5
+ - run: |
+ uv venv
+ source .venv/bin/activate
+ uv pip install -r py/rag-service/requirements.txt
+ - uses: leafo/gh-actions-lua@v11
+ - uses: leafo/gh-actions-luarocks@v5
+ - run: luarocks install luacheck
+ - name: Install stylua from crates.io
+ uses: baptiste0928/cargo-install@v3
+ with:
+ crate: stylua
+ args: --features lua54
+ - uses: pre-commit/action@v3.0.1
+ - uses: pre-commit-ci/lite-action@v1.1.0
+ if: always()
diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml
deleted file mode 100644
index ff4dea8..0000000
--- a/.github/workflows/python.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-name: Python
-
-on:
- push:
- branches:
- - main
- paths:
- - '**/*.py'
- - '.github/workflows/python.yaml'
- pull_request:
- branches:
- - main
- paths:
- - '**/*.py'
- - '.github/workflows/python.yaml'
-
-jobs:
- pre-commit:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-python@v3
- with:
- python-version: '3.11'
- - run: |
- python -m venv .venv
- source .venv/bin/activate
- pip install -r py/rag-service/requirements.txt
- - uses: pre-commit/action@v3.0.1
- with:
- extra_args: --files $(find ./py -type f -name "*.py")
diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml
index 36406b1..4c3519c 100644
--- a/.github/workflows/rust.yaml
+++ b/.github/workflows/rust.yaml
@@ -29,27 +29,3 @@ jobs:
components: clippy, rustfmt
- name: Run rust tests
run: cargo test --features luajit
- style:
- name: Check Rust style
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
- - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # ratchet:Swatinem/rust-cache@v2
- - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # ratchet:dtolnay/rust-toolchain@master
- with:
- toolchain: stable
- components: clippy, rustfmt
- - name: Run rustfmt
- run: make ruststylecheck
- lint:
- name: Lint Rust
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
- - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # ratchet:Swatinem/rust-cache@v2
- - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # ratchet:dtolnay/rust-toolchain@master
- with:
- toolchain: "1.85.0"
- components: clippy, rustfmt
- - name: Run rustfmt
- run: make rustlint
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 85ef799..648a82e 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -12,6 +12,10 @@ repos:
hooks:
- id: stylua-system # or stylua-system / stylua-github
files: \.lua$
+- repo: https://github.com/Calinou/pre-commit-luacheck
+ rev: v1.0.0
+ hooks:
+ - id: luacheck
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
diff --git a/README.md b/README.md
index 1eedb72..515ab4a 100644
--- a/README.md
+++ b/README.md
@@ -13,8 +13,8 @@
-
-
+
+
diff --git a/README_zh.md b/README_zh.md
index 4d4a043..e168bdd 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -13,8 +13,8 @@
-
-
+
+