feat: add pre-commit ci (#1824)
This commit is contained in:
24
.github/workflows/lua.yaml
vendored
24
.github/workflows/lua.yaml
vendored
@@ -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
|
||||
|
||||
38
.github/workflows/pre-commit.yaml
vendored
Normal file
38
.github/workflows/pre-commit.yaml
vendored
Normal file
@@ -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()
|
||||
31
.github/workflows/python.yaml
vendored
31
.github/workflows/python.yaml
vendored
@@ -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")
|
||||
24
.github/workflows/rust.yaml
vendored
24
.github/workflows/rust.yaml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user