Pipery C/C++ CI#

Reusable GitHub Action for a complete C/C++ CI pipeline with structured logging via Pipery.

GitHub Marketplace Version License: MIT

Table of Contents#

Quick Start#

name: CI
on: [push, pull_request]

jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pipery-dev/cpp-ci@v1.1.0
        with:
          project_path: .
          build_system: auto
          github_token: ${{ secrets.GITHUB_TOKEN }}

Pipeline Overview#

StepToolSkip InputDescription
Lintclang-tidyskip_lintEnforces code style and detects issues
SASTcppcheck, clang-analyzerskip_sastDetects C/C++ vulnerabilities
SCAdependency-checkskip_scaIdentifies vulnerable dependencies
BuildCMake/Make/Mesonskip_buildCompiles C/C++ project
Testctestskip_testRuns unit and integration tests
VersionSemantic versioningskip_versioningBumps version and creates git tag
Packagecpackskip_packagingCreates distributable artifacts
ReleaseGitHub Releaseskip_releasePublishes binaries to GitHub
ReintegrateGit mergeskip_reintegrationMerges back to default branch

Configuration Options#

NameDefaultDescription
project_path.Path to the project source tree.
config_file.pipery/config.yamlPath to Pipery config file.
build_systemautoBuild system to use: auto, cmake, make, or meson.
compilerg++C++ compiler to use (e.g., g++, clang++).
cmake_flags``Extra flags to pass to the cmake configure step.
tests_path``Test filter pattern passed to ctest -R or equivalent.
version_bumppatchVersion bump type: patch, minor, or major.
target_branchmainTarget branch for reintegration.
github_token``GitHub token for release and reintegration.
log_filepipery.jsonlPath to the JSONL structured log file.
skip_lintfalseSkip the lint step.
skip_sastfalseSkip the SAST step.
skip_scafalseSkip the SCA step.
skip_buildfalseSkip the build step.
skip_testfalseSkip the test step.
skip_versioningfalseSkip the versioning step.
skip_packagingfalseSkip the packaging step.
skip_releasefalseSkip the release step.
skip_reintegrationfalseSkip the reintegration step.

Usage Examples#

Example 1: CMake project with g++#

name: CI
on: [push, pull_request]

jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pipery-dev/cpp-ci@v1.1.0
        with:
          project_path: .
          build_system: cmake
          compiler: g++
          github_token: ${{ secrets.GITHUB_TOKEN }}

Example 2: Clang compiler#

- uses: pipery-dev/cpp-ci@v1.1.0
  with:
    project_path: .
    build_system: cmake
    compiler: clang++
    github_token: ${{ secrets.GITHUB_TOKEN }}

Example 3: Custom CMake flags for release build#

- uses: pipery-dev/cpp-ci@v1.1.0
  with:
    project_path: .
    build_system: cmake
    cmake_flags: -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=ON -DENABLE_DOCS=ON
    github_token: ${{ secrets.GITHUB_TOKEN }}

Example 4: Makefile-based project#

- uses: pipery-dev/cpp-ci@v1.1.0
  with:
    project_path: .
    build_system: make
    github_token: ${{ secrets.GITHUB_TOKEN }}

Example 5: Run specific test suite#

- uses: pipery-dev/cpp-ci@v1.1.0
  with:
    project_path: .
    tests_path: unit_*
    github_token: ${{ secrets.GITHUB_TOKEN }}

Example 6: Major version bump#

- uses: pipery-dev/cpp-ci@v1.1.0
  with:
    project_path: .
    build_system: cmake
    version_bump: major
    github_token: ${{ secrets.GITHUB_TOKEN }}

GitLab CI#

Use the GitLab mirror template when .gitlab-ci.yml is published for this pipeline family. Import it from the mirrored GitLab project or use it as a reference implementation for running the same Pipery pipeline outside GitHub Actions.

The GitLab pipeline maps action inputs to CI/CD variables, publishes pipery.jsonl as an artifact, and maintains the same skip controls. Store credentials as protected GitLab CI/CD variables.

include:
  - project: pipery-dev/cpp-ci
    ref: v1.1.0
    file: /.gitlab-ci.yml

GitLab CI Variables#

Configure these protected variables in Settings > CI/CD > Variables:

  • GITHUB_TOKEN - GitHub API access for release and reintegration
  • BUILD_SYSTEM - cmake/make/meson (default: auto)
  • COMPILER - C++ compiler (default: g++)
  • VERSION_BUMP - patch/minor/major (default: patch)

Bitbucket Pipelines#

Bitbucket Cloud pipelines provide an alternative to GitHub Actions. Use Bitbucket shared pipeline imports to reference the exported Pipery pipeline instead of copying YAML into every application repository.

Getting Started#

  1. Add a Bitbucket import source for the shared Pipery pipeline and import the exported pipeline by name:
definitions:
  imports:
    pipery-shared: pipery-dev/cpp-ci:v1.1.0
    pipery-custom: pipery-dev/cpp-ci:v1.1.0:.bitbucket/shared-pipelines.yml

pipelines:
  branches:
    main:
      import: pipery-cpp-ci@pipery-shared

  custom:
    run-pipery:
      import: pipery-cpp-ci@pipery-custom

Use {project-path}/{repo-slug}:{branch-or-tag} for a shared repository bitbucket-pipelines.yml, or {project-path}/{repo-slug}:{branch-or-tag}:{config-filepath} for another exported YAML file.

  1. Configure Protected Variables in Repository Settings > Pipelines > Repository Variables:
    • GITHUB_TOKEN - GitHub API access (for release and reintegration)
    • BUILD_SYSTEM - cmake/make/meson (default: auto)
    • COMPILER - C++ compiler (default: g++)
  2. Commit and push to trigger the pipeline

Pipeline Stages#

The Bitbucket equivalent follows the same structure:

checkout → setup → lint (clang-tidy) → SAST (cppcheck) → SCA (dependency-check) → build → test → versioning → packaging → release → reintegration → logs

Skip Flags#

Disable any stage using environment variables:

  • SKIP_LINT, SKIP_SAST, SKIP_SCA, SKIP_BUILD, SKIP_TEST, SKIP_VERSIONING, SKIP_PACKAGING, SKIP_RELEASE, SKIP_REINTEGRATION

Example: Set SKIP_SAST=true to skip security scanning.

Features#

  • Auto-detects CMake, Make, Meson build systems
  • Multiple compiler support (g++, clang++)
  • Static analysis (clang-tidy, cppcheck)
  • Dependency vulnerability checking
  • Automatic GitHub releases
  • JSONL-based pipeline logging
  • 30-90 day artifact retention

About Pipery#

Pipery Pipery is an open-source CI/CD observability platform. Every step script runs under psh (Pipery Shell), which intercepts all commands and emits structured JSONL events — giving you full visibility into your pipeline without any manual instrumentation.

Development#

# Run the action locally against test-project/
pipery-actions test --repo .

# Regenerate docs
pipery-actions docs --repo .

# Dry-run release
pipery-actions release --repo . --dry-run