diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..8f2ceaca --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + groups: + github-actions: + patterns: + - "*" diff --git a/.github/workflows/build-firebase.yaml b/.github/workflows/build-firebase.yaml index 71451485..609a2dfa 100644 --- a/.github/workflows/build-firebase.yaml +++ b/.github/workflows/build-firebase.yaml @@ -1,7 +1,5 @@ name: build firebase -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the develop branch on: workflow_dispatch: @@ -11,153 +9,74 @@ on: branches: [develop, main] paths: - "flutter_cache_manager_firebase/**" - - ".github/workflows/**" + - ".github/workflows/build-firebase.yaml" pull_request: branches: [develop, main] paths: - "flutter_cache_manager_firebase/**" - - ".github/workflows/**" + - ".github/workflows/build-firebase.yaml" -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - format: - name: Format - - # The type of runner that the job will run on - runs-on: ubuntu-latest +permissions: + contents: read - env: - source-directory: ./flutter_cache_manager_firebase +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 +env: + FLUTTER_VERSION: "3.44.4" - # Make sure the stable version of Flutter is available - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: "stable" - architecture: x64 - cache: true - - # Download all Flutter packages - - name: Download dependencies - run: flutter pub get - working-directory: ${{env.source-directory}} - - # Run Flutter Format to ensure formatting is valid - - name: Run Flutter Format - run: dart format --set-exit-if-changed . - working-directory: ${{env.source-directory}} - - analyze: - name: Analyze - - # The type of runner that the job will run on +jobs: + quality: + name: Format, Analyze & Test runs-on: ubuntu-latest + timeout-minutes: 30 - env: - source-directory: ./flutter_cache_manager_firebase + defaults: + run: + working-directory: ./flutter_cache_manager_firebase - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - # Make sure the stable version of Flutter is available - name: Set up Flutter uses: subosito/flutter-action@v2 with: channel: "stable" - architecture: x64 + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - # Download all Flutter packages - name: Download dependencies run: flutter pub get - working-directory: ${{env.source-directory}} - # Run Flutter Analyzer + - name: Run Dart Format + run: dart format --set-exit-if-changed . + - name: Run Flutter Analyzer run: flutter analyze - working-directory: ${{env.source-directory}} - - tests: - name: Unit-tests - # The type of runner that the job will run on - runs-on: ubuntu-latest - env: - source-directory: ./flutter_cache_manager_firebase - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 - - # Make sure the stable version of Flutter is available - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: "stable" - architecture: x64 - cache: true - - # Download all Flutter packages - - name: Download dependencies - run: flutter pub get - working-directory: ${{env.source-directory}} - - # Run all unit-tests with code coverage - # - name: Run unit tests - # run: flutter test --coverage - # working-directory: ${{env.source-directory}} - - # # Upload code coverage information - # - uses: codecov/codecov-action@v4 - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - # with: - # files: ${{env.source-directory}}/coverage/lcov.info - # name: CacheManager - # fail_ci_if_error: true + - name: Run unit tests + run: flutter test --coverage publish_cache_manager_firebase: if: ${{ github.ref_type == 'tag' }} name: Publish Cache Manager Firebase permissions: id-token: write - needs: [format, analyze, tests] - # The type of runner that the job will run on + contents: read + needs: [quality] runs-on: ubuntu-latest + timeout-minutes: 15 - env: - source-directory: ./flutter_cache_manager_firebase + defaults: + run: + working-directory: ./flutter_cache_manager_firebase - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Set up Dart uses: dart-lang/setup-dart@v1 - # Make sure the stable version of Flutter is available - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: "stable" - architecture: x64 - cache: true - - # Download all Flutter packages - - name: Download dependencies - run: flutter pub get - working-directory: ${{env.source-directory}} - - # Publish the package - name: Publish package run: dart pub publish -v -f - working-directory: ${{env.source-directory}} diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 08bfb396..207cc416 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,7 +1,5 @@ name: build -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the develop branch on: workflow_dispatch: @@ -11,357 +9,231 @@ on: branches: [develop, main] paths: - "flutter_cache_manager/**" - - ".github/workflows/**" + - ".github/workflows/build.yaml" pull_request: branches: [develop, main] paths: - "flutter_cache_manager/**" - - ".github/workflows/**" + - ".github/workflows/build.yaml" -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - format: - name: Format - - # The type of runner that the job will run on - runs-on: ubuntu-latest - - env: - source-directory: ./flutter_cache_manager - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 - - # Make sure the stable version of Flutter is available - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: "stable" - architecture: x64 - cache: true - - # Download all Flutter packages - - name: Download dependencies - run: flutter pub get - working-directory: ${{env.source-directory}} +permissions: + contents: read - # Run Flutter Format to ensure formatting is valid - - name: Run Flutter Format - run: dart format --set-exit-if-changed . - working-directory: ${{env.source-directory}} +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true - analyze: - name: Analyze +env: + FLUTTER_VERSION: "3.44.4" - # The type of runner that the job will run on +jobs: + quality: + name: Format, Analyze & Test runs-on: ubuntu-latest + timeout-minutes: 30 - env: - source-directory: ./flutter_cache_manager + defaults: + run: + working-directory: ./flutter_cache_manager - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - # Make sure the stable version of Flutter is available - name: Set up Flutter uses: subosito/flutter-action@v2 with: channel: "stable" - architecture: x64 + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - # Download all Flutter packages - name: Download dependencies run: flutter pub get - working-directory: ${{env.source-directory}} - # Run Flutter Analyzer + - name: Run Dart Format + run: dart format --set-exit-if-changed . + - name: Run Flutter Analyzer run: flutter analyze - working-directory: ${{env.source-directory}} + + - name: Run unit tests + run: flutter test --coverage build_android: name: Build Android App - - # The type of runner that the job will run on runs-on: ubuntu-latest + timeout-minutes: 45 - env: - source-directory: ./flutter_cache_manager - example-directory: ./flutter_cache_manager/example + defaults: + run: + working-directory: ./flutter_cache_manager - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - # Ensure correct JAVA version is installed. - - uses: actions/setup-java@v4 + - uses: actions/setup-java@v5 with: distribution: "zulu" java-version: "17" - # Make sure the stable version of Flutter is available - name: Set up Flutter uses: subosito/flutter-action@v2 with: channel: "stable" - architecture: x64 + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - # Download all Flutter packages - name: Download dependencies run: flutter pub get - working-directory: ${{env.source-directory}} - # Build Android version of the example App - name: Run Android build run: flutter build apk --release - working-directory: ${{env.example-directory}} + working-directory: ./flutter_cache_manager/example build_ios: name: Build iOS App - - # The type of runner that the job will run on runs-on: macos-latest + timeout-minutes: 60 - env: - source-directory: ./flutter_cache_manager - example-directory: ./flutter_cache_manager/example + defaults: + run: + working-directory: ./flutter_cache_manager - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - # Make sure the stable version of Flutter is available - name: Set up Flutter uses: subosito/flutter-action@v2 with: channel: "stable" - architecture: x64 + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - # Download all Flutter packages - name: Download dependencies run: flutter pub get - working-directory: ${{env.source-directory}} - # Build iOS version of the example App - name: Run iOS build run: flutter build ios --release --no-codesign - working-directory: ${{env.example-directory}} + working-directory: ./flutter_cache_manager/example build_macOS: name: Build macOS App - - # The type of runner that the job will run on runs-on: macos-latest + timeout-minutes: 60 - env: - source-directory: ./flutter_cache_manager - example-directory: ./flutter_cache_manager/example + defaults: + run: + working-directory: ./flutter_cache_manager - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - # Make sure the stable version of Flutter is available - name: Set up Flutter uses: subosito/flutter-action@v2 with: channel: "stable" - architecture: x64 + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - # Enable platform support - - name: Enable macOS - run: flutter config --enable-macos-desktop - working-directory: ${{env.source-directory}} - - # Download all Flutter packages - name: Download dependencies run: flutter pub get - working-directory: ${{env.source-directory}} - # Build macOS version of the example App - name: Run macOS build run: flutter build macos --release - working-directory: ${{env.example-directory}} + working-directory: ./flutter_cache_manager/example build_windows: name: Build Windows App - - # The type of runner that the job will run on runs-on: windows-latest + timeout-minutes: 45 - env: - source-directory: ./flutter_cache_manager - example-directory: ./flutter_cache_manager/example + defaults: + run: + working-directory: ./flutter_cache_manager - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - # Make sure the stable version of Flutter is available - name: Set up Flutter uses: subosito/flutter-action@v2 with: channel: "stable" - architecture: x64 + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - # Enable platform support - - name: Enable Windows - run: flutter config --enable-windows-desktop - working-directory: ${{env.source-directory}} - - # Download all Flutter packages - name: Download dependencies run: flutter pub get - working-directory: ${{env.source-directory}} - # Build iOS version of the example App - name: Run Windows build run: flutter build windows --release - working-directory: ${{env.example-directory}} + working-directory: ./flutter_cache_manager/example build_linux: name: Build Linux App - - # The type of runner that the job will run on runs-on: ubuntu-latest + timeout-minutes: 45 - env: - source-directory: ./flutter_cache_manager - example-directory: ./flutter_cache_manager/example + defaults: + run: + working-directory: ./flutter_cache_manager - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Install libraries for Linux - - run: sudo apt-get update -y - - run: sudo apt-get install -y ninja-build libgtk-3-dev libblkid-dev + - uses: actions/checkout@v5 - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - name: Install Linux build dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y ninja-build libgtk-3-dev + working-directory: . - # Make sure the stable version of Flutter is available - name: Set up Flutter uses: subosito/flutter-action@v2 with: channel: "stable" - architecture: x64 + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - # Enable platform support - - name: Enable Linux - run: flutter config --enable-linux-desktop - working-directory: ${{env.source-directory}} - - # Enable platform support - - name: Flutter Doctor - run: flutter doctor - working-directory: ${{env.source-directory}} - - # Download all Flutter packages - name: Download dependencies run: flutter pub get - working-directory: ${{env.source-directory}} - # Build iOS version of the example App - name: Run Linux build run: flutter build linux --release - working-directory: ${{env.example-directory}} + working-directory: ./flutter_cache_manager/example build_web: name: Build Web App - - # The type of runner that the job will run on runs-on: ubuntu-latest + timeout-minutes: 30 - env: - source-directory: ./flutter_cache_manager - example-directory: ./flutter_cache_manager/example + defaults: + run: + working-directory: ./flutter_cache_manager - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - # Make sure the stable version of Flutter is available - name: Set up Flutter uses: subosito/flutter-action@v2 with: channel: "stable" - architecture: x64 + flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - # Download all Flutter packages - name: Download dependencies run: flutter pub get - working-directory: ${{env.source-directory}} - # Build Web version of the example App - name: Run Web build run: flutter build web --release - working-directory: ${{env.example-directory}} - - tests: - name: Unit-tests - # The type of runner that the job will run on - runs-on: ubuntu-latest - - env: - source-directory: ./flutter_cache_manager - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 - - # Make sure the stable version of Flutter is available - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: "stable" - architecture: x64 - cache: true - - # Download all Flutter packages - - name: Download dependencies - run: flutter pub get - working-directory: ${{env.source-directory}} - - # Run all unit-tests with code coverage - - name: Run unit tests - run: flutter test --coverage - working-directory: ${{env.source-directory}} - - # # Upload code coverage information - # - uses: codecov/codecov-action@v4 - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - # with: - # files: ${{env.source-directory}}/coverage/lcov.info - # name: CacheManager - # fail_ci_if_error: true + working-directory: ./flutter_cache_manager/example publish_cache_manager: if: ${{ github.ref_type == 'tag' }} name: Publish CacheManager permissions: id-token: write + contents: read needs: [ - format, - analyze, - tests, + quality, build_android, build_ios, build_macOS, @@ -369,34 +241,18 @@ jobs: build_linux, build_web, ] - # The type of runner that the job will run on runs-on: ubuntu-latest + timeout-minutes: 15 - env: - source-directory: ./flutter_cache_manager + defaults: + run: + working-directory: ./flutter_cache_manager - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Set up Dart uses: dart-lang/setup-dart@v1 - # Make sure the stable version of Flutter is available - - name: Set up Flutter - uses: subosito/flutter-action@v2 - with: - channel: "stable" - architecture: x64 - cache: true - - # Download all Flutter packages - - name: Download dependencies - run: flutter pub get - working-directory: ${{env.source-directory}} - - # Publish the package - name: Publish package run: dart pub publish -v -f - working-directory: ${{env.source-directory}} diff --git a/flutter_cache_manager/CHANGELOG.md b/flutter_cache_manager/CHANGELOG.md index dc87a27b..4903c727 100644 --- a/flutter_cache_manager/CHANGELOG.md +++ b/flutter_cache_manager/CHANGELOG.md @@ -1,3 +1,8 @@ +## [Unreleased] + +* Modernizes GitHub Actions CI (combined quality job, pinned Flutter 3.44.4, Dependabot for actions) +* Updates example Android project to AGP 8.11.1 / Gradle 8.14 / Kotlin 2.2.20 for compatibility with current Flutter tooling and `jni` + ## [3.4.2] * Fixes `removeFile` deleting from the wrong path diff --git a/flutter_cache_manager/example/android/app/build.gradle b/flutter_cache_manager/example/android/app/build.gradle index 201b1145..9553428b 100644 --- a/flutter_cache_manager/example/android/app/build.gradle +++ b/flutter_cache_manager/example/android/app/build.gradle @@ -1,6 +1,7 @@ plugins { id "com.android.application" - // The Flutter Gradle Plugin must be applied after the Android Gradle plugin. + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. id "dev.flutter.flutter-gradle-plugin" } @@ -14,6 +15,10 @@ android { targetCompatibility = JavaVersion.VERSION_17 } + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17 + } + defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId = "com.example.example" @@ -34,12 +39,6 @@ android { } } -kotlin { - compilerOptions { - jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 - } -} - flutter { source = "../.." } diff --git a/flutter_cache_manager/example/android/gradle.properties b/flutter_cache_manager/example/android/gradle.properties index 1551eb08..a085b00e 100644 --- a/flutter_cache_manager/example/android/gradle.properties +++ b/flutter_cache_manager/example/android/gradle.properties @@ -1,7 +1,6 @@ org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true -# This builtInKotlin flag was added automatically by Flutter migrator +# Flutter migrator keeps these for AGP 8 / plugin compatibility android.builtInKotlin=false -# This newDsl flag was added automatically by Flutter migrator android.newDsl=false diff --git a/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties b/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties index 2d428bfb..e4ef43fb 100644 --- a/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip diff --git a/flutter_cache_manager/example/android/settings.gradle b/flutter_cache_manager/example/android/settings.gradle index 643d520c..6085e4d8 100644 --- a/flutter_cache_manager/example/android/settings.gradle +++ b/flutter_cache_manager/example/android/settings.gradle @@ -18,8 +18,9 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "9.0.1" apply false - id "org.jetbrains.kotlin.android" version "2.3.20" apply false + // Stay on AGP 8.x: AGP 9 + Flutter's builtInKotlin=false opt-out breaks jni 1.0.1 + id "com.android.application" version "8.11.1" apply false + id "org.jetbrains.kotlin.android" version "2.2.20" apply false } include ":app" diff --git a/flutter_cache_manager_firebase/CHANGELOG.md b/flutter_cache_manager_firebase/CHANGELOG.md index e822da61..db63f744 100644 --- a/flutter_cache_manager_firebase/CHANGELOG.md +++ b/flutter_cache_manager_firebase/CHANGELOG.md @@ -1,3 +1,8 @@ +## [Unreleased] + +* Modernizes GitHub Actions CI (combined quality job, pinned Flutter 3.44.4, Dependabot for actions) +* Adds a smoke unit test so CI `flutter test` no longer exits with “No tests were found” + ## [2.1.3] - 2026-07-21 * Raises minimum Dart SDK to 3.10.0 diff --git a/flutter_cache_manager_firebase/test/flutter_cache_manager_firebase_test.dart b/flutter_cache_manager_firebase/test/flutter_cache_manager_firebase_test.dart index ab73b3a2..c8343e1b 100644 --- a/flutter_cache_manager_firebase/test/flutter_cache_manager_firebase_test.dart +++ b/flutter_cache_manager_firebase/test/flutter_cache_manager_firebase_test.dart @@ -1 +1,8 @@ -void main() {} +import 'package:flutter_cache_manager_firebase/flutter_cache_manager_firebase.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + test('FirebaseCacheManager key is set', () { + expect(FirebaseCacheManager.key, 'firebaseCache'); + }); +}