add clang-format

Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
Ari Archer 2024-06-21 22:34:41 +03:00
parent 28604e768b
commit d2bbc76d8f
No known key found for this signature in database
GPG key ID: A50D5B4B599AF8A2
2 changed files with 65 additions and 46 deletions

19
.clang-format Normal file
View file

@ -0,0 +1,19 @@
---
BasedOnStyle: LLVM
IndentWidth: 4
SortIncludes: false
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveMacros: true
AlignEscapedNewlines: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: true
AllowShortLambdasOnASingleLine: true
BinPackParameters: false
IndentCaseBlocks: true
IndentCaseLabels: true
IndentExternBlock: true
IndentGotoLabels: true
---

View file

@ -1,55 +1,55 @@
on: on:
push: push:
branches: branches:
- main - main
paths-ignore: paths-ignore:
- 'commits.png' - "commits.png"
- 'languages.png' - "languages.png"
schedule: schedule:
- cron: '0 */8 * * *' - cron: "0 */8 * * *"
jobs: jobs:
stats: stats:
runs-on: docker runs-on: ubuntu-latest
container: catthehacker/ubuntu:act-latest container: catthehacker/ubuntu:act-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
token: ${{ secrets.GIT_TOKEN }} token: ${{ secrets.GIT_TOKEN }}
- name: Check for Skip CI in Last Commit - name: Check for Skip CI in Last Commit
id: check_commit id: check_commit
run: | run: |
commit_message=$(git log -1 --pretty=%B) commit_message=$(git log -1 --pretty=%B)
if echo "$commit_message" | grep -q "\[skip ci\]"; then if echo "$commit_message" | grep -q "\[skip ci\]"; then
echo "Skip CI based on commit message" && exit 78; echo "Skip CI based on commit message" && exit 78;
fi fi
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
with: with:
python-version: '3.10' python-version: "3.10"
cache: 'pip' cache: "pip"
- name: Install dependencies - name: Install dependencies
run: | run: |
pip install -r requirements.txt pip install -r requirements.txt
- name: Generate statistics - name: Generate statistics
run: | run: |
python3 stats.py python3 stats.py
- name: Stage the changes - name: Stage the changes
run: | run: |
git add languages.png commits.png git add languages.png commits.png
- name: Commit and Push Changes - name: Commit and Push Changes
run: | run: |
if git diff --staged --quiet; then if git diff --staged --quiet; then
echo "No changes to commit." echo "No changes to commit."
else else
git config --local user.email "stats@localhost" git config --local user.email "stats@localhost"
git config --local user.name "Stats CI/CD" git config --local user.name "Stats CI/CD"
git add commits.png languages.png git add commits.png languages.png
git commit -am "Update stats" || echo "No changes to commit" git commit -am "[skip ci] Update stats" || echo "No changes to commit"
git push origin HEAD git push origin HEAD
fi fi