Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BasedOnStyle: Google
ColumnLimit: 100
49 changes: 49 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Lint

on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened]

concurrency:
group: lint-${{ github.event.pull_request.number }}
cancel-in-progress: true

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Check script permissions
run: |
errors=0
for f in scripts/*.sh; do
[ -f "$f" ] || continue
if [ ! -x "$f" ]; then
echo "::error file=$f::Script is not executable"
errors=$((errors + 1))
fi
done
if [ "$errors" -gt 0 ]; then
echo "::error::$errors script(s) missing executable permission"
exit 1
fi

- name: Build Docker image
run: docker build -f scripts/Dockerfile . --network host --tag cunls:local

- name: Run pre-commit (changed files)
run: |
docker run --rm \
-v "$(pwd):/cunls" \
-w /cunls \
cunls:local \
bash -c "git config --global --add safe.directory /cunls && pre-commit run --from-ref origin/main --to-ref HEAD"
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.7
hooks:
- id: clang-format
types_or: [c++, cuda]
2 changes: 1 addition & 1 deletion scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --upgrade pip && \
pip install scikit-build-core nanobind build wheel
pip install scikit-build-core nanobind build wheel pre-commit

# Sphinx docs dependencies
COPY docs/sphinx/requirements.txt /tmp/cunls-docs-requirements.txt
Expand Down