CI/CD Integration

aurora-lint is designed for CI/CD pipelines with exit codes, severity thresholds, diff-only analysis, and SARIF output for code scanning integrations.

General Strategy

A typical CI setup uses two modes:

  1. PR analysis (diff-only): findings in the files the pull request changed

  2. Push/merge analysis (full scan): every file on the main branch

Both modes export SARIF for integration with code scanning dashboards.

# PR mode: only the files changed since the merge base with main, fail on High+
aurora-lint . --diff-base origin/main --min-severity Medium --fail-on-severity High --export results.sarif

# Full scan: entire repo with cross-file context
aurora-lint . -d . --min-severity Medium --fail-on-severity High --export results.sarif

Diff-Only Scans in CI

There are two diff-only flags, and a CI job wants the second:

  • --diff analyzes the C files with uncommitted changes, staged or not, and untracked ones. A CI checkout has none, so in a pull-request job --diff alone analyzes nothing and the job passes whatever the branch changed.

  • --diff-base REF analyzes the C files changed between the merge base of REF and HEAD, plus those --diff alone finds, and implies --diff. In a pull-request job, REF is the target branch, for example origin/main. The checkout must hold REF and the history back to the merge base. A shallow clone does not, and the error says so: use fetch-depth: 0 in actions/checkout (fetchDepth: 0 in Azure Pipelines), or run git fetch --unshallow.

With either flag:

  • PATH must be the root of the git repository. Any other PATH (a subdirectory, a single file, a directory outside any repository) is refused with exit code 2. To leave parts of the repository out, pass the root with --report-exclude, --exclude-all or toolchain.toml’s [ignore] paths.

  • Only the analysis is limited to the changed files. The pre-scan still reads every file under PATH, so cross-file findings in a changed file keep their context.

  • When no C file changed, the log says diff-only: no changed C files to analyze and the scan exits 0, so it can be told apart from a clean scan without failing the job. If the tree has no C file to select at all, changed or not, the scan exits 3; see Error Handling and Exit Codes.

GitHub Actions

An example workflow is at examples/aurora-lint-analysis.yml; copy it into your repository’s .github/workflows/. Its pull-request job passes --diff-base origin/${{ github.base_ref }}:

# aurora-lint Static Analysis - GitHub Actions Example Workflow
#
# This workflow runs aurora-lint CERT C analysis on your C/C++ codebase.
# - On PRs: reports only on the C files the PR changes (--diff-base mode)
# - On push to main: full repository scan
# - Uploads SARIF results to GitHub Code Scanning
#
# Prerequisites:
#   - aurora-lint must be built or available as a binary
#   - A rules manifest passed with -m (or the built-in default, which enables
#     every implemented rule)

name: aurora-lint CERT C Analysis

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    name: Build aurora-lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Cache Cargo registry and build
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-

      - name: Build aurora-lint
        run: cargo build --release

      - name: Upload aurora-lint binary
        uses: actions/upload-artifact@v4
        with:
          name: aurora-lint-binary
          path: target/release/aurora-lint
          retention-days: 1

  analyze-pr:
    name: Analyze PR (diff only)
    if: github.event_name == 'pull_request'
    needs: build
    runs-on: ubuntu-latest
    permissions:
      security-events: write
    steps:
      - uses: actions/checkout@v4
        with:
          # --diff-base needs the base branch and the history back to the merge
          # base; fetch-depth: 0 fetches every branch and the full history.
          fetch-depth: 0

      - name: Download aurora-lint binary
        uses: actions/download-artifact@v4
        with:
          name: aurora-lint-binary

      - name: Make aurora-lint executable
        run: chmod +x aurora-lint

      # PATH must be the repository root. A checkout has no uncommitted
      # changes, so plain --diff would scan nothing here.
      - name: Run aurora-lint (diff mode)
        run: |
          ./aurora-lint . --diff-base origin/${{ github.base_ref }} \
            --min-severity Medium \
            --fail-on-severity High \
            --export results.sarif

      - name: Upload SARIF to GitHub Code Scanning
        uses: github/codeql-action/upload-sarif@v3
        if: always()
        with:
          sarif_file: results.sarif

  analyze-full:
    name: Full Analysis
    if: github.event_name == 'push'
    needs: build
    runs-on: ubuntu-latest
    permissions:
      security-events: write
    steps:
      - uses: actions/checkout@v4

      - name: Download aurora-lint binary
        uses: actions/download-artifact@v4
        with:
          name: aurora-lint-binary

      - name: Make aurora-lint executable
        run: chmod +x aurora-lint

      - name: Run aurora-lint (full scan)
        run: |
          ./aurora-lint . -d . \
            --min-severity Medium \
            --fail-on-severity High \
            --export results.sarif

      - name: Upload SARIF to GitHub Code Scanning
        uses: github/codeql-action/upload-sarif@v3
        if: always()
        with:
          sarif_file: results.sarif

Azure DevOps

An example Azure Pipelines configuration is at docs/azure-pipelines.yml. Its pull-request job passes --diff-base origin/main, the branch its pr trigger targets:

