Introduce separate jobs to test C (Doxygen) and Python (Sphinx) API documentation generation. Ensures build failures are caught early, as API changes often produce warnings that developers miss without automated checks.
121 lines
3.7 KiB
YAML
121 lines
3.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
|
|
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
|
|
|
|
test-c-api-docs:
|
|
runs-on: ubuntu-latest
|
|
name: Test C API Documentation Generation
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends make doxygen
|
|
- name: Test C API docs generation
|
|
run: |
|
|
cd apidocs/c/
|
|
doxygen c-prof.conf
|
|
|
|
test-python-api-docs:
|
|
runs-on: ubuntu-latest
|
|
name: Test Python API Documentation Generation
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends make python3-sphinx
|
|
- name: Test Python API docs generation
|
|
run: |
|
|
cd apidocs/python/
|
|
sphinx-apidoc -f -o . src && make -j$(nproc) xml SPHINXOPTS="-W --keep-going -n"
|