Files
cproof/.github/workflows/ci-code.yml
Jabber Developer 85c817ee8c
All checks were successful
CI Code / Check spelling (push) Successful in 18s
CI Code / Check coding style (push) Successful in 31s
CI Code / Code Coverage (push) Successful in 15m25s
CI Code / Linux (debian) (push) Successful in 15m57s
CI Code / Linux (ubuntu) (push) Successful in 16m0s
CI Code / Linux (arch) (push) Successful in 16m6s
ci: speed up builds 4x with parallel tests, coverage, and ccache
Split functional tests into 4 parallel groups and add check-functional-parallel target (~3x faster CI runs).
Add branch-aware LCOV coverage reporting with new --enable-coverage option and lcov summary in CI pipeline.
Enable ccache via -C configure flag for faster recompilations.
Install lcov in all Docker images and use --depth 1 git clones + parallel make -j$(nproc) for quicker container builds.
Update CONTRIBUTING.md with instructions for parallel test groups and adding new ones.

All changes are tightly related CI/performance improvements developed in sequence. No external service uploads (e.g. Codecov skipped due to Gitea incompatibility).
2026-01-21 16:35:17 +01:00

125 lines
4.0 KiB
YAML

name: CI Code
on:
push:
branches: [master]
paths-ignore:
- 'docs/**'
- 'apidocs/**'
- 'README.md'
pull_request:
branches: [master]
paths-ignore:
- 'docs/**'
- 'apidocs/**'
- 'README.md'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: [arch, debian, ubuntu]
name: Linux
steps:
- uses: actions/checkout@v4
- name: Run tests
run: |
docker build -f Dockerfile.${{ matrix.flavor }} -t profanity .
docker run profanity ./ci-build.sh
code-style:
runs-on: ubuntu-latest
name: Check coding style
continue-on-error: true
env:
GITHUB_WORKSPACE: ${{ runner.workspace }}
steps:
- uses: actions/checkout@v4
# if this check fails, you have to update the number of auto types known and the list of auto types in the check below
- name: Check auto types are up-to-date
run: |
[[ "$(find src -type f -name '*.[ch]' -exec awk '/^#define auto_[\W]*/ {print $2}' '{}' \; | sort -u | wc -l)" == "8" ]] || exit -1
- name: Check auto types are initialized
run: |
grep -P 'auto_(char|gchar|gcharv|guchar|jid|sqlite|gfd|FILE)[\w *]*;$' -r src && exit -1 || true
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Run clang-format check
run: |
echo $(clang-format --version)
# Find all source files you care about
INCLUDE_REGEX='^.*\.((((c|C)(c|pp|xx|\+\+)?$)|((h|H)h?(pp|xx|\+\+)?$))|(ino|pde|proto|cu))$'
CHECK_PATH='src'
files=$(find "$CHECK_PATH" -name .git -prune -o -regextype posix-egrep -regex "$INCLUDE_REGEX" -print)
if [ -z "$files" ]; then
echo "✅ No source files found to check."
exit 0
fi
# Run clang-format in dry-run mode and collect any improperly formatted files
failed=0
for file in $files; do
if ! output=$(clang-format --dry-run --Werror --style=file "$file" 2>&1); then
echo "❌ Failed on file: $file"
echo "$output"
echo "----------------------------------------"
failed=1
fi
done
if [ $failed -ne 0 ]; then
echo "🚫 One or more files are not properly formatted."
else
echo "✅ All files are properly formatted."
fi
exit $failed
spell-check:
runs-on: ubuntu-latest
name: Check spelling
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y --no-install-recommends codespell
- name: Check spelling
run: |
codespell
coverage:
runs-on: ubuntu-latest
name: Code Coverage
steps:
- uses: actions/checkout@v4
- name: Build and run coverage
run: |
docker build -f Dockerfile.debian -t profanity-cov .
docker run -v ${{ github.workspace }}/coverage:/coverage profanity-cov bash -c '
./bootstrap.sh
./configure --enable-coverage --enable-otr --enable-pgp --enable-omemo --enable-plugins
make -j$(nproc)
make check || true
make check-functional-parallel || true
lcov --capture --directory . --output-file /coverage/coverage.info \
--rc branch_coverage=1 \
--ignore-errors inconsistent
lcov --remove /coverage/coverage.info \
"/usr/include/*" "*/tests/*" \
--output-file /coverage/coverage.info \
--rc branch_coverage=1 \
--ignore-errors inconsistent,empty,unused
lcov --summary /coverage/coverage.info
'