Skip to content

feat: Implement GitHub Actions Caching for .same Directory #71

@drlucaa

Description

@drlucaa

same relies on a robust caching strategy using a local Content Addressable Store (CAS) located at .same/store and tool resolution caches in .same/cache. Currently, CI/CD pipelines must rebuild the task graph and re-resolve Nix environments on every run, leading to slower build times.

This issue involves implementing a GitHub Action step in our CI workflow to persist the .same directory across runs. This will allow CI agents to share build metadata, input/output hashes, and resolved environment variable sets, significantly reducing compute time for incremental changes.

Goals

  • Reduce CI Latency: Skip tasks that have already been executed with identical inputs by restoring the BuildInfo store.
  • Persist Environments: Cache resolved Nix tool environments in .same/cache/environments to avoid expensive nix print-dev-env calls during Phase 1 hydration.
  • Deterministic Keying: Ensure the cache key accurately reflects changes in tool definitions, dependency locks, and the Nix flake configuration.

Acceptance Criteria

  • The .github/workflows/ci.yml file includes an actions/cache step that targets the .same directory.

  • The cache key is generated using a hash of the following files to ensure determinism:

  • **/same.yaml and **/same.work.yaml (Task definitions and tool aliases).

  • cli/go.sum (Go dependency changes).

  • flake.lock (Nix toolchain revisions).

  • The cache is restored before the Generate Go source files and Run tests steps in the CI workflow.

  • The cache is successfully updated/saved after a successful build execution.

  • Verification that a "Cached Run" in CI contains "Skipped (Cached)" in the output for unchanged tasks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions