diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f5ed341553..436c9accc1 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -38,6 +38,28 @@ jobs: job: sdk-analyzer steps: + - name: Store date + id: date + run: echo "::set-output name=today::$(date +'%Y-%m-%d')" + shell: bash + - name: Cache clean flutter + uses: actions/cache@v2 + if: matrix.job == 'flutter' + env: + # Increment version to invalidate bad/obsolete caches. + cache-name: cache-grinder-flutter-v1 + with: + path: ~/.dartdoc_grinder + key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ steps.date.outputs.today }} + - name: Cache .pub-cache + uses: actions/cache@v2 + if: matrix.job == 'flutter' + env: + # Increment version to invalidate bad/obsolete caches. + cache-name: cache-dart-pub-v1 + with: + path: ~/.pub-cache + key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ steps.date.outputs.today }} - name: Configure git if: runner.os == 'Windows' run: git config --global core.autocrlf input diff --git a/tool/grind.dart b/tool/grind.dart index 8fce2ae6c8..28d60dc34e 100644 --- a/tool/grind.dart +++ b/tool/grind.dart @@ -88,7 +88,7 @@ Future get cleanFlutterRepo async { int.parse(lastSynced.readAsStringSync())); } if (lastSyncedTime == null || - DateTime.now().difference(lastSyncedTime) > Duration(hours: 4)) { + DateTime.now().difference(lastSyncedTime) > Duration(hours: 24)) { // Rebuild the repository. if (cleanFlutterDir.existsSync()) { cleanFlutterDir.deleteSync(recursive: true); @@ -185,7 +185,12 @@ final Directory flutterDirDevTools = Map _createThrowawayPubCache() { var pubCache = Directory.systemTemp.createTempSync('pubcache'); var pubCacheBin = Directory(path.join(pubCache.path, 'bin')); - pubCacheBin.createSync(); + var defaultCache = Directory(defaultPubCache); + if (defaultCache.existsSync()) { + copy(defaultCache, pubCache); + } else { + pubCacheBin.createSync(); + } return Map.fromIterables([ 'PUB_CACHE', 'PATH' @@ -870,11 +875,6 @@ class FlutterRepo { ['--version'], workingDirectory: flutterPath, ); - await launcher.runStreamed( - bin, - ['precache'], - workingDirectory: flutterPath, - ); await launcher.runStreamed( bin, ['update-packages'],