Skip to content

Commit

Permalink
Update flutter-desktop-tests.yml to match dart-desktop-tests.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Apr 24, 2024
1 parent 4e7ca27 commit 375ceae
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 25 deletions.
34 changes: 30 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ jobs:
- deploy-cluster-flutter-windows
secrets: inherit
with:
os: windows
runner: windows-latest
differentiator: fw${{ github.run_id }}${{ github.run_attempt }}

Expand Down Expand Up @@ -225,8 +224,7 @@ jobs:
- deploy-cluster-flutter-macos
secrets: inherit
with:
os: macos
runner: macos-14
runner: macos-13
differentiator: fm${{ github.run_id }}${{ github.run_attempt }}

cleanup-cluster-flutter-macos:
Expand All @@ -239,6 +237,35 @@ jobs:
with:
differentiator: fm${{ github.run_id }}${{ github.run_attempt }}

deploy-cluster-flutter-macos-arm:
name: Deploy Cluster for Flutter MacOS Arm
uses: ./.github/workflows/deploy-baas.yml
secrets: inherit
with:
differentiator: fma${{ github.run_id }}${{ github.run_attempt }}

flutter-tests-macos-arm:
name: Flutter Tests MacOS Arm
uses: ./.github/workflows/flutter-desktop-tests.yml
needs:
- build-macos
- deploy-cluster-flutter-macos-arm
secrets: inherit
with:
runner: macos-14
arch: arm64
differentiator: fma${{ github.run_id }}${{ github.run_attempt }}

cleanup-cluster-flutter-macos-arm:
name: Cleanup Cluster for Flutter macOS Arm
uses: ./.github/workflows/terminate-baas.yml
if: always()
needs:
- flutter-tests-macos-arm
secrets: inherit
with:
differentiator: fma${{ github.run_id }}${{ github.run_attempt }}

deploy-cluster-flutter-linux:
name: Deploy Cluster for Flutter Linux
uses: ./.github/workflows/deploy-baas.yml
Expand All @@ -254,7 +281,6 @@ jobs:
- deploy-cluster-flutter-linux
secrets: inherit
with:
os: linux
runner: ubuntu-latest
differentiator: fl${{ github.run_id }}${{ github.run_attempt }}

Expand Down
47 changes: 26 additions & 21 deletions .github/workflows/flutter-desktop-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,26 @@ name: Flutter desktop tests
on:
workflow_call:
inputs:
os:
description: OS to execute on.
required: true
type: string
runner:
description: GitHub runner image to execute on.
required: true
type: string
architecture:
description: Architecture to execute on.
required: false
type: string
differentiator:
description: Differentiator for the BaaS container.
required: true
type: string
arch:
description: Architecture to execute on.
default: x64
type: string

env:
REALM_CI: true

jobs:
flutter-tests:
runs-on: ${{ inputs.runner }}
name: Flutter tests on ${{inputs.os }}-${{ inputs.architecture }}
name: Flutter tests on ${{ inputs.runner }}-${{ inputs.arch }}
timeout-minutes: 45
env:
BAAS_BAASAAS_API_KEY: ${{ secrets.BAASAAS_API_KEY}}
Expand All @@ -42,26 +38,33 @@ jobs:
with:
submodules: false

- name: Check runner.arch
if: ${{ inputs.arch != runner.arch }}
run: false # fail if arch is not as expected
shell: bash

- name: Set RUNNER_OS
# there is no such thing as ${{ tolower(runner.os) }}, hence this abomination ¯\_(ツ)_/¯
run: echo ${{ runner.os }} | awk '{print "RUNNER_OS=" tolower($0)}' >> $GITHUB_ENV
shell: bash

- name: Setup GTK & Ninja on Linux
if: ${{ inputs.os == 'linux' }}
if: ${{ runner.os == 'linux' }}
run: |
sudo apt-get update -y
sudo apt-get install -y libgtk-3-dev xvfb ninja-build
- name: Fetch artifacts
uses: actions/download-artifact@v4
with:
name: librealm-${{ inputs.os }}
path: packages/realm_dart/binary/${{ inputs.os }}
name: librealm-${{ env.RUNNER_OS }}
path: packages/realm_dart/binary/${{ env.RUNNER_OS }}

- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
architecture: ${{ inputs.architecture == 'arm' && 'arm64' || 'x64'}}

- name: Enable Flutter Desktop support
run: flutter config --enable-${{ inputs.os }}-desktop
architecture: ${{ inputs.arch }}

- name: Setup Melos
run: |
Expand All @@ -72,16 +75,18 @@ jobs:
run: dart pub get

- name: Bump ulimit
run: ulimit -n 10240
if: ${{ contains(inputs.os, 'macos') }}
run: |
ulimit -n
ulimit -n 10240
if: ${{ contains(runner.os, 'macos') }}

- name: Run tests
run: |
${{ inputs.os == 'linux' && 'xvfb-run' || '' }} \
${{ runner.os == 'linux' && 'xvfb-run' || '' }} \
flutter test integration_test/all_tests.dart \
--dart-define=BAAS_BAASAAS_API_KEY=$BAAS_BAASAAS_API_KEY \
--dart-define=BAAS_DIFFERENTIATOR=$BAAS_DIFFERENTIATOR \
--device-id=${{ inputs.os }} \
--device-id=${{ env.RUNNER_OS }} \
--file-reporter=json:test-results.json \
--suppress-analytics
shell: bash
Expand All @@ -91,7 +96,7 @@ jobs:
uses: dorny/[email protected]
if: success() || failure()
with:
name: Test Results Flutter ${{ inputs.os }} ${{ inputs.architecture }}
name: Test Results Flutter ${{ runner.os }} ${{ runner.arch }}
path: test-results.json
reporter: dart-json
only-summary: true
Expand Down

0 comments on commit 375ceae

Please sign in to comment.