From 3544479ff7decb43054194eb05a65adfc19bc4b1 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Fri, 3 Jul 2026 11:28:32 +0200 Subject: [PATCH 1/2] ci: speed up build and test pipelines - build.yml: cache pub dependencies and Gradle, and split the Flutter builds into per-target parallel jobs so web, linux, apk, macos, ios and windows run concurrently instead of serially per OS. - test.yml: only run the beta/dev Dart SDK matrix on pushes to main; pull requests test stable only to keep the matrix small. - Pin melos to 8.0.0 across all workflows for reproducible, cacheable runs. --- .github/workflows/build.yml | 86 ++++++++++++++++++++----------------- .github/workflows/test.yml | 20 ++++++--- 2 files changed, 62 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a2f8137e..9487407e7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: run: | set -euo pipefail - dart pub global activate melos + dart pub global activate melos 8.0.0 BASE="${{ github.event.pull_request.base.sha }}" @@ -61,14 +61,26 @@ jobs: fi build-flutter: - name: Build on ${{ matrix.os }} + name: Build ${{ matrix.target }} on ${{ matrix.os }} needs: changes if: ${{ needs.changes.outputs.flutter == 'true' }} timeout-minutes: 30 strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: ubuntu-latest + target: web + - os: ubuntu-latest + target: linux + - os: ubuntu-latest + target: apk + - os: macos-latest + target: macos + - os: macos-latest + target: ios + - os: windows-latest + target: windows defaults: run: @@ -76,6 +88,9 @@ jobs: runs-on: ${{ matrix.os }} + env: + PUB_CACHE: ${{ github.workspace }}/.pub-cache + steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 @@ -92,54 +107,47 @@ jobs: - name: Show Flutter version run: flutter --version + - name: Cache pub dependencies + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + with: + path: ${{ env.PUB_CACHE }} + key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} + restore-keys: | + ${{ runner.os }}-pub- + + - name: Cache Gradle + if: ${{ matrix.target == 'apk' }} + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('packages/supabase_flutter/example/android/**/*.gradle*', 'packages/supabase_flutter/example/android/**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Bootstrap workspace run: | cd ../../ - dart pub global activate melos + dart pub global activate melos 8.0.0 melos bootstrap - - name: Build web app - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - cd example - flutter build web - - name: Install Linux build dependencies (cached) - if: ${{ matrix.os == 'ubuntu-latest' }} + if: ${{ matrix.target == 'linux' }} uses: awalsh128/cache-apt-pkgs-action@681749ae568c81c2037cb9185e38b709b261bd2f # v1.6.1 with: packages: libgtk-3-dev libblkid-dev liblzma-dev version: 1.0 - - name: Build Linux app - if: ${{ matrix.os == 'ubuntu-latest' }} - run: | - cd example - flutter build linux - - - name: Build Android app - if: ${{ matrix.os == 'ubuntu-latest' }} + - name: Build ${{ matrix.target }} app + working-directory: packages/supabase_flutter/example + shell: bash run: | - cd example - flutter build apk - - - name: Build macOS app - if: ${{ matrix.os == 'macos-latest' }} - run: | - cd example - flutter build macos - - - name: Build iOS app - if: ${{ matrix.os == 'macos-latest' }} - run: | - cd example - flutter build ios --no-codesign - - - name: Build Windows app - if: ${{ matrix.os == 'windows-latest' }} - run: | - cd example - flutter build windows + if [ "${{ matrix.target }}" = "ios" ]; then + flutter build ios --no-codesign + else + flutter build ${{ matrix.target }} + fi build-result: name: Build result diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8e64e57ad..dd08b4a1f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,7 @@ jobs: runs-on: ubuntu-latest outputs: dart-matrix: ${{ steps.detect.outputs.dart-matrix }} + sdk-matrix: ${{ steps.detect.outputs.sdk-matrix }} flutter: ${{ steps.detect.outputs.flutter }} steps: - name: Checkout repository @@ -36,7 +37,7 @@ jobs: run: | set -euo pipefail - dart pub global activate melos + dart pub global activate melos 8.0.0 if [ "${{ github.event_name }}" = "pull_request" ]; then BASE="${{ github.event.pull_request.base.sha }}" @@ -87,6 +88,15 @@ jobs: fi echo "dart-matrix=$DART_MATRIX" >> "$GITHUB_OUTPUT" + # Only exercise beta/dev SDKs on pushes to main. On pull requests we + # test stable only to keep the matrix small; upcoming-SDK breakage is + # caught on merge. + if [ "${{ github.event_name }}" = "push" ]; then + echo 'sdk-matrix=["stable","beta","dev"]' >> "$GITHUB_OUTPUT" + else + echo 'sdk-matrix=["stable"]' >> "$GITHUB_OUTPUT" + fi + if echo "$CHANGED" | grep -qx "supabase_flutter"; then echo "flutter=true" >> "$GITHUB_OUTPUT" else @@ -103,7 +113,7 @@ jobs: fail-fast: false matrix: package: ${{ fromJSON(needs.changes.outputs.dart-matrix) }} - sdk: [stable, beta, dev] + sdk: ${{ fromJSON(needs.changes.outputs.sdk-matrix) }} steps: - name: Checkout repository @@ -127,7 +137,7 @@ jobs: - name: Bootstrap workspace run: | - dart pub global activate melos + dart pub global activate melos 8.0.0 melos bootstrap --no-flutter - name: Format @@ -262,7 +272,7 @@ jobs: - name: Bootstrap workspace run: | cd ../../ - dart pub global activate melos + dart pub global activate melos 8.0.0 melos bootstrap - name: Run formatter @@ -319,7 +329,7 @@ jobs: - name: Bootstrap workspace run: | - dart pub global activate melos + dart pub global activate melos 8.0.0 melos bootstrap - name: Install DCM From cf1e178ef12311baac3eb5ba6a5e03e8013403d0 Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Fri, 3 Jul 2026 11:33:03 +0200 Subject: [PATCH 2/2] ci: keep melos unpinned pending pub workspaces migration --- .github/workflows/build.yml | 4 ++-- .github/workflows/test.yml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9487407e7..52718c421 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: run: | set -euo pipefail - dart pub global activate melos 8.0.0 + dart pub global activate melos BASE="${{ github.event.pull_request.base.sha }}" @@ -129,7 +129,7 @@ jobs: - name: Bootstrap workspace run: | cd ../../ - dart pub global activate melos 8.0.0 + dart pub global activate melos melos bootstrap - name: Install Linux build dependencies (cached) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd08b4a1f..939bf92ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,7 +37,7 @@ jobs: run: | set -euo pipefail - dart pub global activate melos 8.0.0 + dart pub global activate melos if [ "${{ github.event_name }}" = "pull_request" ]; then BASE="${{ github.event.pull_request.base.sha }}" @@ -137,7 +137,7 @@ jobs: - name: Bootstrap workspace run: | - dart pub global activate melos 8.0.0 + dart pub global activate melos melos bootstrap --no-flutter - name: Format @@ -272,7 +272,7 @@ jobs: - name: Bootstrap workspace run: | cd ../../ - dart pub global activate melos 8.0.0 + dart pub global activate melos melos bootstrap - name: Run formatter @@ -329,7 +329,7 @@ jobs: - name: Bootstrap workspace run: | - dart pub global activate melos 8.0.0 + dart pub global activate melos melos bootstrap - name: Install DCM