actions / actions/cache

Caching Flutter/iOS dependencies

Open
#1,235 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.6k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

I declared those actions to cache dependencies for a Flutter app targeting iOS:

      - name: Cache dependencies
        uses: actions/cache@v3
        with:
          path: |
            ${{ env.FLUTTER_ROOT }}/.pub-cache
            **/.packages
            **/.flutter-plugins
            **/.flutter-plugin-dependencies
            **/.dart_tool/package_config.json
          key: build-pubspec-${{ hashFiles('**/pubspec.lock') }}
          restore-keys: |
            build-pubspec-

      - name: Cache pods
        uses: actions/cache@v3
        with:
          path: ios/Pods
          key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-pods-

Those actions are (seems ?) to be working fine (cache is created, retrieved and restored) but my build action re-download everything every time as if nothing was restored. What I am missing ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the cache steps in the workflow and compare their paths with the dependency locations used by the Flutter and iOS build. Inspect the cache logs and the contents keyed by pubspec.lock, Podfile.lock, and ios/Pods; done means a restored cache prevents the build from downloading those dependencies again.

Written by the indexing model from the issue text.

Assessment

Tech stack
flutter, github-actions, ios
Domain
ci-cd, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.