Skip to content

fix CI to write digests and shit #50

fix CI to write digests and shit

fix CI to write digests and shit #50

Workflow file for this run

name: Lint
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
permissions:
contents: read
jobs:
clang-tidy:
name: clang-tidy
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
clang-tidy \
build-essential \
python3 python3-pip \
ninja-build \
libmbedtls-dev \
libavcodec-dev \
libavfilter-dev \
libavformat-dev \
libavutil-dev \
libswscale-dev \
libswresample-dev \
libsrtp2-dev \
libusrsctp-dev \
libsrt-openssl-dev
pip3 install meson>=1.3.0
- name: Generate compile_commands.json
run: |
meson setup builddir \
--wrap-mode=default \
--force-fallback-for=mbedtls,usrsctp \
-DWITH_AV=true \
-DNORIST=true
cp lib/*.h builddir/mist/
cp lib/ffmpeg/*.h builddir/mist/ffmpeg/
- name: Get changed files
id: changed
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
FILES=$(git diff --name-only --diff-filter=ACMR ${{ github.event.pull_request.base.sha }}...${{ github.sha }} -- '*.cpp' '*.h' '*.hpp' \
| grep -v '^lsp/' \
| grep -v '^embed/' \
| grep -v '^subprojects/' \
| grep -v '\.js\.h$' \
| grep -v '\.css\.h$' \
|| true)
else
FILES=$(git diff --name-only --diff-filter=ACMR HEAD~1...HEAD -- '*.cpp' '*.h' '*.hpp' \
| grep -v '^lsp/' \
| grep -v '^embed/' \
| grep -v '^subprojects/' \
| grep -v '\.js\.h$' \
| grep -v '\.css\.h$' \
|| true)
fi
if [ -z "$FILES" ]; then
echo "No C++ files changed"
echo "files=" >> "$GITHUB_OUTPUT"
else
echo 'files<<EOF' >> "$GITHUB_OUTPUT"
echo "$FILES" >> "$GITHUB_OUTPUT"
echo 'EOF' >> "$GITHUB_OUTPUT"
fi
- name: Run clang-tidy on changed files
if: steps.changed.outputs.files != ''
env:
CHANGED_FILES: ${{ steps.changed.outputs.files }}
run: |
echo "Running clang-tidy on changed files..."
FAILED=0
while IFS= read -r file; do
[ -z "$file" ] && continue
if [ -f "$file" ]; then
echo "Checking: $file"
if ! clang-tidy -p builddir "$file" 2>&1; then
FAILED=1
fi
fi
done <<< "$CHANGED_FILES"
if [ $FAILED -eq 1 ]; then
echo "::error::clang-tidy found issues"
exit 1
fi
echo "All clang-tidy checks passed!"
- name: Skip message
if: steps.changed.outputs.files == ''
run: echo "No C++ files changed, skipping clang-tidy"
clang-format:
name: clang-format
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install clang-format
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/llvm.asc > /dev/null
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" | sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt-get update
sudo apt-get install -y clang-format-21
sudo ln -sf /usr/bin/clang-format-21 /usr/local/bin/clang-format
sudo ln -sf /usr/bin/git-clang-format-21 /usr/local/bin/git-clang-format
- name: Check formatting of changed lines
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE=${{ github.event.pull_request.base.sha }}
else
BASE=HEAD~1
fi
OUTPUT=$(git clang-format --diff "$BASE" HEAD --extensions cpp,h,hpp -- \
':!lsp/' ':!embed/' ':!subprojects/' 2>&1) || true
if [ "$OUTPUT" = "no modified files to format" ] || \
[ "$OUTPUT" = "clang-format did not modify any files" ] || \
[ -z "$OUTPUT" ]; then
echo "All formatting checks passed!"
else
echo "$OUTPUT"
echo ""
echo "::error::Formatting issues in changed lines"
exit 1
fi