Skip to content

Fix cross-platform CI caching (Windows pub-cache + macOS ARM/Intel split) #7

@tsavo-at-pieces

Description

@tsavo-at-pieces

Overview

Two caching issues in the generated CI workflows that affect all multi-platform consumers.

Bug 1: Windows pub-cache path is wrong — cache always misses

File: templates/github/workflows/ci.skeleton.yaml lines 74-78 (and duplicated at 184-188, 283-287)

The cache step uses path: ~/.pub-cache. On Windows, Dart SDK 3.9+ stores the pub cache at %LOCALAPPDATA%\Pub\Cache, NOT ~/.pub-cache. Every Windows CI run does a full dart pub get from scratch with no cache benefit.

Fix: Use multi-path cache OR set PUB_CACHE env var:

- name: Cache Dart pub dependencies
  uses: actions/cache@v5.0.3
  with:
    path: |
      ~/.pub-cache
      ${{ env.LOCALAPPDATA }}\Pub\Cache
    key: ${{ runner.os }}-${{ runner.arch }}-dart-pub-${{ hashFiles('**/pubspec.yaml') }}
    restore-keys: ${{ runner.os }}-${{ runner.arch }}-dart-pub-

Bug 2: macOS ARM and Intel share the same cache key

runner.os = macOS for both macos-latest (ARM64) and macos-15-intel (x86_64). Cache key ${{ runner.os }}-dart-pub-... is identical for both. If a git dependency contains native compiled artifacts, one architecture's binaries get restored to the other.

Fix: Include runner.arch in cache key (shown above).

Impact

  • Windows: 2-5 minutes wasted per CI run (no pub cache)
  • macOS: Latent binary incompatibility for repos with native deps

Acceptance Criteria

  • Windows pub-cache path includes LOCALAPPDATA fallback
  • Cache key includes runner.arch to separate ARM/Intel
  • Both changes in template (affects all 3 cache locations in skeleton)
  • Regenerate consumer workflows to pick up the fix

Metadata

Metadata

Labels

P1-highHigh priorityarea/cross-platformCross-platform support (macOS, Windows, Linux)bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions