chore: added CI workflow

This commit is contained in:
Yurii
2026-05-17 03:57:59 +03:00
parent db99746ee9
commit 14d2262d2f
+108
View File
@@ -0,0 +1,108 @@
name: CI
on:
workflow_dispatch:
push:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
validate-json:
name: Validate JSON
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Validate
shell: bash
run: |
set -euo pipefail
echo "Searching JSON files in src_data..."
files=$(find src_data -type f -iname "*.json")
if [ -z "$files" ]; then
echo "No JSON files found."
exit 0
fi
failed=0
for file in $files; do
echo "Validating: $file"
if ! jq empty "$file" >/dev/null 2>&1; then
echo "❌ Invalid JSON: $file"
failed=1
else
echo "✅ Valid JSON: $file"
fi
done
if [ "$failed" -ne 0 ]; then
echo ""
echo "JSON validation failed."
exit 1
fi
echo ""
echo "All JSON files are valid."
cpplint:
name: cpplint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Cache
uses: actions/cache@v5
with:
key: ${{ runner.os }}-cpplint
path: ~/.cache/pip
- name: Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Install cpplint
run: |
python -m pip install --upgrade pip
pip install --upgrade cpplint
- name: cpplint
run: |
FILTERS="-legal/copyright,\
-runtime/int,\
-runtime/references,\
-runtime/indentation_namespace,\
-runtime/arrays,\
-runtime/printf,\
-whitespace/line_length,\
-whitespace/braces,\
-whitespace/comments,\
-whitespace/indent,\
-whitespace/newline,\
-whitespace/parens,\
-readability/braces,\
-readability/todo,\
-build/header_guard,\
-build/include_subdir,\
-build/include_what_you_use,\
-build/namespaces,\
-build/c++11"
cpplint \
--repository=. \
--recursive \
--quiet \
--filter="$FILTERS" \
include lib src