ci: update macOS and iOS jobs to use latest runner and improve test c… #27
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| tags: | |
| - '*' | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.event.pull_request.head.ref || github.ref_name }} | |
| cancel-in-progress: true | |
| env: | |
| ROOT: "${{ github.workspace }}" | |
| SCRIPTS: "${{ github.workspace }}/.github/scripts" | |
| SERIOUS_PYTHON_SITE_PACKAGES: "${{ github.workspace }}/site-packages" | |
| UV_PYTHON: "3.12" | |
| jobs: | |
| macos: | |
| name: Test on macOS | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: kuhnroyal/flutter-fvm-config-action/setup@v3 | |
| with: | |
| path: '.fvmrc' | |
| cache: true | |
| - name: Run tests | |
| shell: bash | |
| working-directory: "src/serious_python/example/flet_example" | |
| run: | | |
| dart run serious_python:main package app/src --platform Darwin --requirements flet | |
| flutter test integration_test --device-id macos | |
| ios: | |
| name: Test on iOS | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: kuhnroyal/flutter-fvm-config-action/setup@v3 | |
| with: | |
| path: '.fvmrc' | |
| cache: true | |
| - name: Setup iOS Simulator | |
| id: simulator | |
| uses: futureware-tech/simulator-action@v4 | |
| with: | |
| # https://github.com/futureware-tech/simulator-action/wiki/Devices-macos-latest | |
| model: 'iPhone 16 Pro Max' | |
| os: "iOS" | |
| os_version: "^18.6" | |
| shutdown_after_job: true | |
| wait_for_boot: true | |
| - name: Run tests | |
| shell: bash | |
| working-directory: "src/serious_python/example/flet_example" | |
| run: | | |
| dart run serious_python:main package app/src --platform iOS --requirements flet | |
| flutter test integration_test --device-id ${{ steps.simulator.outputs.udid }} | |
| android: | |
| name: Test on Android | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: kuhnroyal/flutter-fvm-config-action/setup@v3 | |
| with: | |
| path: '.fvmrc' | |
| cache: true | |
| - name: Enable KVM | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Gradle cache | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: AVD cache | |
| uses: actions/cache@v4 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd | |
| - name: Setup Android Emulator + Run tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| avd-name: android_emulator | |
| api-level: 33 | |
| target: google_atd | |
| arch: x86_64 | |
| profile: pixel_5 | |
| sdcard-path-or-size: 128M | |
| ram-size: 2048M | |
| disk-size: 4096M | |
| emulator-port: 5554 | |
| disable-animations: true | |
| emulator-options: -no-window -noaudio -no-boot-anim -memory 2048 -wipe-data -cache-size 1000 -partition-size 8192 | |
| pre-emulator-launch-script: | | |
| sdkmanager --list_installed | |
| script: | | |
| cd src/serious_python/example/flet_example && dart run serious_python:main package app/src --platform Android --requirements flet | |
| cd src/serious_python/example/flet_example && flutter test integration_test --device-id emulator-5554 | |
| windows: | |
| name: Test on Windows | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: kuhnroyal/flutter-fvm-config-action/setup@v3 | |
| with: | |
| path: '.fvmrc' | |
| cache: true | |
| - name: Run tests | |
| shell: bash | |
| working-directory: "src/serious_python/example/flet_example" | |
| run: | | |
| dart run serious_python:main package app/src --platform Windows --requirements flet | |
| flutter test integration_test -d windows | |
| linux: | |
| name: Test on Linux ${{ matrix.title }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm | |
| title: ARM64 | |
| - arch: amd64 | |
| runner: ubuntu-24.04 | |
| title: AMD64 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Get Flutter version from ".fvmrc" | |
| uses: kuhnroyal/flutter-fvm-config-action/config@v3 | |
| id: fvm-config-action | |
| with: | |
| path: '.fvmrc' | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }} | |
| channel: ${{ matrix.arch == 'arm64' && 'master' || 'stable' }} # https://github.com/subosito/flutter-action/issues/345#issuecomment-2657332687 | |
| cache: true | |
| - name: Install dependencies | |
| shell: bash | |
| run: | | |
| sudo apt-get update --allow-releaseinfo-change | |
| sudo apt-get install -y xvfb libgtk-3-dev | |
| if [ "${{ matrix.arch }}" = "amd64" ]; then | |
| sudo apt-get install -y \ | |
| libgstreamer1.0-dev \ | |
| libgstreamer-plugins-base1.0-dev \ | |
| libgstreamer-plugins-bad1.0-dev \ | |
| gstreamer1.0-plugins-base \ | |
| gstreamer1.0-plugins-good \ | |
| gstreamer1.0-plugins-bad \ | |
| gstreamer1.0-plugins-ugly \ | |
| gstreamer1.0-libav \ | |
| gstreamer1.0-tools \ | |
| gstreamer1.0-x \ | |
| gstreamer1.0-alsa \ | |
| gstreamer1.0-gl \ | |
| gstreamer1.0-gtk3 \ | |
| gstreamer1.0-qt5 \ | |
| gstreamer1.0-pulseaudio | |
| else | |
| sudo apt-get install -y \ | |
| clang \ | |
| ninja-build \ | |
| gstreamer1.0-plugins-bad \ | |
| gstreamer1.0-plugins-ugly \ | |
| gstreamer1.0-libav | |
| fi | |
| - name: Run tests | |
| shell: bash | |
| working-directory: src/serious_python/example/flet_example | |
| run: | | |
| dart run serious_python:main package app/src --platform Linux --requirements flet | |
| xvfb-run flutter test integration_test -d linux | |
| publish: | |
| name: Publish to pub.dev | |
| needs: | |
| - macos | |
| - ios | |
| - android | |
| - windows | |
| - linux | |
| runs-on: ubuntu-22.04 | |
| # if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Setup Flutter | |
| uses: kuhnroyal/flutter-fvm-config-action/setup@v3 | |
| with: | |
| path: '.fvmrc' | |
| cache: true | |
| - name: Compute PKG_VER | |
| id: ver | |
| shell: bash | |
| run: | | |
| PKG_VER="${GITHUB_REF_NAME#v}" | |
| echo "PKG_VER=$PKG_VER" | tee -a "$GITHUB_ENV" | |
| - name: Configure pub.dev credentials | |
| # if: ${{ secrets.PUB_DEV_TOKEN != '' }} | |
| env: | |
| PUB_DEV_TOKEN: ${{ secrets.PUB_DEV_TOKEN }} | |
| run: | | |
| mkdir -p $HOME/.config/dart | |
| echo "$PUB_DEV_TOKEN" | base64 --decode > $HOME/.config/dart/pub-credentials.json | |
| - name: Patch pubspec versions | |
| shell: bash | |
| working-directory: "src" | |
| run: | | |
| for pkg in \ | |
| "serious_python" \ | |
| "serious_python_platform_interface" \ | |
| "serious_python_android" \ | |
| "serious_python_darwin" \ | |
| "serious_python_windows" \ | |
| "serious_python_linux"; do | |
| uv run "$SCRIPTS/patch_pubspec.py" "$pkg/pubspec.yaml" "$PKG_VER" | |
| pushd "$pkg" >/dev/null | |
| dart pub publish --dry-run | |
| popd >/dev/null | |
| done | |
| - name: Publish packages | |
| shell: bash | |
| working-directory: "src" | |
| run: | | |
| for pkg in \ | |
| "serious_python_platform_interface" \ | |
| "serious_python_android" \ | |
| "serious_python_darwin" \ | |
| "serious_python_windows" \ | |
| "serious_python_linux" \ | |
| "serious_python"; do | |
| pushd "$pkg" >/dev/null | |
| dart pub publish --dry-run | |
| popd >/dev/null | |
| done |