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

Create deep link test runners for Android and iOS #2

Open
wants to merge 120 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
4c31e80
Create deep link test runners for Android and iOS
matthew-carroll Dec 28, 2024
c4e2fd0
Fix Flutter setup in GitHub action
matthew-carroll Dec 28, 2024
988b237
Fix Flutter setup in GitHub action
matthew-carroll Dec 28, 2024
835362e
Trying to get emulator action to work
matthew-carroll Dec 28, 2024
e4fd095
Trying to get emulator action to work
matthew-carroll Dec 28, 2024
78fe26a
Trying to get emulator action to work
matthew-carroll Dec 28, 2024
f84fdd4
Trying to get emulator action to work
matthew-carroll Dec 28, 2024
d6d8eec
Trying to get emulator action to work
matthew-carroll Dec 28, 2024
576dd21
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
fe72380
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
a1e37c3
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
57bbe0c
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
2ec5442
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
6f90c73
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
9ac0b14
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
a0dd1b6
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
2fe8f5e
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
0f8b7a5
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
4dd7106
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
9175ded
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
743cc72
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
b20dba1
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
abcd599
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
a35642e
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
0d09645
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
befa4de
Trying to get emulator action to work
matthew-carroll Dec 29, 2024
0aedb1b
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
9221162
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
04ce0d7
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
bd99613
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
15e8ffd
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
6c84428
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
98564b6
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
3bc8656
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
635e269
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
4ac744a
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
320dde2
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
1f9cd1d
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
4faabce
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
497d476
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
333d6c1
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
1ef1fab
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
4c5060a
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
13a20cd
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
b468f76
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
490d5fd
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
c25d463
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
16becdf
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
a8b97ea
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
2669ef0
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
7da68b6
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
cfffefd
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
951a758
Working on iOS GitHub CI
matthew-carroll Dec 29, 2024
cdc196f
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
b4264aa
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
32de252
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
0565ea5
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
7b8f3bd
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
eb013c0
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
cbb7b32
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
d793dd5
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
31e244f
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
5888d4f
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
08f60e6
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
ec80d78
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
d943d58
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
25e6cc2
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
58a6fef
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
b05878c
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
4f120bd
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
d47994a
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
ca00cff
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
cf629f8
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
78a2c08
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
4349d00
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
1a8c0f2
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
f70fc99
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
eb4fa17
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
0155e0b
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
b493e18
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
ebfc60b
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
c13f450
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
5ae1f9c
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
d9df88d
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
5d7fc9f
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
51df910
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
25d83d1
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
d8b13c0
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
5ca2c76
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
f73c1f8
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
6200545
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
7a7099a
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
233822d
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
ac0242f
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
4909b72
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
05de35f
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
672b82d
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
b0e410d
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
39828b3
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
9560e06
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
be824b9
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
62eaae6
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
c74ab4f
Working on iOS GitHub CI
matthew-carroll Dec 30, 2024
26375b6
Try really long timeout
matthew-carroll Jan 2, 2025
4b57e32
Add missing import
matthew-carroll Jan 2, 2025
1d2af5b
Adjusted how we send the kill command through Process, also removed a…
matthew-carroll Jan 2, 2025
219f66a
Removing killApp() for the moment to see if killing a non running app…
matthew-carroll Jan 2, 2025
34363e5
Added --vebose and --debug to sh commands
matthew-carroll Jan 2, 2025
e6b448e
Commented out everything in the test runner exept checking if the app…
matthew-carroll Jan 2, 2025
14d9012
Trying to run command without grep to see if that makes a difference
matthew-carroll Jan 2, 2025
2f6b9bc
Fixed compilation error
matthew-carroll Jan 2, 2025
8880a11
Re-implemented app running without grep
matthew-carroll Jan 3, 2025
6d58884
Bring back clear logs step
matthew-carroll Jan 3, 2025
1c5f28a
Combine all args in _runInShell() and also throw exception on bad res…
matthew-carroll Jan 4, 2025
86ccde0
Try adding stdout and stderr to see what's going wrong
matthew-carroll Jan 4, 2025
ebdab76
Skip clearing logs (GitHub says not permitted). Send the deep link.
matthew-carroll Jan 4, 2025
3a7e7eb
The deep link command printed an error, but return code was zero. So …
matthew-carroll Jan 4, 2025
67eeabb
Reduced verbosity of app running check
matthew-carroll Jan 4, 2025
032dbee
Added process count to app running check
matthew-carroll Jan 4, 2025
fc988c1
Add 'sudo' to deep link launch behavior
matthew-carroll Jan 4, 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
251 changes: 251 additions & 0 deletions .github/workflows/pr_validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
name: Validate PR

