From 8a77f66dc7abaf4e89062023df6da5df48b6c994 Mon Sep 17 00:00:00 2001 From: Thing-leoh Nicolas Date: Wed, 5 Oct 2022 22:26:51 +0200 Subject: [PATCH] [FIX] CI builds --- .github/workflows/build.android.yaml | 13 +++---- .github/workflows/build.ios.yaml | 12 +++--- .github/workflows/prepare.yaml | 55 +++++++++++++++++----------- 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/.github/workflows/build.android.yaml b/.github/workflows/build.android.yaml index 2c09ce7..1b4e8cb 100644 --- a/.github/workflows/build.android.yaml +++ b/.github/workflows/build.android.yaml @@ -1,11 +1,10 @@ -name: build-android -on: - push: - - main - -needs: test +name: build.android +on: [pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: - build:android: + build_android: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/build.ios.yaml b/.github/workflows/build.ios.yaml index 2473e7d..3c25a2d 100644 --- a/.github/workflows/build.ios.yaml +++ b/.github/workflows/build.ios.yaml @@ -1,10 +1,10 @@ -name: build-ios -on: - push: - - main - +name: build.ios +on: [pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: - build:ios: + build_ios: runs-on: macos-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/prepare.yaml b/.github/workflows/prepare.yaml index 54a264e..dc36435 100644 --- a/.github/workflows/prepare.yaml +++ b/.github/workflows/prepare.yaml @@ -1,9 +1,8 @@ name: prepare -on: - push: - # Sequence of patterns matched against refs/heads - branches: - - main +on: [pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: analyze: runs-on: ubuntu-latest @@ -13,7 +12,6 @@ jobs: with: channel: "stable" cache: true - - run: flutter precache - run: flutter pub get - run: flutter analyze --no-pub @@ -21,27 +19,40 @@ jobs: needs: analyze strategy: matrix: - device: - # The available simulators are listed by the "xcrun xctrace list devices" command - - "iPhone 12 Simulator (15.2)" # the name of the simulator could be different depending on the macos version you are using - # if one of the jobs in the matrix expansion fails, the rest of the jobs will be cancelled + api-level: [29] fail-fast: true - runs-on: macos-latest + runs-on: ubuntu-latest + steps: - - name: "List all simulators" - run: "xcrun xctrace list devices" - - name: "Start Simulator" - # the command "xcrun simctl boot" expects a device identifier - # the assignment of the UDID variable consists of retrieving the ID of the simulator - # by extracting it from the command "xcrun xctrace list devices" - run: | - UDID=$(xcrun xctrace list devices | grep "^${{ matrix.device }}" | awk '{gsub(/[()]/,""); print $NF}') - echo $UDID - xcrun simctl boot "${UDID:?No Simulator with this name found}" - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: channel: "stable" cache: true + + - name: AVD cache + uses: actions/cache@v3 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + key: avd-${{ matrix.api-level }} + - name: create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-level }} + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: false + script: echo "Generated AVD snapshot for caching." + - name: "Run integration tests" - run: flutter test integration_test + uses: reactivecircus/android-emulator-runner@v2 + with: + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + api-level: ${{ matrix.api-level }} + script: flutter test integration_test