Files
spine/bootstrap
86a062dd09 ci: enforce cross-platform quality gates and connector coverage (#618)
## Summary

Consolidates the connector/build work from #613 and the broader
test-infrastructure work extracted from #597 into one review:

- discover MariaDB Connector/C first while retaining MySQL and
Percona-compatible support
- test MariaDB and MySQL Connector/C with strict GCC and Clang builds on
Ubuntu 24.04
- add a real macOS 15 build and unit-test lane with portable Autotools
platform detection
- run unit tests under ASan/UBSan and ThreadSanitizer
- enforce the measured 7% global coverage baseline and 70% changed-line
coverage
- add libFuzzer coverage for output parsing alongside the existing
hostname parser
- exercise the SNMPv3 integration suite against MariaDB and MySQL 8.4
- add cppcheck, shellcheck, DCO verification, CODEOWNERS, distcheck, and
Linux-capability checks while retaining the repository-managed default
CodeQL setup
- expose a stable `CI / required` aggregate check for branch protection
- pin runners and third-party actions and keep workflow permissions
read-only by default

## Correctness fixes found by the new gates

- reject truncated capability strings and poller-output SQL tuples
instead of publishing partial data
- make `bootstrap` fail closed and select `libtoolize`/`glibtoolize`
portably
- use Autoconf's canonical host for Darwin detection instead of an empty
native-build alias
- remove stale initialization/name-shadow findings and make read-only
interfaces const-correct
- make the ICMP parser test portable across Linux and BSD header names

## Verification

- strict GCC and Clang builds: 4/4 unit targets passed
- ASan/UBSan: 4/4 passed
- ThreadSanitizer: 4/4 passed
- macOS Clang/Homebrew build: 4/4 passed
- MariaDB integration: passed
- MySQL 8.4 integration: passed
- both libFuzzer targets: passed sustained local runs
- coverage: 7.2% global and 84% on changed lines
- cppcheck, shellcheck, actionlint, DCO verification, and `git diff
--check`: passed locally

## Post-merge repository settings

After these workflows exist on `develop`, an administrator should
require `CI / required`, Fuzz, Integration, Rocky Linux, and the
repository-managed CodeQL/code-scanning result in the active ruleset;
enable code-owner approval; and require the branch to be current (or use
a merge queue). Enabling those settings before this PR merges would
create required checks that the base branch cannot yet emit.

Consolidates and supersedes #613. Closes #612.

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: TheWitness <thewitness@cacti.net>
Signed-off-by: TheWitness <copilot@users.noreply.github.com>
Co-authored-by: TheWitness <thewitness@cacti.net>
Co-authored-by: TheWitness <copilot@users.noreply.github.com>
2026-09-24 05:52:56 -04:00

108 lines
4.0 KiB
Bash
Executable File

#!/bin/sh
# +-------------------------------------------------------------------------+
# | Copyright (C) 2004-2026 The Cacti Group |
# | |
# | This program is free software; you can redistribute it and/or |
# | modify it under the terms of the GNU General Public License |
# | as published by the Free Software Foundation; either version 2 |
# | of the License, or (at your option) any later version. |
# | |
# | This program is distributed in the hope that it will be useful, |
# | but WITHOUT ANY WARRANTY; without even the implied warranty of |
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# | GNU General Public License for more details. |
# +-------------------------------------------------------------------------+
# | Cacti: The Complete RRDtool-based Graphing Solution |
# +-------------------------------------------------------------------------+
# | This code is designed, written, and maintained by the Cacti Group. See |
# | about.php and/or the AUTHORS file for specific developer information. |
# +-------------------------------------------------------------------------+
# | http://www.cacti.net/ |
# +-------------------------------------------------------------------------+
#
# ----------------------------------------------------------
set -eu
# Name: bootstrap
#
# Function: build spine from scratch
#
# Description: This script will take a vanilla Spine source
# package and attempt to compile it. It will
# attempt to handle nasty things like dos2unix
# issues in all files and searching for the
# presence of required modules.
#
# It is not a replacement for the auto tools,
# but simply a supplement.
#
# ----------------------------------------------------------
# Help function
display_help () {
echo "--------------------------------------------------------------"
echo "Spine bootstrap script"
echo " Attempts to configure spine based on a 'normal' system. If you"
echo " install things in non-common locations you may have to use"
echo " the install instructions to build."
echo "--------------------------------------------------------------"
echo
}
# Check for parameters
if [ "${1:-}" = "--help" ] || [ "${1:-}" = "-h" ]; then
display_help
exit 0
fi
echo "INFO: Starting Spine build process"
# Remove software build specific directories
echo "INFO: Removing cache directories"
rm -rf autom4te.cache .deps
# Make sure all files are unix formatted files
if command -v dos2unix > /dev/null 2>&1; then
for e in ac am c h in md mdlrc rb sh yml; do
echo "INFO: Ensuring UNIX format for *.$e"
find . -type f -name "*.${e}" -exec dos2unix --d2u {} \; > /dev/null 2>&1
done
fi
# Prepare a build state
echo "INFO: Running auto-tools to verify buildability"
mkdir -p config m4
if command -v libtoolize > /dev/null 2>&1; then
LIBTOOLIZE=libtoolize
elif command -v glibtoolize > /dev/null 2>&1; then
LIBTOOLIZE=glibtoolize
else
echo "ERROR: GNU libtoolize (or glibtoolize on macOS) is required" >&2
exit 1
fi
export LIBTOOLIZE
autoreconf --force --install
# Provide some meaningful notes
echo "INFO: Spine bootstrap process completed"
echo ""
echo " These instructions assume the default install location for spine"
echo " of /usr/local/spine. If you choose to use another prefix, make"
echo " sure you update the commands as required for that new path."
echo ""
echo " To compile and install Spine using MySQL or MariaDB"
echo " please do the following:"
echo ""
echo " ./configure"
echo " make"
echo " make install"
echo " chown root:root /usr/local/spine/bin/spine"
echo " chmod +s /usr/local/spine/bin/spine"
echo ""
exit 0