diff --git a/.github/workflows/flutter-prep.yaml b/.github/workflows/flutter-prep.yaml index 7e1e9a9149b..068c4f14a36 100644 --- a/.github/workflows/flutter-prep.yaml +++ b/.github/workflows/flutter-prep.yaml @@ -3,7 +3,6 @@ # found in the LICENSE file. name: Flutter SDK prep - on: workflow_call: inputs: @@ -15,6 +14,9 @@ on: latest_flutter_candidate: description: "The latest Flutter candidate version." value: ${{ jobs.reusable-flutter-prep.outputs.latest_flutter_candidate }} + mock_cache_key: + description: "The key used to cache the mocks" + value: ${{ steps.determine-mocks-cache-id.outputs.mocks_cache_id}} jobs: reusable-flutter-prep: @@ -71,3 +73,30 @@ jobs: ./flutter-sdk/bin/flutter config --no-analytics ./flutter-sdk/bin/flutter doctor ./flutter-sdk/bin/cache/dart-sdk/bin/dart --disable-analytics + - name: Determine Mocks Cache Id + id: determine-mocks-cache-id + run: echo "mocks_cache_id=$MOCKS_CACHE_ID" >> "GITHUB_OUTPUT" + env: + MOCKS_CACHE_ID: mocks-${{ runner.os }}-${{ steps.flutter-candidate.outputs.FLUTTER_CANDIDATE }}-${{env.GITHUB_SHA}} + - name: Generate Mocks + run: | + export PATH="$PATH":`pwd`/flutter-sdk/bin/cache/dart-sdk/bin/ + export PATH="$PATH":`pwd`/flutter-sdk/bin/ + + pushd tool + flutter pub get + popd + + echo $PATH + # Fetch dependencies + ./tool/bin/devtools_tool pub-get --only-main + + + # Generate code. + ./tool/bin/devtools_tool generate-code + - name: Cache Mocks + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 + with: + path: | + ./packages/**mocks** + key: ${{env.MOCK_CACHE_KEY}}