CI/CD Pipelines
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The libfastjson project utilizes various continuous integration (CI) platforms and a dedicated testbench to maintain code quality and stability. The CI pipeline is a mandatory gatekeeper for the project; all pull requests must pass all CI tests before they are considered for merging into the main codebase.
The primary goal of the CI/CD infrastructure is to ensure that bug fixes and new functionalities do not introduce regressions. Contributors are highly encouraged to add related tests to the testbench for any changes they submit.
Sources: CONTRIBUTING.md:4-15, README.md:45-47
CI Infrastructure and Automation
The CI workflow is composed of several automated scripts that handle environment preparation, code style enforcement, and advanced memory sanitization checks.
Workflow Orchestration
The project uses scripts like CI/try_merge.sh to simulate the merging of pull requests into the master branch. This script configures a temporary environment using a buildbot user to perform local merges and subsequent testing.
The diagram shows the logic for testing a PR merge before final acceptance.
Sources: CI/try_merge.sh:2-33
Code Style Enforcement
Automated style checks are performed to ensure consistency. The project enforces specific rules, such as using TABs for indentation rather than spaces and prohibiting trailing whitespaces. The CI/check_codestyle.sh script automates this by cloning a shared rsyslog codestyle tool and running it against all .c and .h files.
Sources: CI/check_codestyle.sh:1-7, CONTRIBUTING.md:28-32
Sanitization and Static Analysis
The project employs Clang-based sanitizers (specifically AddressSanitizer) to detect memory-related errors. The script CI/clang-check-sanitizer.sh sets the compiler to GCC (as a fallback when Clang is broken) and applies -fsanitize=address to the build flags before running the test suite.
Sources: CI/clang-check-sanitizer.sh:1-10
Testing Framework
The core of the CI pipeline is the testbench, which is executed via make check.
Test Definitions and Execution
Tests are managed through shell scripts that provide a consistent environment. The tests/test-defs.sh script handles:
- Absolute path resolution for source and build directories.
- Verbose output control.
- Temporary test directory creation and cleanup.
- Output comparison against
.expectedfiles.
Sources: tests/test-defs.sh:1-140, README.md:46-47
Valgrind Integration
The test framework includes built-in support for Valgrind memcheck to detect memory leaks and invalid accesses during CI runs.
This sequence illustrates how Valgrind wraps the execution of test binaries to monitor memory health.
Sources: tests/test-defs.sh:80-113
Release Pipeline
The project follows a structured manual and automated release checklist to ensure artifact integrity.
Release Steps
| Category | Actions |
|---|---|
| Verification | Compile on Linux and NetBSD; check ChangeLog |
| Versioning | Update json_c_version.h, Doxyfile, and configure.ac |
| Artifacts | Generate configure via autogen.sh; create tarballs |
| Documentation | Generate Doxygen docs and update gh-pages |
| Security | Generate SHA256 and MD5 checksums |
Sources: RELEASE_CHECKLIST.txt:4-118
Deployment Workflow
After local verification and tagging, release artifacts (tarballs) are uploaded to the Amazon S3 service for public distribution.
The flow of operations for finalizing and distributing a project release.
Sources: RELEASE_CHECKLIST.txt:54-106
Summary
The CI/CD pipelines for libfastjson provide a robust mechanism for maintaining code quality through automated style checks, memory sanitization, and regression testing. By enforcing mandatory passes on all PRs and utilizing tools like Valgrind, the project ensures that its high-performance goals are met without sacrificing stability.