on: [pull_request, workflow_dispatch]

jobs:
# test_flutter-test-runners_deep-links_android:
# runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: ./packages/flutter_test_runners/example_deep_links
#
# steps:
# - name: Checkout Repository
# uses: actions/checkout@v3
#
# # Need JDK 17 for Android build.
# - name: Set up JDK 17
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: '17'
#
# # The Android emulator action seems to want to include this.
# - name: enable KVM for linux runners
# working-directory: ~
# 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: Set up Flutter
# uses: subosito/flutter-action@v2
# with:
# channel: stable
# architecture: x64
#
# - name: Install Flutter Dependencies
# run: flutter pub get
#
# - name: Build Flutter App (Debug Mode)
# # Must be debug mode so we can enable Flutter Driver.
# run: flutter build apk --debug
#
# - name: Install Android SDK and launch emulator
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: 35
# target: default
# arch: x86_64
# profile: Galaxy Nexus
# cores: 2
# disk-size: 6000M
# heap-size: 600M
# sdcard-path-or-size: 100M
# avd-name: github-ci-emulator
# force-avd-creation: false
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: false
# script: |
# echo "Running emulator..."
# echo "Working directory: $(pwd)"
#
# echo "Unlocking the screen"
# adb shell input keyevent 82 # Unlock the emulator screen if it's locked
# echo ""
#
# echo "Installing the APK"
# cd packages/flutter_test_runners/example_deep_links && flutter install --debug -d emulator-5554
# echo ""
#
# echo "Running Flutter tests"
# cd packages/flutter_test_runners/example_deep_links && flutter test test_driver/deep_link_android_test.dart

test_flutter-test-runners_deep-links_ios:
runs-on: macos-latest

defaults:
run:
working-directory: ./packages/flutter_test_runners/example_deep_links

steps:
- name: Set location for ExportOptions.plist
working-directory: ~
run: |
echo "EXPORT_OPTS_PATH=$RUNNER_TEMP/ExportOptions.plist" >> $GITHUB_ENV

- name: Install the Apple certificate and provisioning profile
working-directory: ~
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.SIGNING_CERTIFICATE }}
P12_PASSWORD: ${{ secrets.SIGNING_CERTIFICATE_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.PROVISIONING_PROFILE }}
PP_FILE_NAME: fbh_deep_link_example_app_profile.mobileprovision
EXPORT_OPTIONS_PLIST: ${{ secrets.EXPORT_OPTIONS_PLIST }}
run: |
# Create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/$PP_FILE_NAME
KEYCHAIN_PATH=~/Library/Keychains/login.keychain-db

# Check keychain status
echo "All keychains:"
security list-keychains

echo "Is keychain unlocked?"
security show-keychain-info $KEYCHAIN_PATH

# Import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH

# create temporary keychain
#security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
#security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
#security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH

# Import certificate to keychain
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH

# Verify certificate was loaded into keychain
echo "Verifying that the signing certificate was loaded into the keychain"
security find-identity -p codesigning -v

# Apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles

# List all provisioning profiles to make sure we placed it correctly
echo "Listing all provisioning profiles in the CI server"
ls ~/Library/MobileDevice/Provisioning\ Profiles/
echo ""

# Check provisioning profile data
echo "Provisioning profile data:"
security cms -D -i ~/Library/MobileDevice/Provisioning\ Profiles/$PP_FILE_NAME
echo ""

# Save ExportOptions.plist from Base64 to file
echo "Saving the base64 encoded ExportOptions.plist to $EXPORT_OPTS_PATH"
echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH

- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Xcode
run: |
sudo xcode-select -s /Applications/Xcode.app
xcodebuild -version

- name: Check Xcode build settings
run: |
echo "Listing all the build settings for the project:"
cd ios && xcodebuild -showBuildSettings

- name: Check Xcode project Runner build settings
run: |
echo "Listing all the build settings for the Runner scheme:"
cd ios && xcodebuild -workspace Runner.xcworkspace -scheme Runner -showBuildSettings

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
architecture: x64

- name: Install Flutter Dependencies
run: flutter pub get

- name: Build the app
run: flutter build ios --debug --verbose --simulator --no-codesign

- name: Check for built app
run: |
echo "Checking for app build artifacts..."
echo "build/"
ls -la build
echo ""

echo "build/ios/"
ls -la build/ios
echo ""

echo "build/ios/Debug-iphonesimulator/"
ls -la build/ios/Debug-iphonesimulator
echo ""

echo "build/ios/iphonesimulator/"
ls -la build/ios/iphonesimulator
echo ""

# - name: Build iOS App
# run: flutter build ipa --debug --verbose --export-options-plist=$EXPORT_OPTS_PATH
#
# - name: Install iOS App
# run: flutter install ipa

- name: Create and Boot iOS Simulator
run: |
# List available devices and runtimes
xcrun simctl list devices
xcrun simctl list runtimes

# Create a new simulator (if needed)
SIMULATOR_ID=$(xcrun simctl create "GitHubActions-Simulator" "iPhone 14" "com.apple.CoreSimulator.SimRuntime.iOS-17-0")

# Boot the simulator
xcrun simctl boot "$SIMULATOR_ID"
xcrun simctl list devices booted

# Install the app using xcrun. Apparently, there's no Flutter command to
# install an unsigned iOS app. The "flutter install" command only works if
# the app is signed.
- name: Install the app
run: xcrun simctl install booted build/ios/iphonesimulator/Runner.app

- name: Ensure simulator is booted
run: xcrun simctl bootstatus booted

- name: Check the simulator UI
run: xcrun simctl ui booted appearance

- name: Take a screenshot of the simulator
run: |
mkdir -p ~/simulator-screenshots
xcrun simctl io booted screenshot ~/simulator-screenshots/screenshot.png

- name: Upload simulator screenshot as Artifact
uses: actions/upload-artifact@v3
with:
name: simulator-screenshot
path: ~/simulator-screenshots/screenshot.png

- name: Check for installed app on simulator
run: |
echo "Checking for app's container on the booted simulator:"
xcrun simctl get_app_container booted com.flutterbountyhunters.deeplinks.example

# - name: Kill any simctl processes
# run: pkill -f runner
#
# - name: Check for other processes using the simulator
# run: ps aux | grep simctl

# - name: Launch the app on the simulator just to prove we can
# run: |
# echo "Launching the installed app to prove that we can..."
# xcrun simctl launch booted com.flutterbountyhunters.deeplinks.example

- name: Run the iOS deep link tests
run: flutter test test_driver/deep_link_ios_test.dart
6 changes: 6 additions & 0 deletions .run/Example_ Deep Links.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Example: Deep Links" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="filePath" value="$PROJECT_DIR$/packages/flutter_test_runners/example_deep_links/lib/main.dart" />
<method v="2" />
</configuration>
</component>
5 changes: 4 additions & 1 deletion melos_flutter_testing.iml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>
</module>
45 changes: 45 additions & 0 deletions packages/flutter_test_runners/example_deep_links/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
33 changes: 33 additions & 0 deletions packages/flutter_test_runners/example_deep_links/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "17025dd88227cd9532c33fa78f5250d548d87e9a"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
- platform: android
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
- platform: ios
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
3 changes: 3 additions & 0 deletions packages/flutter_test_runners/example_deep_links/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Example: Deep Links
This app is configured for deep links so that `flutter_test_runner` deep link
verification tools can be validated.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
Loading
Loading