Create deep link test runners for Android and iOS #36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
env: | ||
EXPORT_OPTS_PATH: ${{ env.RUNNER_TEMP }}/ExportOptions.plist | ||
Check failure on line 82 in .github/workflows/pr_validation.yaml
|
||
steps: | ||
- 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 }} | ||
EXPORT_OPTIONS_PLIST: ${{ secrets.EXPORT_OPTIONS_PLIST }} | ||
run: | | ||
# create variables | ||
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | ||
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | ||
KEYCHAIN_PATH=~/Library/Keychains/login.keychain-db | ||
# 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 | ||
# apply provisioning profile | ||
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | ||
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | ||
# Save ExportOptions.plist from Base64 to file | ||
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: Set up Flutter | ||
uses: subosito/flutter-action@v2 | ||
with: | ||
channel: stable | ||
architecture: x64 | ||
- name: Install Flutter Dependencies | ||
run: flutter pub get | ||
- name: Build iOS App | ||
run: flutter build ipa --debug --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 | ||