Commit 6afadfe

derdilla <82763757+derdilla@users.noreply.github.com>
2025-02-06 20:30:52
Always use stable flutter for app (#533)
* remove flutter branch from goldens * specify version in pubspec * remove branches from ci * qol improvement for pr golden updates * specify flutter version instead of pinning dart version * Add golden files * Fix golden updating * Update goldens --------- Co-authored-by: GitHub Action (update goldens) <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 5643b6a
.github/workflows/app-CI.yml
@@ -14,10 +14,6 @@ jobs:
   run-tests:
     runs-on: ubuntu-latest
     strategy:
-      matrix:
-        channel:
-          - beta
-          - stable
     permissions:
       contents: write
       pull-requests: write
@@ -34,12 +30,12 @@ jobs:
         uses: actions/cache@v4
         with:
           path: health_data_store/lib
-          key: builder-${{ matrix.channel }}-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }}
+          key: builder-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }}
       - name: Setup dart
         if: steps.cache-generated.outputs.cache-hit != 'true'
         uses: dart-lang/setup-dart@v1
         with:
-          sdk: ${{ matrix.channel }}
+          sdk: stable
       - name: Generate code
         if: steps.cache-generated.outputs.cache-hit != 'true'
         run: dart run build_runner build
@@ -59,5 +55,5 @@ jobs:
         run: flutter pub run build_runner build
         working-directory: app
       - name: Run tests
-        run: flutter test --coverage --dart-define="channel=${{ matrix.channel }}"
+        run: flutter test
         working-directory: app
.github/workflows/extendend-testing.yml
@@ -7,11 +7,6 @@ jobs:
   setup-env:
     name: "Setup environment"
     runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        branch:
-          - beta
-          - stable
     steps:
       - name: Checkout code
         uses: actions/checkout@v4
@@ -25,12 +20,12 @@ jobs:
         uses: actions/cache@v4
         with:
           path: health_data_store/lib
-          key: builder-${{ matrix.branch }}-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }}
+          key: builder-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }}
       - name: Setup dart
         if: steps.cache-generated.outputs.cache-hit != 'true'
         uses: dart-lang/setup-dart@v1
         with:
-          sdk: ${{ matrix.branch }}
+          sdk: stable
       - name: Generate code
         if: steps.cache-generated.outputs.cache-hit != 'true'
         run: dart run build_runner build
@@ -38,7 +33,7 @@ jobs:
       - name: Setup Flutter
         uses: subosito/flutter-action@v2
         with:
-          channel: ${{ matrix.branch }}
+          channel: stable
           cache: true
       - name: Disable analytics
         run:
@@ -52,18 +47,13 @@ jobs:
       - name: Upload results
         uses: actions/upload-artifact@v4
         with:
-          name: src-${{ matrix.branch }}
+          name: src
           path: ./
 
   unit-test:
     name: "๐Ÿงฉ๐Ÿงช Run unit tests"
     runs-on: ubuntu-latest
     needs: setup-env
-    strategy:
-      matrix:
-        branch:
-          - beta
-          - stable
     permissions:
       contents: write
       pull-requests: write
@@ -76,11 +66,11 @@ jobs:
       - name: Download src directory
         uses: actions/download-artifact@v4
         with:
-          name: src-${{ matrix.branch }}
+          name: src
       - name: Setup Flutter
         uses: subosito/flutter-action@v2
         with:
-          channel: ${{ matrix.branch }}
+          channel: stable
           cache: true
       - name: Disable analytics
         run: flutter config --no-analytics --suppress-analytics
@@ -155,9 +145,6 @@ jobs:
         java-version:
           - 17
           - 21
-        branch:
-          - beta
-          - stable
         build:
           - debug
           - release
@@ -171,11 +158,11 @@ jobs:
       - name: Download src directory
         uses: actions/download-artifact@v4
         with:
-          name: src-${{ matrix.branch }}
+          name: src
       - name: Setup Flutter
         uses: subosito/flutter-action@v2
         with:
-          channel: ${{ matrix.branch }}
+          channel: stable
           cache: true
       - name: Disable analytics
         run: flutter config --no-analytics --suppress-analytics
@@ -191,15 +178,11 @@ jobs:
       - name: Upload apks
         uses: actions/upload-artifact@v4
         with:
-          name: app-${{ matrix.build }}-java${{ matrix.java-version }}-flutter${{ matrix.branch }}
+          name: app-${{ matrix.build }}-java${{ matrix.java-version }}-flutter
           path: ./app/build/app/outputs/flutter-apk/*.apk
   build-linux:
     name: "๐Ÿ–ฅ๏ธ Build Desktop (linux)"
     strategy:
-      matrix:
-        branch:
-          - beta
-          - stable
         build:
           - debug
           - release
@@ -210,11 +193,11 @@ jobs:
       - name: Download src directory
         uses: actions/download-artifact@v4
         with:
-          name: src-${{ matrix.branch }}
+          name: src
       - name: Setup Flutter
         uses: subosito/flutter-action@v2
         with:
-          channel: ${{ matrix.branch }}
+          channel: stable
           cache: true
       - name: Disable analytics
         run: flutter config --no-analytics --suppress-analytics
.github/workflows/pkg-CI.yml
@@ -9,9 +9,6 @@ on:
       - ".github/workflows/pkg-CI.yml"
   workflow_dispatch:
 
-env:
-  DART_SDK: 'beta'
-
 jobs:
   test-health_data_store:
     name: '๐Ÿงช Test'
@@ -27,7 +24,7 @@ jobs:
     - name: Setup dart
       uses: dart-lang/setup-dart@v1
       with:
-        sdk: ${{ env.DART_SDK }}
+        sdk: stable
     - run: sudo apt-get -y install libsqlite3-dev
 
     - name: Get dependencies
.github/workflows/pr.yml
@@ -6,32 +6,34 @@ on:
       - labeled
       - opened
       - reopened
+    paths:
+      - "app/**"
+      - "health_data_store/**"
+      - "pr.yml"
 
 jobs:
   update-goldens:
+    if: github.event.pull_request.draft == false
     runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        channel:
-          - beta
-          - stable
     permissions:
       contents: write
       pull-requests: write
     steps:
-      - name: Checkout code
+      - name: Checkout PR code
         uses: actions/checkout@v4
+        with:
+          ref: ${{ github.head_ref }}
       - name: Cache generated health data store
         id: cache-generated
         uses: actions/cache@v4
         with:
           path: health_data_store/lib
-          key: builder-${{ matrix.channel }}-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }}
+          key: builder-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }}
       - name: Setup dart
         if: steps.cache-generated.outputs.cache-hit != 'true'
         uses: dart-lang/setup-dart@v1
         with:
-          sdk: ${{ matrix.channel }}
+          sdk: stable
       - name: Generate code
         if: steps.cache-generated.outputs.cache-hit != 'true'
         run: dart run build_runner build
@@ -39,7 +41,7 @@ jobs:
       - name: Setup Flutter
         uses: subosito/flutter-action@v2
         with:
-          channel: ${{ matrix.channel }}
+          channel: stable
           cache: true
       - name: Disable analytics
         run:
@@ -53,7 +55,7 @@ jobs:
         working-directory: app
       - name: Update goldens
         id: gold-upd
-        run: flutter test --update-goldens --fail-fast --name="\[gold\].*" --dart-define="channel=${{ matrix.channel }}"
+        run: flutter test --update-goldens --fail-fast --name="\[gold\].*"
         working-directory: app
       - name: Push golden changes
         # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#example-of-failure-with-conditions
@@ -87,12 +89,12 @@ jobs:
         uses: actions/cache@v4
         with:
           path: health_data_store/lib
-          key: builder-${{ matrix.channel }}-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }}
+          key: builder-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }}
       - name: Setup dart
         if: steps.cache-generated.outputs.cache-hit != 'true'
         uses: dart-lang/setup-dart@v1
         with:
-          sdk: ${{ matrix.channel }}
+          sdk: stable
       - name: Generate code
         if: steps.cache-generated.outputs.cache-hit != 'true'
         run: dart run build_runner build
@@ -100,7 +102,7 @@ jobs:
       - name: Setup Flutter
         uses: subosito/flutter-action@v2
         with:
-          channel: ${{ matrix.channel }} # FIXME: only use one channel type for this
+          channel: stable
           cache: true
       - name: Disable analytics
         run:
@@ -113,7 +115,7 @@ jobs:
         run: flutter pub run build_runner build
         working-directory: app
       - name: Run tests
-        run: flutter test --coverage --dart-define="channel=${{ matrix.channel }}"
+        run: flutter test --coverage
         working-directory: app
   build:
     if: contains(github.event.pull_request.labels.*.name, 'auto-build')
@@ -131,12 +133,12 @@ jobs:
         uses: actions/cache@v4
         with:
           path: health_data_store/lib
-          key: builder-${{ matrix.channel }}-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }}
+          key: builder-${{ hashFiles('health_data_store/pubspec.yaml', 'health_data_store/lib/*', 'health_data_store/lib/**/*dart') }}
       - name: Setup dart
         if: steps.cache-generated.outputs.cache-hit != 'true'
         uses: dart-lang/setup-dart@v1
         with:
-          sdk: ${{ matrix.channel }}
+          sdk: stable
       - name: Generate code
         if: steps.cache-generated.outputs.cache-hit != 'true'
         run: dart run build_runner build
@@ -149,7 +151,7 @@ jobs:
       - name: Setup Flutter
         uses: subosito/flutter-action@v2
         with:
-          channel: ${{ matrix.channel }}
+          channel: stable
           cache: true
       - name: Disable analytics
         run: flutter config --no-analytics --suppress-analytics
@@ -163,4 +165,3 @@ jobs:
         with:
           name: build-results
           path: app/build/app/outputs/flutter-apk
-      
app/test/features/statistics/golden/beta-ClockBpGraph-dark.png โ†’ app/test/features/statistics/golden/ClockBpGraph-dark.png
File renamed without changes
app/test/features/statistics/golden/beta-ClockBpGraph-light.png โ†’ app/test/features/statistics/golden/ClockBpGraph-light.png
File renamed without changes
app/test/features/statistics/golden/beta-full_graph-years.png โ†’ app/test/features/statistics/golden/full_graph-years.png
File renamed without changes
app/test/features/statistics/golden/stable-ClockBpGraph-dark.png
Binary file
app/test/features/statistics/golden/stable-ClockBpGraph-light.png
Binary file
app/test/features/statistics/golden/stable-full_graph-years.png
Binary file
app/test/features/statistics/golden/stable-value-graph-end-warn.png
Binary file
app/test/features/statistics/golden/stable-value-graph-start-warn.png
Binary file
app/test/features/statistics/golden/stable-value-graph-warn-not-above.png
Binary file
app/test/features/statistics/golden/beta-value-graph-end-warn.png โ†’ app/test/features/statistics/golden/value-graph-end-warn.png
File renamed without changes
app/test/features/statistics/golden/beta-value-graph-start-warn.png โ†’ app/test/features/statistics/golden/value-graph-start-warn.png
File renamed without changes
app/test/features/statistics/golden/beta-value-graph-warn-not-above.png โ†’ app/test/features/statistics/golden/value-graph-warn-not-above.png
File renamed without changes
app/test/util.dart
@@ -329,8 +329,5 @@ class MockMedicineRepository extends _MockRepo<Medicine> implements MedicineRepo
 class MockNoteRepository extends _MockRepo<Note> implements NoteRepository {}
 class MockBodyweightRepository extends _MockRepo<BodyweightRecord> implements BodyweightRepository {}
 
-/// [matchesGoldenFile] wrapper that includes a dir and a channel for image names
-dynamic myMatchesGoldenFile(String key) {
-  final channel = const String.fromEnvironment('channel');
-  return matchesGoldenFile(join('golden', '$channel-$key'));
-}
+/// [matchesGoldenFile] wrapper that includes a dir for image names.
+dynamic myMatchesGoldenFile(String key) => matchesGoldenFile(join('golden', key));
app/pubspec.lock
@@ -1343,4 +1343,4 @@ packages:
     version: "3.1.3"
 sdks:
   dart: ">=3.6.0 <4.0.0"
-  flutter: ">=3.27.0"
+  flutter: ">=3.27.4"
app/pubspec.yaml
@@ -10,6 +10,7 @@ version: 1.8.5+47
 
 environment:
   sdk: '>=3.0.2 <4.0.0'
+  flutter: '3.27.4'
 
 dependencies:
   csv: ^6.0.0