@@ -15,121 +15,132 @@ env:
1515jobs :
1616 ios-integration-test :
1717 runs-on : macos-15-xlarge
18- timeout-minutes : 45
18+ timeout-minutes : 30
19+ env :
20+ XCODE_VERSION : ' 16.2'
1921 strategy :
2022 matrix :
21- device :
22- # the name of the simulator could be different depending on the macos version you are using
23- - " iPhone 16 Simulator (18.0) "
23+ test-group :
24+ - " general "
25+ - " optional-configurations "
2426 fail-fast : false
2527 steps :
26- - uses : actions/checkout@v4
28+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2729
28- - name : " List all simulators "
29- run : " xcrun xctrace list devices "
30+ - name : Select Xcode version
31+ run : sudo xcode-select -s '/Applications/Xcode_${{ env.XCODE_VERSION }}.app/Contents/Developer'
3032
31- - name : " Start Simulator"
32- # the command "xcrun simctl boot" expects a device identifier
33- # the assignment of the UDID variable consists of retrieving the ID of the simulator
34- # by extracting it from the command "xcrun xctrace list devices"
33+ - name : Boot iPhone Simulator
3534 run : |
36- UDID=$(xcrun xctrace list devices | grep -m 1 "^${{ matrix.device }}" | awk '{gsub(/[()]/,""); print $NF}')
37- echo $UDID
38- xcrun simctl boot "${UDID:?No Simulator with this name found}"
39-
40- - name : Cache Flutter dependencies
41- uses : actions/cache@v4
35+ DEVICE_ID=$(xcrun simctl list devices available | grep "iPhone" | head -1 | grep -o "([A-F0-9\\-]*)" | tr -d "()")
36+ if [ -z "$DEVICE_ID" ]; then
37+ echo "No iPhone simulators available!"
38+ exit 1
39+ fi
40+ xcrun simctl boot "$DEVICE_ID" || echo "Simulator may already be booted"
41+ sleep 15
42+ echo "DEVICE_ID=$DEVICE_ID" >> $GITHUB_ENV
43+
44+ - name : Cache Cocoapods
45+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4246 with :
43- path : ${{ runner.tool_cache }}/flutter
44- key : ${{ runner.os }}-flutter-install-cache-${{ env.FLUTTER_VERSION }}
47+ path : example/ios/Pods
48+ key : ${{ runner.os }}-pods-${{ hashFiles('example/ios/Podfile.lock') }}
49+ restore-keys : |
50+ ${{ runner.os }}-pods-
4551
4652 - name : Setup Flutter SDK
4753 uses : subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # v2.18.0
4854 with :
4955 flutter-version : ${{ env.FLUTTER_VERSION }}
5056 channel : stable
57+ cache : true # Let flutter-action handle caching efficiently
5158
52- - name : Install Flutter dependencies
53- run : flutter pub get
59+ - name : Install dependencies
60+ run : |
61+ flutter pub get
62+ cd example && flutter pub get
5463
55- - name : Run iOS integration tests
64+ - name : Run iOS integration tests (${{ matrix.test-group }})
5665 env :
5766 BKT_API_KEY : ${{ secrets.BKT_API_KEY }}
5867 BKT_API_ENDPOINT : ${{ secrets.BKT_API_ENDPOINT }}
59- run : make e2e
68+ TEST_GROUP : ${{ matrix.test-group }}
69+ DEVICE_ID : ${{ env.DEVICE_ID }}
70+ run : |
71+ if [ "${{ matrix.test-group }}" = "general" ]; then
72+ TEST_NAME="general test"
73+ elif [ "${{ matrix.test-group }}" = "optional-configurations" ]; then
74+ TEST_NAME="optional configurations test"
75+ fi
76+ cd example && flutter test -d $DEVICE_ID --dart-define=API_KEY=$BKT_API_KEY --dart-define=API_ENDPOINT=$BKT_API_ENDPOINT integration_test --name="$TEST_NAME"
6077
6178 android-integration-test :
6279 runs-on : ubuntu-latest
63- timeout-minutes : 45
80+ timeout-minutes : 20
6481 strategy :
6582 matrix :
6683 api-level :
6784 - 33
6885 target :
69- - google_apis
86+ - default
7087 arch :
7188 - x86_64
7289 cores :
7390 - 8
91+ test-group :
92+ - " general"
93+ - " optional-configurations"
7494 fail-fast : false
7595 steps :
76- - uses : actions/checkout@v4
77-
78- - name : Cache Flutter dependencies
79- uses : actions/cache@v4
80- with :
81- path : ${{ runner.tool_cache }}/flutter
82- key : ${{ runner.os }}-flutter-install-cache-${{ env.FLUTTER_VERSION }}
96+ - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8397
8498 - name : Setup Flutter SDK
8599 uses : subosito/flutter-action@f2c4f6686ca8e8d6e6d0f28410eeef506ed66aff # v2.18.0
86100 with :
87101 flutter-version : ${{ env.FLUTTER_VERSION }}
88102 channel : stable
103+ cache : true
104+
105+ - name : Setup Gradle
106+ uses : gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
107+ with :
108+ cache-cleanup : on-success
89109
90- - name : Install Flutter dependencies
110+ - name : Install dependencies
91111 run : flutter pub get
92112
93113 - name : AVD cache
94- uses : actions/cache@v4
114+ uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
95115 id : avd-cache
96116 with :
97117 path : |
98118 ~/.android/avd/*
99119 ~/.android/adb*
100- key : avd-${{ matrix.api-level }}
120+ key : avd-${{ matrix.api-level }}-${{ matrix.target }}-${{ matrix.arch }}
121+ restore-keys : |
122+ avd-${{ matrix.api-level }}-${{ matrix.target }}-
123+ avd-${{ matrix.api-level }}-
101124
102125 - name : Enable KVM
103126 run : |
104127 echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
105128 sudo udevadm control --reload-rules
106129 sudo udevadm trigger --name-match=kvm
107130
108- - name : Create AVD and generate snapshot for caching
109- if : steps.avd-cache.outputs.cache-hit != 'true'
131+ - name : Create emulator and run e2e test
110132 uses : reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0
111133 with :
112134 api-level : ${{ matrix.api-level }}
113135 target : ${{ matrix.target }}
114136 arch : ${{ matrix.arch }}
115137 cores : ${{ matrix.cores }}
116138 force-avd-creation : false
117- emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
118- disable-animations : false
119- script : echo "Generated AVD snapshot for caching"
120-
121- - name : Run Android integration tests
139+ emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim
140+ disable-animations : true
141+ script : cd example && flutter test --dart-define=API_KEY=$BKT_API_KEY --dart-define=API_ENDPOINT=$BKT_API_ENDPOINT integration_test --name="${{ matrix.test-group == 'general' && 'general test' || 'optional configurations test' }}"
122142 env :
123143 BKT_API_KEY : ${{ secrets.BKT_API_KEY }}
124144 BKT_API_ENDPOINT : ${{ secrets.BKT_API_ENDPOINT }}
125- GRADLE_OPTS : -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx1536m -XX:MaxMetaspaceSize=2g"
126- uses : reactivecircus/android-emulator-runner@62dbb605bba737720e10b196cb4220d374026a6d # v2.33.0
127- with :
128- api-level : ${{ matrix.api-level }}
129- target : ${{ matrix.target }}
130- arch : ${{ matrix.arch }}
131- cores : ${{ matrix.cores }}
132- force-avd-creation : false
133- emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
134- disable-animations : true
135- script : make e2e
145+ TEST_GROUP : ${{ matrix.test-group }}
146+ GRADLE_OPTS : -Dorg.gradle.daemon=true -Dorg.gradle.parallel=true -Dorg.gradle.caching=true -Dorg.gradle.jvmargs="-Xmx2g -XX:MaxMetaspaceSize=1g"
0 commit comments