Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI check that enforces public-only headers #3609

Merged
merged 2 commits into from
Feb 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion scripts/ci-checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ fi
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

ROOT_DIR=$( dirname "$SCRIPT_DIR" )
pushd "$ROOT_DIR"
pushd "$ROOT_DIR" > /dev/null

CHECK_DELIMITER="---------------------------"

Expand All @@ -25,6 +25,18 @@ echo "$CHECK_DELIMITER"
echo "-- TODOs"
"$SCRIPT_DIR"/check-todo.sh include src

echo "$CHECK_DELIMITER"
echo "-- Public includes"
# Enforce that no private headers are included from public header files
violations=$(find "$ROOT_DIR/include/ccf" -type f -print0 | xargs --null grep -e "#include \"" | grep -v "#include \"ccf" | sort)
if [[ -n "$violations" ]]; then
echo "Public headers include private implementation files:"
echo "$violations"
exit 1
else
echo "No public header violations"
fi

echo "$CHECK_DELIMITER"
echo "-- Release notes"
if [ $FIX -ne 0 ]; then
Expand Down