Skip to content

Try to cache the clean version of flutter Dartdoc uses #2802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions tool/grind.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Future<FlutterRepo> 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);
Expand Down Expand Up @@ -185,7 +185,12 @@ final Directory flutterDirDevTools =
Map<String, String> _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'
Expand Down Expand Up @@ -870,11 +875,6 @@ class FlutterRepo {
['--version'],
workingDirectory: flutterPath,
);
await launcher.runStreamed(
bin,
['precache'],
workingDirectory: flutterPath,
);
await launcher.runStreamed(
bin,
['update-packages'],
Expand Down