Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(e2e): fix e2e and add recent Flutter versions #2486

Merged
merged 54 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a88d710
ci(e2e): add Flutter 3.24.3
felangel Sep 13, 2024
ceba42a
try to update java version and clear gradle cache
felangel Sep 13, 2024
57e8a8f
see if manual uninstall fixes
felangel Sep 13, 2024
f766c96
adjust java version
felangel Sep 13, 2024
afd02c8
increase timeout
felangel Sep 13, 2024
fb63cbb
chore: run shorebird doctor
felangel Sep 13, 2024
87b2676
add setup-android
felangel Sep 13, 2024
453ad89
run flutter doctor
felangel Sep 13, 2024
79a3c20
simple example
felangel Sep 13, 2024
54a917e
tweak
felangel Sep 13, 2024
a38f493
tweak
felangel Sep 13, 2024
708ac3f
skip cli tests
felangel Sep 23, 2024
e426b2e
revert e2e test script
felangel Sep 23, 2024
f9e7d0d
chore: use --connected-device when building apks
felangel Sep 23, 2024
0e8c6f9
use default mode instead of universal
felangel Sep 23, 2024
fee8a98
test
felangel Dec 16, 2024
f8dfc0c
tweak
felangel Dec 17, 2024
7eec9ba
cache avd
felangel Dec 17, 2024
ce3ea61
chore: re-enable test script
felangel Dec 18, 2024
bc9e2a6
increase timeout
felangel Jan 2, 2025
a7d030d
more tweaks
felangel Jan 2, 2025
6b1b9a9
re-enable tests
felangel Jan 2, 2025
e84f270
update org
felangel Jan 2, 2025
eb2d0a2
typo
felangel Jan 2, 2025
e5f1b53
revert bundletool
felangel Jan 2, 2025
869a202
print packages
felangel Jan 2, 2025
af972e1
speed up patch builds
felangel Jan 2, 2025
653220f
verbose adb logs
felangel Jan 2, 2025
23a6090
attempt to reboot emulator
felangel Jan 2, 2025
6b3e7c1
no-cache
felangel Jan 2, 2025
1447b05
fix
felangel Jan 2, 2025
3810e60
verbose logs
felangel Jan 2, 2025
fa344b0
use api 29
felangel Jan 2, 2025
b9a58e6
use connected device
felangel Jan 2, 2025
3de8878
configure release signing
felangel Jan 2, 2025
12cce80
use realpath
felangel Jan 2, 2025
64c0be7
use absolute path for keystore
felangel Jan 2, 2025
4c307fa
use keystore when building apk
felangel Jan 2, 2025
2bad624
list packages
felangel Jan 2, 2025
c4c30f8
fix package name
felangel Jan 2, 2025
45e9dde
adjust shell monkey command
felangel Jan 2, 2025
8c36dc8
fix monkey package
felangel Jan 2, 2025
b17dab3
tweak
felangel Jan 2, 2025
ba68cd1
update package name when killing app
felangel Jan 2, 2025
b2b63f7
ci: re-add all Flutter versions
felangel Jan 2, 2025
3ddf6a3
try creating debug keystore
felangel Jan 3, 2025
61ef7bf
tweak
felangel Jan 3, 2025
36ee6a1
re-add older flutter versions
felangel Jan 3, 2025
b44c3cd
cleanup
felangel Jan 3, 2025
2d6b14f
Merge branch 'main' into ci/e2e-flutter-3.24.3
felangel Jan 3, 2025
d3ee187
cleanup
felangel Jan 3, 2025
a955ae9
cspell
felangel Jan 3, 2025
965f71b
more docs comments
felangel Jan 3, 2025
2a797ba
prepare to land
felangel Jan 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -58,31 +58,42 @@ 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
with:
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'
uses: reactivecircus/android-emulator-runner@v2
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
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
arch: x86_64
target: default
script: ./scripts/patch_e2e.sh ${{ matrix.flutter-version }}

cli:
Expand Down
42 changes: 25 additions & 17 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -79,6 +75,7 @@ words:
- pointycastle
- precache
- previewable
- PRNG
- propertylistserialization
- propertylistserialization
- pubspec
Expand All @@ -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
Expand Down
25 changes: 18 additions & 7 deletions scripts/patch_e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad this worked! I'm almost surprised there isn't a GHA already premade that does this sort of setup.

-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

Expand All @@ -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
Expand All @@ -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
Expand Down
Loading