Skip to content

feat(p4): drive KernelDisplayRenderer from a shared lpl::render::Mesh #7

feat(p4): drive KernelDisplayRenderer from a shared lpl::render::Mesh

feat(p4): drive KernelDisplayRenderer from a shared lpl::render::Mesh #7

Workflow file for this run

name: Linter GitHub Action
on:
push:
branches-ignore: [ga-ignore-**, gh-pages]
paths:
- '**.c'
- '**.h'
- '**.cpp'
- '**.hpp'
- '.github/workflows/linter.yml'
permissions:
contents: write
concurrency:
group: linter-${{ github.ref }}
cancel-in-progress: true
jobs:
lint_code:
name: Lint with clang-format (auto-apply)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: true
- name: Restore apt .deb cache
id: cache-clang-restore
uses: actions/cache/restore@v4.3.0
with:
path: .apt-cache
key: ${{ runner.os }}-clang-format-v1
- name: Install clang-format (from cache if available)
run: |
if [ "${{ steps.cache-clang-restore.outputs.cache-hit }}" != 'true' ]; then
mkdir -p .apt-cache
sudo apt-get update
sudo apt-get -o Dir::Cache::archives="$(pwd)/.apt-cache" install --download-only -y clang-format || true
sudo chown -R "$(id -u):$(id -g)" .apt-cache || true
fi
if ls .apt-cache/*.deb 1> /dev/null 2>&1; then
echo "Installing clang-format from cached .deb"
sudo dpkg -i .apt-cache/*.deb || sudo apt-get install -f -y
else
echo "No cached debs found — installing via apt-get"
sudo apt-get update
sudo apt-get install -y clang-format
fi
- name: Format tracked C files (ensure newline at EOF + clang-format)
id: files
run: |
files_count=$(git ls-files -- '*.cpp' '*.hpp' '*.inl' '*.cu' '*.cuh' | wc -l)
if [ "$files_count" -eq 0 ]; then
echo "No tracked C++/H files to format."
echo "files=" >> $GITHUB_OUTPUT
exit 0
fi
git ls-files -z -- '*.cpp' '*.hpp' '*.inl' '*.cu' '*.cuh' | while IFS= read -r -d '' f; do
if [ -s "$f" ]; then
tail -c1 "$f" | read -r _ || echo >> "$f"
else
echo >> "$f"
fi
done
git ls-files -z -- '*.cpp' '*.hpp' '*.inl' '*.cu' '*.cuh' | xargs -0 clang-format -i
echo "files=1" >> $GITHUB_OUTPUT
- name: Show git status
run: |
git status --porcelain
- name: Commit and push style changes
if: ${{ steps.files.outputs.files != '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
if git diff --cached --quiet; then
echo "No formatting changes to commit."
exit 0
fi
git commit -m "style: apply clang-format" || true
git pull --rebase origin main || true
git push origin HEAD:main
- name: Save apt .deb cache
if: always()
uses: actions/cache/save@v4.3.0
with:
path: .apt-cache
key: ${{ runner.os }}-clang-format-v1