# aurora-lint Static Analysis - Azure DevOps Example Pipeline
#
# This pipeline runs aurora-lint CERT C analysis on your C/C++ codebase.
# - On PRs: reports only on the C files the PR changes (--diff-base mode)
# - On push to main: full repository scan
# - Publishes SARIF results as a build artifact
#
# Prerequisites:
#   - Rust toolchain installed on the agent (or use a Rust container)
#   - A rules manifest passed with -m (or the built-in default, which enables
#     every implemented rule)

trigger:
  branches:
    include:
      - main

pr:
  branches:
    include:
      - main

pool:
  vmImage: 'ubuntu-latest'

variables:
  CARGO_TERM_COLOR: always

stages:
  - stage: Build
    displayName: Build aurora-lint
    jobs:
      - job: BuildAuroraLint
        displayName: Build aurora-lint binary
        steps:
          - task: Cache@2
            inputs:
              key: 'cargo | "$(Agent.OS)" | Cargo.lock'
              restoreKeys: |
                cargo | "$(Agent.OS)"
              path: $(Pipeline.Workspace)/.cargo
            displayName: Cache Cargo

          - script: |
              cargo build --release
            displayName: Build aurora-lint

          - task: PublishPipelineArtifact@1
            inputs:
              targetPath: target/release/aurora-lint
              artifactName: aurora-lint-binary
            displayName: Publish aurora-lint binary

  - stage: Analyze
    displayName: Run Analysis
    dependsOn: Build
    jobs:
      - job: AnalyzePR
        displayName: Analyze PR (diff only)
        condition: eq(variables['Build.Reason'], 'PullRequest')
        steps:
          - checkout: self
            # --diff-base needs the base branch and the history back to the
            # merge base; fetchDepth: 0 fetches every branch and the full history.
            fetchDepth: 0

          - task: DownloadPipelineArtifact@2
            inputs:
              artifactName: aurora-lint-binary
              targetPath: $(Build.SourcesDirectory)
            displayName: Download aurora-lint binary

          # PATH must be the repository root. A checkout has no uncommitted
          # changes, so plain --diff would scan nothing here. origin/main is
          # the branch the pr trigger above targets: change them together.
          - script: |
              chmod +x aurora-lint
              ./aurora-lint . --diff-base origin/main \
                --min-severity Medium \
                --fail-on-severity High \
                --export results.sarif
            displayName: Run aurora-lint (diff mode)

          - task: PublishBuildArtifacts@1
            inputs:
              pathToPublish: results.sarif
              artifactName: sarif-results
            displayName: Publish SARIF results
            condition: always()

      - job: AnalyzeFull
        displayName: Full Analysis
        condition: ne(variables['Build.Reason'], 'PullRequest')
        steps:
          - checkout: self

          - task: DownloadPipelineArtifact@2
            inputs:
              artifactName: aurora-lint-binary
              targetPath: $(Build.SourcesDirectory)
            displayName: Download aurora-lint binary

          - script: |
              chmod +x aurora-lint
              ./aurora-lint . -d . \
                --min-severity Medium \
                --fail-on-severity High \
                --export results.sarif
            displayName: Run aurora-lint (full scan)

          - task: PublishBuildArtifacts@1
            inputs:
              pathToPublish: results.sarif
              artifactName: sarif-results
            displayName: Publish SARIF results
            condition: always()

Knowing What the Scan Could Not See

A clean scan of code the analyzer could not fully read is not the same as a clean scan. aurora-lint works without a preprocessor, so heavy macro use or a header it never found can leave parts of a tree opaque to the dataflow rules without any finding saying so. --report-macro-gaps=FILE writes where that happened as JSON (skipped macro definitions, unresolved #includes, calls it could not attribute) without changing a single finding; keep the file as a build artifact next to the SARIF, and treat a jump in its per-kind totals the way you would treat a jump in findings:

aurora-lint . -d . --export results.sarif --report-macro-gaps=macro-gaps.json

The kinds and what each means are in Advanced CLI Usage.

SARIF Integration Tips

  • GitHub Code Scanning: Use github/codeql-action/upload-sarif@v3 to surface aurora-lint violations as code scanning alerts on PRs and the Security tab.

  • Azure DevOps: Publish SARIF as a build artifact. Third-party extensions (e.g., SARIF SAST Scans Tab) can render results inline.

  • VS Code: Open .sarif files with the SARIF Viewer extension for inline annotations.

  • IDE Integration: Any tool that consumes SARIF 2.1.0 can display aurora-lint results.

CI/CD Readiness

Component

Status

Readiness

Output Formats

SARIF 2.1.0, JSON

100%

Exit Codes

--fail-on-violation, --fail-on-severity; 3 for an incomplete scan (Error Handling and Exit Codes)

100%

Severity Filtering

--min-severity, --fail-on-severity

100%

Rule Filtering

--rules ARR30-C,MEM30-C

100%

Incremental

--diff (uncommitted changes), --diff-base REF (a branch’s changes)

90%

CI Workflows

GitHub Actions + Azure DevOps templates

100%

Suppressions

SHA-256 code-location

70%

Docker

No image published

0%

Remaining gaps:

  1. No baseline-aware suppression — can’t report “only new violations since last run”

  2. No Docker image for containerized CI/CD

  3. Unclassified real-world violation density — no ground truth to split TP vs FP on production code