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
8 changes: 7 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ on:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
coverage:
name: Generate Combined Coverage
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4
Expand All @@ -21,7 +26,8 @@ jobs:
with:
flutter-version: '3.x'
channel: 'stable'

cache: true

- name: Install dependencies
run: |
dart pub global activate melos
Expand Down
105 changes: 105 additions & 0 deletions .github/workflows/dart-package-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Dart Package Test (Reusable)

on:
workflow_call:
inputs:
package-name:
required: true
type: string
description: 'The name of the package to test (e.g., gotrue, postgrest)'
working-directory:
required: true
type: string
description: 'The working directory for the package (e.g., packages/gotrue)'
needs-docker:
required: false
type: boolean
default: false
description: 'Whether this package needs Docker services to run tests'
docker-compose-dir:
required: false
type: string
description: 'The directory containing docker-compose.yml (e.g., infra/gotrue)'
test-concurrency:
required: false
type: number
default: 0
description: 'Test concurrency level (0 means no flag, 1 means --concurrency=1)'

jobs:
test:
name: Test SDK ${{ matrix.sdk }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: [stable, beta, dev]

defaults:
run:
working-directory: ${{ inputs.working-directory }}

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

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}

- name: Cache pub dependencies
uses: actions/cache@v4
with:
path: |
${{ env.PUB_CACHE }}
~/.pub-cache
key: ${{ runner.os }}-pub-${{ matrix.sdk }}-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-${{ matrix.sdk }}-
${{ runner.os }}-pub-

- name: Bootstrap workspace
run: |
cd ../../
dart pub global activate melos
melos bootstrap --no-flutter

- name: dartfmt
if: ${{ matrix.sdk == 'stable'}}
run: dart format lib test -l 80 --set-exit-if-changed

- name: analyzer
run: |
if [ "${{ matrix.sdk }}" == "stable" ]; then
dart analyze --fatal-warnings .
else
dart analyze
fi

- name: Start Docker services
if: ${{ inputs.needs-docker }}
run: |
cd ../../${{ inputs.docker-compose-dir }}
docker compose up -d

- name: Wait for services to be ready
if: ${{ inputs.needs-docker }}
run: sleep 5

- name: Run tests
run: |
if [ "${{ inputs.test-concurrency }}" == "1" ]; then
dart test --concurrency=1
else
dart test
fi

- name: Stop Docker services
if: ${{ inputs.needs-docker && always() }}
run: |
cd ../../${{ inputs.docker-compose-dir }}
docker compose down
53 changes: 10 additions & 43 deletions .github/workflows/functions_client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,59 +7,26 @@ on:
paths:
- 'packages/functions_client/**'
- '.github/workflows/functions_client.yml'
- '.github/workflows/dart-package-test.yml'
- 'packages/yet_another_json_isolate/**'

pull_request:
paths:
- 'packages/functions_client/**'
- '.github/workflows/functions_client.yml'
- '.github/workflows/dart-package-test.yml'
- 'packages/yet_another_json_isolate/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:
name: Test SDK ${{ matrix.sdk }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: [stable, beta, dev]

defaults:
run:
working-directory: packages/functions_client

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

steps:
- name: Checks-out repo
uses: actions/checkout@v4

- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}

- name: Bootstrap workspace
run: |
cd ../../
dart pub global activate melos
melos bootstrap --no-flutter

- name: dartfmt
if: ${{ matrix.sdk == 'stable'}}
run: dart format lib test -l 80 --set-exit-if-changed

- name: analyzer
if: ${{ matrix.sdk == 'stable'}}
run: dart analyze --fatal-warnings --fatal-infos .

- name: analyzer
if: ${{ matrix.sdk == 'beta' || matrix.sdk == 'dev' }}
run: dart analyze

- name: Run tests
run: dart test
uses: ./.github/workflows/dart-package-test.yml
with:
package-name: functions_client
working-directory: packages/functions_client
66 changes: 13 additions & 53 deletions .github/workflows/gotrue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,67 +7,27 @@ on:
paths:
- 'packages/gotrue/**'
- '.github/workflows/gotrue.yml'
- '.github/workflows/dart-package-test.yml'

pull_request:
paths:
- 'packages/gotrue/**'
- '.github/workflows/gotrue.yml'
- '.github/workflows/dart-package-test.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:
name: Test SDK ${{ matrix.sdk }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: [stable, beta, dev]

defaults:
run:
working-directory: packages/gotrue

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

steps:
- name: Checks-out repo
uses: actions/checkout@v4

- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}

- name: Bootstrap workspace
run: |
cd ../../
dart pub global activate melos
melos bootstrap --no-flutter

- name: dartfmt
if: ${{ matrix.sdk == 'stable'}}
run: dart format lib test -l 80 --set-exit-if-changed

- name: analyzer
if: ${{ matrix.sdk == 'stable'}}
run: dart analyze --fatal-warnings --fatal-infos .

- name: analyzer
if: ${{ matrix.sdk == 'beta' || matrix.sdk == 'dev' }}
run: dart analyze

- name: Build Docker image
run: |
cd ../../infra/gotrue
docker compose down
docker compose up -d

- name: Sleep for 5 seconds
uses: jakejarvis/wait-action@master
with:
time: '5s'

- name: Run tests
run: dart test --concurrency=1
uses: ./.github/workflows/dart-package-test.yml
with:
package-name: gotrue
working-directory: packages/gotrue
needs-docker: true
docker-compose-dir: infra/gotrue
test-concurrency: 1
66 changes: 13 additions & 53 deletions .github/workflows/postgrest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,69 +7,29 @@ on:
paths:
- 'packages/postgrest/**'
- '.github/workflows/postgrest.yml'
- '.github/workflows/dart-package-test.yml'
- 'packages/yet_another_json_isolate/**'

pull_request:
paths:
- 'packages/postgrest/**'
- '.github/workflows/postgrest.yml'
- '.github/workflows/dart-package-test.yml'
- 'packages/yet_another_json_isolate/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
test:
name: Test SDK ${{ matrix.sdk }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
sdk: [stable, beta, dev]

defaults:
run:
working-directory: packages/postgrest

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

steps:
- name: Checks-out repo
uses: actions/checkout@v4

- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}

- name: Bootstrap workspace
run: |
cd ../../
dart pub global activate melos
melos bootstrap --no-flutter

- name: dartfmt
if: ${{ matrix.sdk == 'stable'}}
run: dart format lib test -l 80 --set-exit-if-changed

- name: analyzer
if: ${{ matrix.sdk == 'stable'}}
run: dart analyze --fatal-warnings --fatal-infos .

- name: analyzer
if: ${{ matrix.sdk == 'beta' || matrix.sdk == 'dev' }}
run: dart analyze

- name: Build Docker image
run: |
cd ../../infra/postgrest
docker compose down
docker compose up -d

- name: Sleep for 5 seconds
uses: jakejarvis/wait-action@master
with:
time: '5s'

- name: Run tests
run: dart test --concurrency=1
uses: ./.github/workflows/dart-package-test.yml
with:
package-name: postgrest
working-directory: packages/postgrest
needs-docker: true
docker-compose-dir: infra/postgrest
test-concurrency: 1
Loading