From 4cc3f48f27961070e87a4751931291cd0f22805d Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Fri, 3 Jan 2025 11:38:08 -0600 Subject: [PATCH] ci(e2e): fix e2e and add recent Flutter versions (#2486) --- .github/workflows/e2e.yaml | 19 +++++++++++++---- cspell.config.yaml | 42 +++++++++++++++++++++++--------------- scripts/patch_e2e.sh | 25 ++++++++++++++++------- 3 files changed, 58 insertions(+), 28 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index b9fe4c76..5e3e5a37 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -12,14 +12,14 @@ on: env: SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }} - FLUTTER_VERSION: 3.24.4 + FLUTTER_VERSION: 3.27.1 jobs: patch: strategy: fail-fast: false matrix: - flutter-version: [3.24.1, 3.24.0, 3.22.3, 3.22.2, 3.19.6] + flutter-version: [3.27.1, 3.27.0, 3.24.5, 3.24.4, 3.24.3, 3.24.1, 3.24.0, 3.22.3, 3.22.2, 3.19.6] runs-on: ubuntu-latest timeout-minutes: 15 @@ -58,6 +58,13 @@ jobs: flutter-version: ${{ matrix.flutter-version }} cache: true + - name: ๐Ÿš€ Enable KVM for Linux Runners + if: runner.os == 'Linux' + 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: ๐Ÿค– AVD Cache uses: actions/cache@v4 id: avd-cache @@ -65,7 +72,7 @@ jobs: path: | ~/.android/avd/* ~/.android/adb* - key: avd-29 + key: avd-29-${{ runner.os }}-${{ hashFiles('.github/workflows/e2e.yaml') }} - name: ๐Ÿค– Cache AVD Snapshot if: steps.avd-cache.outputs.cache-hit != 'true' @@ -73,9 +80,12 @@ jobs: with: api-level: 29 arch: x86_64 + target: default force-avd-creation: false - emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + sdcard-path-or-size: 512M + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot disable-animations: false + channel: canary script: echo "Generated AVD Snapshot" - name: ๐Ÿงช Run Patch E2E Tests @@ -83,6 +93,7 @@ jobs: with: api-level: 29 arch: x86_64 + target: default script: ./scripts/patch_e2e.sh ${{ matrix.flutter-version }} cli: diff --git a/cspell.config.yaml b/cspell.config.yaml index 66b491a0..aeb83d31 100644 --- a/cspell.config.yaml +++ b/cspell.config.yaml @@ -3,33 +3,19 @@ version: "0.2" ignorePaths: ["coverage", "bin/cache", "third_party", "build", "*.xcscheme", "fixtures"] words: - - ANDROIDD - - Apks - - Azul - - Entra - - FLUSHALL - - LOCALAPPDATA - - NOAUTH - - Oltman - - PRNG - - RSAPKCS - - Retryable - - SIGSTOP - - USERPROFILE - - Unpatchable - - VCRUNTIME - - Verdana - - WRONGPASS - aabs - aapt - aarch - aars # Android Archive - allprojects # From gradle files - altool + - ANDROIDD - apigee + - Apks - appbundle - archs - armeabi + - Azul - backboardd - bintools - bitcode @@ -47,21 +33,29 @@ words: - dyld - dylib - endtemplate + - Entra - exitcode - exportoptions - felangel + - FLUSHALL - genhtml + - genkey # From .github/workflows/e2e.yaml - gradlew - hotreload - idevicesyslog - iokit - iphoneos + - keyalg # From .github/workflows/e2e.yaml + - keypass # From .github/workflows/e2e.yaml + - keysize # From .github/workflows/e2e.yaml + - keytool # From .github/workflows/e2e.yaml - lerping - libapp - libflutter - libimobiledevice - libplist - lldb + - LOCALAPPDATA - logcat - longpaths - lproj @@ -70,7 +64,9 @@ words: - mocktail - multioption - noaudio # From .github dir, doesn't show up in "**" check? + - NOAUTH - nserror + - Oltman - orri # Arm64 instruction, Or Register with Immediate - pana - pkcs @@ -79,6 +75,7 @@ words: - pointycastle - precache - previewable + - PRNG - propertylistserialization - propertylistserialization - pubspec @@ -87,24 +84,35 @@ words: - readlink - reinit - requirepass # From .github dir, doesn't show up in "**" check? + - Retryable + - RSAPKCS + - sdcard # From .github/workflows/e2e.yaml - shorebirdtech - sideload - sideloadable - sideloaded - signup + - SIGSTOP + - storepass # From .github/workflows/e2e.yaml - storyboardc - subosito # From .github dir, doesn't show up in "**" check? - swiftshader # From .github dir, doesn't show up in "**" check? - sysroot - temurin # From .github dir, doesn't show up in "**" check? + - udevadm # From .github/workflows/e2e.yaml - udid # Unique Device Identifier - unawaited - unmockable + - Unpatchable - unsets - upvote - usbmuxd + - USERPROFILE + - VCRUNTIME + - Verdana - vmcode - writeln + - WRONGPASS - xcarchive - xcarchives - xcframework diff --git a/scripts/patch_e2e.sh b/scripts/patch_e2e.sh index 6a49a58b..835d76f6 100755 --- a/scripts/patch_e2e.sh +++ b/scripts/patch_e2e.sh @@ -21,7 +21,7 @@ TEMP_DIR=$(mktemp -d -t 'shorebird workspace-XXXXX') cd "$TEMP_DIR" # Create a new empty flutter project -flutter create e2e_test --empty --platforms android +flutter create e2e_test --org com.example.e2e_test --empty --platforms android cd e2e_test # Replace the contents of "lib/main.dart" with a single print statement. @@ -30,12 +30,23 @@ echo "void main() { print('hello world'); }" >lib/main.dart # Initialize Shorebird shorebird init --force -v +# Run Flutter & Shorebird doctor to ensure that the project is set up correctly. +flutter doctor --verbose +shorebird doctor --verbose + # Point to the development environment -echo "base_url: https://api-dev.shorebird.dev" >> shorebird.yaml +echo "base_url: https://api-dev.shorebird.dev" >>shorebird.yaml # Extract the app_id from the "shorebird.yaml" APP_ID=$(cat shorebird.yaml | grep 'app_id:' | awk '{print $2}') +# Create Debug Keystore +# Android Studio creates this keystore by default, but we need to create it manually for CI. +# See https://github.com/google/bundletool/blob/69c3e0947bab350fbe7cbd9af03a77b0204d6dc8/src/main/java/com/android/tools/build/bundletool/commands/BuildApksCommand.java +keytool -genkey -v -keystore ~/.android/debug.keystore -keyalg RSA \ + -keysize 2048 -validity 10000 -alias AndroidDebugKey -storepass android -keypass android \ + -dname "CN=Android Debug,O=Android,C=US" + # Create a new release on Android shorebird release android --flutter-version=$FLUTTER_VERSION --split-debug-info=./build/symbols -v @@ -46,7 +57,7 @@ while IFS= read line; do echo "โœ… 'hello world' was printed" break fi -done < <(shorebird preview --release-version 0.1.0+1 --app-id $APP_ID --platform android) +done < <(shorebird preview --release-version 0.1.0+1 --app-id $APP_ID --platform android -v) # Replace lib/main.dart "hello world" to "hello shorebird" sed -i 's/hello world/hello shorebird/g' lib/main.dart @@ -55,20 +66,20 @@ echo "lib/main.dart is now:" cat lib/main.dart # Create a patch -shorebird patch android --split-debug-info=./build/symbols -v +shorebird patch android --release-version 0.1.0+1 --split-debug-info=./build/symbols -v # Run the app on Android and ensure that the original print statement is printed. while IFS= read line; do if [[ "$line" == *"Patch 1 successfully"* ]]; then # Kill the app so we can boot the patch - adb shell am force-stop com.example.e2e_test + adb shell am force-stop com.example.e2e_test.e2e_test echo "โœ… Patch 1 successfully installed" break fi -done < <(shorebird preview --release-version 0.1.0+1 --app-id $APP_ID --platform android) +done < <(shorebird preview --release-version 0.1.0+1 --app-id $APP_ID --platform android -v) # Re-run the app, *not* using shorebird preview, as that installs the base release. -adb shell monkey -p com.example.e2e_test -c android.intent.category.LAUNCHER 1 +adb shell monkey -p com.example.e2e_test.e2e_test -c android.intent.category.LAUNCHER 1 # Re-run the app on Android and ensure that the new print statement is printed, # tailing adb logs and printing the last 10 seconds of logs in case the