mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
ci: added clang pre-commit hook (#461)
Signed-off-by: Leonardo Mello <lsvmello@gmail.com>
This commit is contained in:
parent
2b87088121
commit
e46e5819c9
3 changed files with 57 additions and 29 deletions
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
|
@ -4,13 +4,31 @@ on:
|
|||
# push:
|
||||
# branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Debug
|
||||
jobs:
|
||||
pre-commit:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- uses: actions/setup-python@v3
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install pre-commit
|
||||
python -m pip freeze --local
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.cache/pre-commit
|
||||
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||
- name: Run pre-commit checks
|
||||
run: pre-commit run --show-diff-on-failure --color=always --from-ref HEAD^ --to-ref HEAD
|
||||
shell: bash
|
||||
build:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
default_stages: [commit]
|
||||
repos:
|
||||
- repo: local
|
||||
hooks:
|
||||
|
@ -12,3 +13,9 @@ repos:
|
|||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-clang-format
|
||||
rev: v14.0.6
|
||||
hooks:
|
||||
- id: clang-format
|
||||
name: Clang formatting
|
||||
|
|
|
@ -23,12 +23,15 @@ cd build-dbg && ninja dragonfly
|
|||
```sh
|
||||
cd dragonfly # project root
|
||||
|
||||
# Make sure you have 'pre-commit' e 'clang-format' installed
|
||||
pip install pre-commit clang-format
|
||||
|
||||
# IMPORTANT! Enable our pre-commit message hooks
|
||||
# This will ensure your commits match our formatting requirements
|
||||
pre-commit install --hook-type commit-msg
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
This step must be done on each machine you wish to develop and contribute from to activate the `commit-msg` hook client-side.
|
||||
This step must be done on each machine you wish to develop and contribute from to activate the `commit-msg` and `commit` hooks client-side.
|
||||
|
||||
Once you have done these things, we look forward to adding your contributions and improvements to the Dragonfly DB project.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue