From a9a0e351579ad3153ee0324414283fd3bf8bdcb8 Mon Sep 17 00:00:00 2001 From: Azincc Date: Thu, 12 Mar 2026 22:18:05 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=A6=BB=E7=BA=BF?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E7=8A=B6=E6=80=81=E9=A1=B5=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=92=8CUI=E6=A0=B7=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E8=B5=84=E6=BA=90URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/offline_download_status_page.dart | 91 ++++++++++++++----- 1 file changed, 69 insertions(+), 22 deletions(-) diff --git a/lib/features/offline/pages/offline_download_status_page.dart b/lib/features/offline/pages/offline_download_status_page.dart index 13449dad..ddf0c41e 100644 --- a/lib/features/offline/pages/offline_download_status_page.dart +++ b/lib/features/offline/pages/offline_download_status_page.dart @@ -245,17 +245,40 @@ class _JobTile extends ConsumerWidget { required this.onSelect, }); + /// 过滤掉包含 URL 的消息 + static bool _isUrl(String text) { + final t = text.trim().toLowerCase(); + return t.startsWith('http://') || + t.startsWith('https://') || + t.startsWith('www.') || + t.contains('://'); + } + @override Widget build(BuildContext context, WidgetRef ref) { - final percent = (job.progressRatio * 100).clamp(0, 100).toStringAsFixed(0); final title = (job.title ?? '').isNotEmpty ? job.title! : job.jobId; - final subtitleParts = [ + + // 构建 artist · album 行 + final metaParts = [ if ((job.artist ?? '').isNotEmpty) job.artist!, - '${job.statusDisplayName} · $percent%', - if (job.message != null && job.message!.trim().isNotEmpty) job.message!, - if (job.isFailed && job.error != null && job.error!.trim().isNotEmpty) - '❌ ${job.error}', + if ((job.album ?? '').isNotEmpty) job.album!, ]; + final metaLine = metaParts.join(' · '); + + // 状态行:活动状态显示百分比,完成/失败状态只显示状态名 + final String statusLine; + if (job.isActive) { + final percent = + (job.progressRatio * 100).clamp(0, 100).toStringAsFixed(0); + statusLine = '${job.statusDisplayName} · $percent%'; + } else { + statusLine = job.statusDisplayName; + } + + // 过滤掉包含 URL 的 message + final showMessage = job.message != null && + job.message!.trim().isNotEmpty && + !_isUrl(job.message!); return InkWell( onTap: selectMode ? onSelect : null, @@ -267,29 +290,58 @@ class _JobTile extends ConsumerWidget { job.isDone ? Icons.check_circle : job.isFailed - ? Icons.error - : job.isCancelled - ? Icons.cancel - : Icons.downloading, + ? Icons.error + : job.isCancelled + ? Icons.cancel + : Icons.downloading, color: job.isDone ? Colors.green : job.isFailed - ? Colors.red - : job.isCancelled - ? Colors.grey - : Theme.of(context).colorScheme.primary, + ? Colors.red + : job.isCancelled + ? Colors.grey + : Theme.of(context).colorScheme.primary, ), title: Text(title, maxLines: 1, overflow: TextOverflow.ellipsis), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - for (final line in subtitleParts) + if (metaLine.isNotEmpty) Text( - line, + metaLine, maxLines: 1, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.bodySmall, ), + Text( + statusLine, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.bodySmall?.copyWith( + color: job.isFailed + ? Colors.red + : Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + if (showMessage) + Text( + job.message!, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.bodySmall, + ), + if (job.isFailed && + job.error != null && + job.error!.trim().isNotEmpty) + Text( + '❌ ${job.error}', + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith(color: Colors.red), + ), if (job.isActive) Padding( padding: const EdgeInsets.only(top: 4), @@ -297,12 +349,7 @@ class _JobTile extends ConsumerWidget { ), ], ), - trailing: selectMode - ? null - : Text( - job.album ?? '', - style: Theme.of(context).textTheme.bodySmall, - ), + trailing: selectMode ? null : const SizedBox.shrink(), ), ); } From a69ce97b4f772b552d0d415859a41eea612bd496 Mon Sep 17 00:00:00 2001 From: Azincc Date: Thu, 12 Mar 2026 22:18:58 +0800 Subject: [PATCH 2/6] chore: bump version to v0.4.5 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 5574d17d..67ed2c77 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts -version: 0.4.4+1 +version: 0.4.5+1 environment: sdk: ^3.10.8 From f036a22b0ec6c58f28b607df17f8783c667f8bd2 Mon Sep 17 00:00:00 2001 From: Azincc Date: Fri, 13 Mar 2026 16:14:11 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E6=8E=A8=E8=8D=90=E5=8F=98=E6=88=90=E7=AB=96?= =?UTF-8?q?=E5=90=91=E5=8D=95=E5=88=97=E7=9A=84=E5=B8=83=E5=B1=80=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/features/discover/pages/discover_page.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/features/discover/pages/discover_page.dart b/lib/features/discover/pages/discover_page.dart index fa4918c3..64ca32e2 100644 --- a/lib/features/discover/pages/discover_page.dart +++ b/lib/features/discover/pages/discover_page.dart @@ -179,15 +179,18 @@ class _RandomSongsSectionState extends ConsumerState { ? songs.length : (songs.length > 6 ? 6 : songs.length); + // 根据屏幕宽度计算列数:手机2列,平板及以上3列 + final screenWidth = MediaQuery.of(context).size.width; + final crossAxisCount = screenWidth >= 600 ? 3 : 2; + return Column( children: [ GridView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), - gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( - maxCrossAxisExtent: 350, - mainAxisExtent: - 64, // Fixed height instead of scaling based on width + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: crossAxisCount, + mainAxisExtent: 64, crossAxisSpacing: 12, mainAxisSpacing: 8, ), From 4f049cdf32fc60380abc5ef02dbd152502b37b11 Mon Sep 17 00:00:00 2001 From: Azincc Date: Fri, 13 Mar 2026 16:25:47 +0800 Subject: [PATCH 4/6] Add automated PR checks --- .github/workflows/pr_checks.yml | 66 +++++++++++++++++++++++++++++++ lib/providers/music_provider.dart | 6 ++- test/test_hero_animation.dart | 15 +------ test/widget_test.dart | 12 ++---- 4 files changed, 74 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/pr_checks.yml diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml new file mode 100644 index 00000000..0c40d072 --- /dev/null +++ b/.github/workflows/pr_checks.yml @@ -0,0 +1,66 @@ +name: PR Checks + +on: + workflow_dispatch: + pull_request: + types: + - opened + - synchronize + - reopened + - ready_for_review + +permissions: + contents: read + +concurrency: + group: pr-checks-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + pr-checks: + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: subosito/flutter-action@v2 + with: + channel: "stable" + cache: true + + - name: Cache Pub dependencies + uses: actions/cache@v4 + with: + path: ~/.pub-cache + key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pub- + + - name: Cache build_runner + uses: actions/cache@v4 + with: + path: .dart_tool/build + key: ${{ runner.os }}-build-runner-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-build-runner- + + - name: Install dependencies + run: flutter pub get + + - name: Verify generated files + run: dart run build_runner build --delete-conflicting-outputs + + - name: Fail if generated files changed + shell: bash + run: | + if [[ -n "$(git status --short --untracked-files=all)" ]]; then + git status --short --untracked-files=all + echo "::error::Generated files are not up to date. Run build_runner and commit the updated files." + exit 1 + fi + + - name: Static analysis + run: flutter analyze + + - name: Run tests + run: flutter test diff --git a/lib/providers/music_provider.dart b/lib/providers/music_provider.dart index 2da7b66e..a1485f0f 100644 --- a/lib/providers/music_provider.dart +++ b/lib/providers/music_provider.dart @@ -192,8 +192,9 @@ final albumDetailProvider = FutureProvider.autoDispose final repository = ref.watch(musicRepositoryProvider); final cache = ref.watch(metadataCacheRepositoryProvider); final libraryId = ref.watch(activeLibraryProvider)?.id; - if (repository == null || libraryId == null || libraryId.isEmpty) + if (repository == null || libraryId == null || libraryId.isEmpty) { return null; + } return _fetchWithCacheFallback( ref: ref, @@ -255,8 +256,9 @@ final artistDetailProvider = FutureProvider.autoDispose final repository = ref.watch(musicRepositoryProvider); final cache = ref.watch(metadataCacheRepositoryProvider); final libraryId = ref.watch(activeLibraryProvider)?.id; - if (repository == null || libraryId == null || libraryId.isEmpty) + if (repository == null || libraryId == null || libraryId.isEmpty) { return null; + } return _fetchWithCacheFallback( ref: ref, diff --git a/test/test_hero_animation.dart b/test/test_hero_animation.dart index 1a436909..801c5d2a 100644 --- a/test/test_hero_animation.dart +++ b/test/test_hero_animation.dart @@ -23,21 +23,9 @@ void main() { BuildContext fromHeroContext, BuildContext toHeroContext, ) { - final fromText = - (fromHeroContext.widget as Hero).child as Text; - final toText = (toHeroContext.widget as Hero).child as Text; - - print('--- Builder Called ---'); - print('Direction: $flightDirection'); - print('fromHero: ${fromText.data}'); - print('toHero: ${toText.data}'); - return AnimatedBuilder( animation: animation, - builder: (context, _) { - print( - 'Animation value: ${animation.value} (Direction: $flightDirection)', - ); + builder: (_, child) { return const Text('Shuttle'); }, ); @@ -72,7 +60,6 @@ void main() { await tester.pump(const Duration(milliseconds: 100)); // During push await tester.pumpAndSettle(); - print('====== NOW POPPING ======'); navKey.currentState!.pop(); await tester.pump(); await tester.pump(const Duration(milliseconds: 100)); // During pop diff --git a/test/widget_test.dart b/test/widget_test.dart index b31de9ab..b375a2c8 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -4,17 +4,11 @@ import 'package:echoes/app.dart'; void main() { testWidgets('App smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget( - const ProviderScope( - child: App(), - ), - ); + await tester.pumpWidget(const ProviderScope(child: App())); - // Verify that the app displays the splash screen - expect(find.text('SubSonic Flow'), findsOneWidget); + expect(find.byType(App), findsOneWidget); + expect(find.byType(ProviderScope), findsOneWidget); - // Drain splash delay timer to avoid pending timer failure. await tester.pump(const Duration(milliseconds: 600)); }); } From 1e55fc0e383d9eec56b0f80a43b18c3a12702922 Mon Sep 17 00:00:00 2001 From: Azincc Date: Fri, 13 Mar 2026 16:30:40 +0800 Subject: [PATCH 5/6] Refine generated-file PR check --- .github/workflows/pr_checks.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index 0c40d072..f03a97ec 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -47,14 +47,24 @@ jobs: - name: Install dependencies run: flutter pub get + - name: Snapshot workspace status + shell: bash + run: git status --short --untracked-files=all > /tmp/pre_codegen_status.txt + - name: Verify generated files run: dart run build_runner build --delete-conflicting-outputs - name: Fail if generated files changed shell: bash run: | - if [[ -n "$(git status --short --untracked-files=all)" ]]; then - git status --short --untracked-files=all + before_status="$(cat /tmp/pre_codegen_status.txt)" + after_status="$(git status --short --untracked-files=all)" + + if [[ "$before_status" != "$after_status" ]]; then + echo "Workspace status before code generation:" + printf '%s\n' "$before_status" + echo "Workspace status after code generation:" + printf '%s\n' "$after_status" echo "::error::Generated files are not up to date. Run build_runner and commit the updated files." exit 1 fi From 0b7b346fbffab1314d6e0e8e04b6411d0d07715f Mon Sep 17 00:00:00 2001 From: Azincc Date: Fri, 13 Mar 2026 16:41:28 +0800 Subject: [PATCH 6/6] Improve workflow caching --- .github/workflows/build_android.yml | 19 +++++++++---------- .github/workflows/build_ios.yml | 15 +++++++++++---- .github/workflows/build_linux.yml | 15 +++++++++++---- .github/workflows/build_macos.yml | 15 +++++++++++---- .github/workflows/build_web.yml | 15 +++++++++++---- .github/workflows/build_windows.yml | 15 +++++++++++---- .github/workflows/pr_checks.yml | 19 +++++++++---------- 7 files changed, 73 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build_android.yml b/.github/workflows/build_android.yml index 646c4cf5..bb50bdf4 100644 --- a/.github/workflows/build_android.yml +++ b/.github/workflows/build_android.yml @@ -9,23 +9,22 @@ on: permissions: contents: write +env: + FLUTTER_VERSION: 3.38.9 + jobs: build-android: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 + id: flutter-action with: channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - - - name: Cache Pub dependencies - uses: actions/cache@v4 - with: - path: ~/.pub-cache - key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} - restore-keys: | - ${{ runner.os }}-pub- + cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }} + pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }} - name: Cache Gradle packages uses: actions/cache@v4 @@ -41,9 +40,9 @@ jobs: uses: actions/cache@v4 with: path: .dart_tool/build - key: ${{ runner.os }}-build-runner-${{ hashFiles('lib/**/*.dart', 'pubspec.lock') }} + key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }} restore-keys: | - ${{ runner.os }}-build-runner- + ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}- - name: Decode keystore if: env.KEYSTORE_BASE64 != '' diff --git a/.github/workflows/build_ios.yml b/.github/workflows/build_ios.yml index 1ee21100..a76dd8ea 100644 --- a/.github/workflows/build_ios.yml +++ b/.github/workflows/build_ios.yml @@ -3,23 +3,30 @@ name: Build iOS on: workflow_dispatch: +env: + FLUTTER_VERSION: 3.38.9 + jobs: build-ios: runs-on: macos-latest steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 + id: flutter-action with: channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true + cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }} + pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }} - - name: Cache Pub dependencies + - name: Cache build_runner uses: actions/cache@v4 with: - path: ~/.pub-cache - key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + path: .dart_tool/build + key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }} restore-keys: | - ${{ runner.os }}-pub- + ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}- - name: Install dependencies run: flutter pub get diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index 84f58a82..eff86ff8 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -3,6 +3,9 @@ name: Build Linux on: workflow_dispatch: +env: + FLUTTER_VERSION: 3.38.9 + jobs: build-linux: runs-on: ubuntu-latest @@ -15,17 +18,21 @@ jobs: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev - uses: subosito/flutter-action@v2 + id: flutter-action with: channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true + cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }} + pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }} - - name: Cache Pub dependencies + - name: Cache build_runner uses: actions/cache@v4 with: - path: ~/.pub-cache - key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + path: .dart_tool/build + key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }} restore-keys: | - ${{ runner.os }}-pub- + ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}- - name: Install dependencies run: flutter pub get diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml index 21fe21df..98c19476 100644 --- a/.github/workflows/build_macos.yml +++ b/.github/workflows/build_macos.yml @@ -3,23 +3,30 @@ name: Build macOS on: workflow_dispatch: +env: + FLUTTER_VERSION: 3.38.9 + jobs: build-macos: runs-on: macos-latest steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 + id: flutter-action with: channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true + cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }} + pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }} - - name: Cache Pub dependencies + - name: Cache build_runner uses: actions/cache@v4 with: - path: ~/.pub-cache - key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + path: .dart_tool/build + key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }} restore-keys: | - ${{ runner.os }}-pub- + ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}- - name: Install dependencies run: flutter pub get diff --git a/.github/workflows/build_web.yml b/.github/workflows/build_web.yml index bd3f9dfb..725ce3eb 100644 --- a/.github/workflows/build_web.yml +++ b/.github/workflows/build_web.yml @@ -3,23 +3,30 @@ name: Build Web on: workflow_dispatch: +env: + FLUTTER_VERSION: 3.38.9 + jobs: build-web: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 + id: flutter-action with: channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true + cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }} + pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }} - - name: Cache Pub dependencies + - name: Cache build_runner uses: actions/cache@v4 with: - path: ~/.pub-cache - key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + path: .dart_tool/build + key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }} restore-keys: | - ${{ runner.os }}-pub- + ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}- - name: Install dependencies run: flutter pub get diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index e128ddec..bd599bb7 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -3,23 +3,30 @@ name: Build Windows on: workflow_dispatch: +env: + FLUTTER_VERSION: 3.38.9 + jobs: build-windows: runs-on: windows-latest steps: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 + id: flutter-action with: channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true + cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }} + pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }} - - name: Cache Pub dependencies + - name: Cache build_runner uses: actions/cache@v4 with: - path: ~\AppData\Local\Pub\Cache - key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + path: .dart_tool/build + key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }} restore-keys: | - ${{ runner.os }}-pub- + ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}- - name: Install dependencies run: flutter pub get diff --git a/.github/workflows/pr_checks.yml b/.github/workflows/pr_checks.yml index f03a97ec..0f03abde 100644 --- a/.github/workflows/pr_checks.yml +++ b/.github/workflows/pr_checks.yml @@ -12,6 +12,9 @@ on: permissions: contents: read +env: + FLUTTER_VERSION: 3.38.9 + concurrency: group: pr-checks-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -24,25 +27,21 @@ jobs: - uses: actions/checkout@v4 - uses: subosito/flutter-action@v2 + id: flutter-action with: channel: "stable" + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - - - name: Cache Pub dependencies - uses: actions/cache@v4 - with: - path: ~/.pub-cache - key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} - restore-keys: | - ${{ runner.os }}-pub- + cache-key: flutter-sdk-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ runner.arch }} + pub-cache-key: flutter-pub-${{ runner.os }}-stable-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.lock') }} - name: Cache build_runner uses: actions/cache@v4 with: path: .dart_tool/build - key: ${{ runner.os }}-build-runner-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }} + key: ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}-${{ hashFiles('lib/**/*.dart', 'test/**/*.dart', 'pubspec.lock') }} restore-keys: | - ${{ runner.os }}-build-runner- + ${{ runner.os }}-build-runner-${{ env.FLUTTER_VERSION }}- - name: Install dependencies run: flutter pub get