diff --git a/.github/workflows/scripts/install-flutter.sh b/.github/workflows/scripts/install-flutter.sh new file mode 100755 index 0000000..753aea7 --- /dev/null +++ b/.github/workflows/scripts/install-flutter.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +BRANCH=$1 + +git clone https://github.com/flutter/flutter.git --depth 1 -b $BRANCH _flutter +echo "$GITHUB_WORKSPACE/_flutter/bin" >>$GITHUB_PATH diff --git a/.github/workflows/scripts/install-tools.sh b/.github/workflows/scripts/install-tools.sh new file mode 100755 index 0000000..c5e4ddf --- /dev/null +++ b/.github/workflows/scripts/install-tools.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +flutter config --no-analytics +flutter pub global activate melos 3.0.0 +echo "$HOME/.pub-cache/bin" >>$GITHUB_PATH +echo "$HOME/AppData/Local/Pub/Cache/bin" >>$GITHUB_PATH +echo "$GITHUB_WORKSPACE/_flutter/.pub-cache/bin" >>$GITHUB_PATH +echo "$GITHUB_WORKSPACE/_flutter/bin/cache/dart-sdk/bin" >>$GITHUB_PATH diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0cd4690..9cc1a56 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,12 +11,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' + - name: "Install Flutter" + run: ./.github/workflows/scripts/install-flutter.sh stable + - name: "Install Tools" + run: | + ./.github/workflows/scripts/install-tools.sh - name: Test run: | - dart pub global activate melos melos bootstrap cd workmanager flutter pub get @@ -26,27 +27,37 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' + - name: "Install Flutter" + run: ./.github/workflows/scripts/install-flutter.sh stable + - name: "Install Tools" + run: | + ./.github/workflows/scripts/install-tools.sh - name: Build iOS App run: cd example && flutter build ios --debug --no-codesign - name: Run native iOS tests run: cd example/ios && xcodebuild -workspace Runner.xcworkspace -scheme Runner -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12,OS=16.2' test native_android_tests: - runs-on: macos-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: 21 - - uses: subosito/flutter-action@v2 + - name: "Install Flutter" + run: ./.github/workflows/scripts/install-flutter.sh stable + - name: "Install Tools" + run: | + ./.github/workflows/scripts/install-tools.sh + - name: Run Flutter Driver tests + uses: reactivecircus/android-emulator-runner@v2 with: - channel: 'stable' - - name: Activate melos - run: dart pub global activate melos && melos bootstrap + arch: x86_64 + profile: Nexus 6 + api-level: 34 + target: google_apis + script: cd example && flutter test integration_test/workmanager_integration_test.dart - name: Build Android App run: cd example && flutter build apk --debug - name: Run native Android tests @@ -64,12 +75,12 @@ jobs: with: model: '${{ matrix.device }}' - uses: actions/checkout@v4 - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' + - name: "Install Flutter" + run: ./.github/workflows/scripts/install-flutter.sh stable + - name: "Install Tools" + run: | + ./.github/workflows/scripts/install-tools.sh # Run flutter integrate tests - - name: Activate melos - run: dart pub global activate melos && melos bootstrap - name: Run Flutter integration tests run: cd example && flutter test integration_test/workmanager_integration_test.dart @@ -90,11 +101,11 @@ jobs: with: distribution: 'temurin' java-version: 21 - - uses: subosito/flutter-action@v2 - with: - channel: 'stable' - - name: Activate melos - run: dart pub global activate melos && melos bootstrap + - name: "Install Flutter" + run: ./.github/workflows/scripts/install-flutter.sh stable + - name: "Install Tools" + run: | + ./.github/workflows/scripts/install-tools.sh - name: Enable KVM run: | echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules @@ -103,7 +114,7 @@ jobs: - name: Run Flutter Driver tests uses: reactivecircus/android-emulator-runner@v2 with: - arch: x86_64 + # arch: x86_64 profile: Nexus 6 api-level: ${{ matrix.api-level }} target: ${{ matrix.target }}