Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
82 changes: 45 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,36 @@ 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:
working-directory: packages/supabase_flutter

runs-on: ${{ matrix.os }}

env:
PUB_CACHE: ${{ github.workspace }}/.pub-cache

steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand All @@ -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
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
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading