fixes pipeline #29
Workflow file for this run
This file contains 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: Build and Test Flutter App | |
on: | |
push: | |
branches: | |
- main | |
- automated-tests | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-test-android: | |
name: Build and Test Flutter App on Android | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/passkeys/passkeys/example | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Flutter | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.27.1' | |
# Step 3: Install Node.js (for Appium) | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
# Step 4: Install Appium and Dependencies | |
- name: Install Appium and Test Dependencies | |
run: | | |
npm install -g appium | |
appium driver install --source=npm appium-flutter-driver | |
appium driver install uiautomator2 | |
appium driver install --source npm appium-flutter-integration-driver | |
# Step 5: Install Flutter Dependencies | |
- name: Install Flutter Dependencies | |
run: | | |
flutter pub get | |
# Step 6: Set up Java (Java 17) | |
- name: Setup Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
# Step 7: Start the Emulator | |
- name: Set Up Android Emulator | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 35 | |
target: google_apis | |
arch: x86_64 | |
profile: pixel_5 | |
script: | | |
adb wait-for-device | |
adb shell input keyevent 82 & | |
# Step 8: Build the Flutter App | |
- name: Build Flutter App | |
run: | | |
flutter build apk --debug | |
# Step 9: Install and Launch the App | |
- name: Install and Launch App | |
run: | | |
adb install -r build/app/outputs/flutter-apk/app-debug.apk | |
adb shell am start -n "com.corbado.passkeys.pub/com.corbado.passkeys.pub.MainActivity" | |
# Step 10: Start Appium Server | |
- name: Start Appium Server | |
run: | | |
nohup appium > appium.log 2>&1 & | |
sleep 10 | |
# Step 11: Run Tests | |
- name: Run Appium Tests | |
run: | | |
cd tests | |
npm i | |
node main.js android | |
build-test-ios: | |
name: Build and Test Flutter App on iOS | |
runs-on: macos-latest | |
defaults: | |
run: | |
working-directory: packages/passkeys/passkeys/example | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Flutter | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: '3.27.1' | |
# Step 3: Install Node.js (for Appium) | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
# Step 4: Install Appium and Dependencies | |
- name: Install Appium and Test Dependencies | |
run: | | |
npm install -g appium | |
appium driver install --source=npm appium-flutter-driver | |
appium driver install uiautomator2 | |
appium driver install --source npm appium-flutter-integration-driver | |
# Step 5: Install Flutter Dependencies | |
- name: Install Flutter Dependencies | |
run: flutter pub get | |
# Step 6: Set up Xcode | |
- name: Set Up Xcode | |
run: | | |
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer | |
sudo xcodebuild -license accept | |
# Step 7: Launch the iOS Simulator | |
- name: Launch iOS Simulator | |
run: | | |
xcrun simctl shutdown all | |
xcrun simctl boot "iPhone 16 Pro" | |
while ! xcrun simctl bootstatus | grep -q "Booted"; do | |
echo "Waiting for simulator to boot..." | |
sleep 5 | |
done | |
# Step 8: Build the Flutter App | |
- name: Build Flutter App | |
run: | | |
flutter build ios --no-codesign | |
# Step 9: Install and Launch the App | |
- name: Install and Launch App | |
run: | | |
xcrun simctl install booted build/ios/iphonesimulator/Runner.app | |
xcrun simctl launch booted com.corbado.passkeys.pub | |
# Step 10: Start Appium Server | |
- name: Start Appium Server | |
run: | | |
nohup appium > appium.log 2>&1 & | |
sleep 10 | |
# Step 11: Run Tests | |
- name: Run Appium Tests | |
run: | | |
cd tests | |
npm i | |
node main.js ios | |
# Step 12: Print Appium Logs (if tests fail) | |
- name: Print Appium Logs | |
if: failure() | |
run: | | |
echo "Printing Appium logs..." | |
cat appium.log |