ci: speed up builds 4x with parallel tests, coverage, and ccache
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
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
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).
This commit is contained in:
@@ -24,6 +24,13 @@ int fd = 0;
|
||||
int stub_port = 5230;
|
||||
pid_t child_pid = 0;
|
||||
|
||||
/*
|
||||
* Dynamic XDG paths based on stub_port for parallel test execution.
|
||||
* Each test instance gets unique directories to avoid file conflicts.
|
||||
*/
|
||||
char xdg_config_home[256];
|
||||
char xdg_data_home[256];
|
||||
|
||||
/*
|
||||
* Buffer for accumulating output from profanity.
|
||||
* 64KB is sufficient for typical test output while keeping memory usage
|
||||
@@ -77,7 +84,7 @@ _mkdir_recursive(const char *dir)
|
||||
void
|
||||
_create_config_dir(void)
|
||||
{
|
||||
GString *profanity_dir = g_string_new(XDG_CONFIG_HOME);
|
||||
GString *profanity_dir = g_string_new(xdg_config_home);
|
||||
g_string_append(profanity_dir, "/profanity");
|
||||
|
||||
if (!_mkdir_recursive(profanity_dir->str)) {
|
||||
@@ -90,7 +97,7 @@ _create_config_dir(void)
|
||||
void
|
||||
_create_data_dir(void)
|
||||
{
|
||||
GString *profanity_dir = g_string_new(XDG_DATA_HOME);
|
||||
GString *profanity_dir = g_string_new(xdg_data_home);
|
||||
g_string_append(profanity_dir, "/profanity");
|
||||
|
||||
if (!_mkdir_recursive(profanity_dir->str)) {
|
||||
@@ -103,7 +110,7 @@ _create_data_dir(void)
|
||||
void
|
||||
_create_chatlogs_dir(void)
|
||||
{
|
||||
GString *chatlogs_dir = g_string_new(XDG_DATA_HOME);
|
||||
GString *chatlogs_dir = g_string_new(xdg_data_home);
|
||||
g_string_append(chatlogs_dir, "/profanity/chatlogs");
|
||||
|
||||
if (!_mkdir_recursive(chatlogs_dir->str)) {
|
||||
@@ -116,7 +123,7 @@ _create_chatlogs_dir(void)
|
||||
void
|
||||
_create_logs_dir(void)
|
||||
{
|
||||
GString *logs_dir = g_string_new(XDG_DATA_HOME);
|
||||
GString *logs_dir = g_string_new(xdg_data_home);
|
||||
g_string_append(logs_dir, "/profanity/logs");
|
||||
|
||||
if (!_mkdir_recursive(logs_dir->str)) {
|
||||
@@ -129,7 +136,9 @@ _create_logs_dir(void)
|
||||
void
|
||||
_cleanup_dirs(void)
|
||||
{
|
||||
int res = system("rm -rf ./tests/functionaltests/files");
|
||||
char cmd[512];
|
||||
snprintf(cmd, sizeof(cmd), "rm -rf ./tests/functionaltests/files/%d", stub_port);
|
||||
int res = system(cmd);
|
||||
if (res == -1) {
|
||||
assert_true(FALSE);
|
||||
}
|
||||
@@ -231,14 +240,20 @@ init_prof_test(void **state)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Generate unique XDG paths based on stub_port for parallel execution
|
||||
snprintf(xdg_config_home, sizeof(xdg_config_home),
|
||||
"./tests/functionaltests/files/%d/xdg_config_home", stub_port);
|
||||
snprintf(xdg_data_home, sizeof(xdg_data_home),
|
||||
"./tests/functionaltests/files/%d/xdg_data_home", stub_port);
|
||||
|
||||
// Give stabber server thread time to start listening
|
||||
usleep(100000); // 100ms
|
||||
|
||||
config_orig = getenv("XDG_CONFIG_HOME");
|
||||
data_orig = getenv("XDG_DATA_HOME");
|
||||
|
||||
setenv("XDG_CONFIG_HOME", XDG_CONFIG_HOME, 1);
|
||||
setenv("XDG_DATA_HOME", XDG_DATA_HOME, 1);
|
||||
setenv("XDG_CONFIG_HOME", xdg_config_home, 1);
|
||||
setenv("XDG_DATA_HOME", xdg_data_home, 1);
|
||||
|
||||
_cleanup_dirs();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user