Skip to content

chore(ci): create reusable GitHub Actions composite action for ecosystem vcpkg setup #510

Description

@kcenon

What

Create a shared, reusable GitHub Actions composite action that standardizes vcpkg bootstrap, version pinning, and caching across all kcenon ecosystem CI workflows.

Current CI Patterns (3 different approaches)

Pattern Projects How vcpkg is set up
A: Manifest mode logger, monitoring, network, messaging Clone vcpkg from HEAD, bootstrap, CMAKE_TOOLCHAIN_FILE
B: System packages common, thread, container, database apt/brew/choco, no vcpkg
C: Mixed/special pacs_system, pacs_bridge, dicom_viewer Custom checkout actions, runner-preinstalled vcpkg, manual clone

Key Problems

  1. Pattern A clones vcpkg from HEAD — the resolved vcpkg commit drifts from the declared baseline (d90a9b159c... in vcpkg-configuration.json), breaking reproducibility
  2. Each repo duplicates 15-30 lines of vcpkg setup logic (clone, bootstrap, cache keys, toolchain path)
  3. Cache key strategies differ — some hash vcpkg.json only, others hash vcpkg.json + vcpkg-configuration.json
  4. Only monitoring_system pins vcpkg to the baseline commit (in validate-vcpkg-chain.yml using lukka/run-vcpkg@v11)

Why

  • Non-reproducible builds: Two CI runs on the same commit can produce different results if microsoft/vcpkg main branch changes between them
  • Maintenance cost: A vcpkg cache key bug must be fixed in 6+ repos individually
  • Inconsistent behavior: Some repos use vcpkg install --x-manifest-root=., others rely on CMake's VCPKG_MANIFEST_MODE
  • Onboarding friction: New ecosystem repos must copy-paste and adapt CI setup from existing repos

Where

File Change
.github/actions/setup-vcpkg/action.yml Create composite action
.github/actions/setup-vcpkg/README.md Create usage documentation

Proposed Location

Host the composite action in kcenon/common_system (Tier 0 foundation), referenced by other repos as:

- uses: kcenon/common_system/.github/actions/setup-vcpkg@main

How

Technical Approach

  1. Create composite action with these inputs:
name: 'Setup vcpkg'
description: 'Bootstrap vcpkg pinned to ecosystem baseline with caching'
inputs:
  vcpkg-commit:
    description: 'vcpkg commit to checkout (default: ecosystem baseline)'
    required: false
    default: 'd90a9b159c08169f39adcd1b0f1ac0ca12c4b96c'
  manifest-dir:
    description: 'Directory containing vcpkg.json'
    required: false
    default: '.'
  extra-cache-key:
    description: 'Additional cache key suffix for project-specific differentiation'
    required: false
    default: ''
  1. Action steps:

    • Checkout microsoft/vcpkg at the pinned commit
    • Bootstrap vcpkg (bootstrap-vcpkg.sh / bootstrap-vcpkg.bat)
    • Set VCPKG_ROOT and CMAKE_TOOLCHAIN_FILE environment variables
    • Configure GitHub Actions cache with key: vcpkg-{os}-{hash(vcpkg.json, vcpkg-configuration.json)}-{extra-cache-key}
  2. Outputs:

    • vcpkg-root: Path to vcpkg installation
    • toolchain-file: Path to vcpkg.cmake

Rollout Plan

Phase Scope
1 Create action in common_system, validate in common_system CI
2 Adopt in one Pattern A project (e.g., logger_system)
3 Roll out to remaining Pattern A and C projects

Acceptance Criteria

  • Composite action created at .github/actions/setup-vcpkg/action.yml
  • vcpkg checkout pinned to ecosystem baseline commit by default
  • Cache key includes both vcpkg.json and vcpkg-configuration.json hashes
  • Works on Ubuntu, macOS, and Windows runners
  • At least one ecosystem project's CI workflow migrated to use the action
  • README with usage examples and input documentation
  • Action output provides VCPKG_ROOT and CMAKE_TOOLCHAIN_FILE

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions