Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
7bfcaf9
chore: flutter symbol collector CLI tool
vaind Oct 11, 2023
d1313bd
renames
vaind Oct 12, 2023
7a0c73e
symbol collector CLI integration
vaind Oct 12, 2023
ac1c1c0
fixup getVersion()
vaind Oct 12, 2023
7218df6
collector upload
vaind Oct 12, 2023
d394181
collect platform info with symbol archive
vaind Oct 12, 2023
5e963aa
download and extract zip archives
vaind Oct 12, 2023
c4aa8a8
download via cli bin
vaind Oct 12, 2023
a7a80ea
upload via symbol-collector cli
vaind Oct 12, 2023
667c144
add symbol collector CI
vaind Oct 13, 2023
5390bcf
extract inner zip files
vaind Oct 13, 2023
2bc4ed7
test symbol collector in CI
vaind Oct 13, 2023
ed79ef4
fix tests
vaind Oct 13, 2023
ff91b35
chore: update changelog
vaind Oct 13, 2023
795e7a4
fix tests
vaind Oct 13, 2023
816ae3e
fix tests
vaind Oct 13, 2023
5170a46
upload android symbols
vaind Oct 13, 2023
caa9b62
fix duplicate upload
vaind Oct 13, 2023
4724c81
upload symbols for all of 3.13.*
vaind Oct 24, 2023
b55becb
cache previous symbol collector successful uploads
vaind Oct 24, 2023
cb298d6
fix artifacts
vaind Oct 24, 2023
57efb36
we need to use cache
vaind Oct 24, 2023
8d686cb
cron
vaind Oct 24, 2023
bdfcfdc
test
vaind Oct 24, 2023
cee0761
use artifacts
vaind Oct 24, 2023
611f636
run for all v3 flutter versions
vaind Oct 24, 2023
321198c
fixup changelog
vaind Oct 24, 2023
6834bc8
fixup changelog
vaind Oct 25, 2023
dfb8fee
refactor: move status cache to a separate file
vaind Oct 25, 2023
deca8fc
change artifact action to download from previous runs
vaind Oct 25, 2023
12f6033
fix status cache
vaind Oct 25, 2023
0dc96c3
fix status cache
vaind Oct 25, 2023
3875129
register symbol collector CLI updater
vaind Oct 25, 2023
6ba64f6
log status change
vaind Oct 25, 2023
d352c73
fix status caching
vaind Oct 25, 2023
6d163a6
fix
vaind Oct 25, 2023
b7e4719
process all flutter v3 subversions
vaind Oct 25, 2023
2edb9be
try to fix memory usage
vaind Oct 25, 2023
adf8f60
cleanup earlier
vaind Oct 25, 2023
6529c4b
roll back changes after figuring out the issue is with symbol collect…
vaind Oct 25, 2023
6f1fc8d
update symbol-collector to the latest version
vaind Oct 26, 2023
7b9fb06
rename .successful to .cache
vaind Oct 26, 2023
e7a20f3
don't use version in the status cache
vaind Oct 26, 2023
9461372
remove temp code
vaind Oct 26, 2023
986f954
run cron every hour
vaind Oct 26, 2023
9b74649
update symbol collector issue link
vaind Oct 27, 2023
5edbf3d
Merge branch 'main' into feat/flutter-symbol-upload
vaind Oct 30, 2023
0d8652b
minor fixes
vaind Oct 30, 2023
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
Prev Previous commit
Next Next commit
cache previous symbol collector successful uploads
  • Loading branch information
vaind committed Oct 25, 2023
commit b55becbe55661a4fac85037eac98ad0666a21e11
15 changes: 12 additions & 3 deletions .github/workflows/flutter-symbols.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Flutter symbols collection
on:
push: # Temporary so we get the workflow on the PR branch
push: # TODO REMOVE
workflow_dispatch:
inputs:
flutter_version:
Expand All @@ -27,15 +27,24 @@ jobs:
run:
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3

- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1

- run: dart pub get

- uses: actions/download-artifact@v3
with:
name: flutter-symbol-collector-database
path: scripts/flutter_symbol_collector/.successful

# - run: dart run bin/flutter_symbol_collector.dart --version=${{ inputs.flutter_version }}
- run: dart run bin/flutter_symbol_collector.dart --version=3.13.*
- run: dart run bin/flutter_symbol_collector.dart --version=3.13.8
env:
GITHUB_TOKEN: ${{ github.token }}

- uses: actions/upload-artifact@v3
with:
name: flutter-symbol-collector-database
path: scripts/flutter_symbol_collector/.successful
3 changes: 2 additions & 1 deletion scripts/flutter_symbol_collector/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
# Created by `dart pub`
.dart_tool/

.temp
.temp
.successful
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ final source = FlutterSymbolSource(
: Authentication.withToken(githubToken));
final fs = LocalFileSystem();
final tempDir = fs.currentDirectory.childDirectory('.temp');
final successDir = fs.currentDirectory.childDirectory('.successful');
late final SymbolCollectorCli collector;

void main(List<String> arguments) async {
Expand All @@ -25,6 +26,7 @@ void main(List<String> arguments) async {
final argVersion = args['version'] as String;

collector = await SymbolCollectorCli.setup(tempDir);
successDir.createSync(recursive: true);

// If a specific version was given, run just for this version.
if (argVersion.isNotEmpty &&
Expand Down Expand Up @@ -52,14 +54,36 @@ void main(List<String> arguments) async {
}

Future<void> processFlutterVerion(FlutterVersion version) async {
if (bool.hasEnvironment('CI')) {
print('::group::Processing Flutter ${version.tagName}');
}
Logger.root.info('Processing Flutter ${version.tagName}');
Logger.root.info('Engine version: ${await version.engineVersion}');

final archives = await source.listSymbolArchives(version);
final dir = tempDir.childDirectory(version.tagName);
final sdir = successDir.childDirectory(version.tagName.toLowerCase());
for (final archive in archives) {
// Later, we'll write create an empty file to mark this as successful.
final sFile = sdir.childFile(archive.path.toLowerCase());
if (sFile.existsSync()) {
Logger.root
.info('Skipping ${archive.path} - already processed successfully');
continue;
}

final archiveDir = dir.childDirectory(archive.platform.operatingSystem);
await source.downloadAndExtractTo(archiveDir, archive.path);
await collector.upload(archiveDir, archive.platform, version);
if (!await source.downloadAndExtractTo(archiveDir, archive.path)) {
continue;
}
if (!await collector.upload(archiveDir, archive.platform, version)) {
continue;
}

sFile.createSync(recursive: true);
}

if (bool.hasEnvironment('CI')) {
print('::endgroup::');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class FlutterSymbolSource {
.listTags(_flutterRepo, perPage: 30)
.map((t) => FlutterVersion(t.name));

/// Returns false as the first record value in case there was any error fetching the symbol archives.
Future<List<SymbolArchive>> listSymbolArchives(FlutterVersion version) async {
// example: https://console.cloud.google.com/storage/browser/flutter_infra_release/flutter/9064459a8b0dcd32877107f6002cc429a71659d1
final prefix = 'flutter/${await version.engineVersion}/';
Expand Down Expand Up @@ -73,7 +74,8 @@ class FlutterSymbolSource {

/// Downloads the remote [filePath] to the given [target] directory.
/// If it's an archive, extracts the content instead.
Future<void> downloadAndExtractTo(Directory target, String filePath) async {
/// returns `true` if the file was downloaded and extracted successfully.
Future<bool> downloadAndExtractTo(Directory target, String filePath) async {
if (path.extension(filePath) == '.zip') {
target = await target
.childDirectory(path.withoutExtension(filePath))
Expand All @@ -89,6 +91,7 @@ class FlutterSymbolSource {
_log.warning('Failed to download $filePath to $target', e, trace);
// Remove the directory so that we don't leave a partial extraction.
await target.delete(recursive: true);
return false;
}
} else {
_log.fine('Downloading $filePath to $target');
Expand All @@ -104,8 +107,10 @@ class FlutterSymbolSource {
_log.warning('Failed to download $filePath to $target', e, trace);
await sink.close();
await file.delete();
return false;
}
}
return true;
}

Future<void> _extractZip(Directory target, Archive archive) async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,28 @@ class SymbolCollectorCli {

Future<String> getVersion() => _execute(['--version', '-h']);

Future<void> upload(
Future<bool> upload(
Directory dir, Platform symbolsPlatform, FlutterVersion flutterVersion,
{bool dryRun = false}) {
{bool dryRun = false}) async {
final type = symbolsPlatform.operatingSystem;
return _execute([
'--upload',
'directory',
'--path',
dir.path,
'--batch-type',
type,
'--bundle-id',
'flutter-${flutterVersion.tagName}-$type',
'--server-endpoint',
'https://symbol-collector.services.sentry.io/',
]);
try {
await _execute([
'--upload',
'directory',
'--path',
dir.path,
'--batch-type',
type,
'--bundle-id',
'flutter-${flutterVersion.tagName}-$type',
'--server-endpoint',
'https://symbol-collector.services.sentry.io/',
]);
} catch (e) {
_log.warning('Failed to upload symbols from ${dir.path}', e);
return false;
}
return true;
}

Future<String> _execute(List<String> arguments) async {
Expand Down