Do this #13
Workflow file for this run
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: Swift | |
| on: | |
| push | |
| jobs: | |
| macos-build: | |
| runs-on: mobile | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build | |
| run: swift package clean; swift build | |
| - name: Run tests | |
| run: swift test | |
| ios-build: | |
| runs-on: mobile | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run tests | |
| run: set -o pipefail && xcodebuild test -scheme LemonKit -destination 'platform=iOS Simulator,name=iPhone 16,OS=latest' | xcbeautify --renderer github-actions | |
| android-build: | |
| runs-on: mobile | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: List Available AVDs | |
| run: | | |
| echo "Listing available AVDs..." | |
| ~/Library/Android/sdk/emulator/emulator -list-avds | |
| - name: Launch Emulator | |
| id: launch_emulator | |
| run: | | |
| echo "Launching the first available emulator..." | |
| AVD_NAME=$(~/Library/Android/sdk/emulator/emulator -list-avds | head -n 1) | |
| if [ -z "$AVD_NAME" ]; then | |
| echo "No AVDs found. Exiting." | |
| exit 1 | |
| fi | |
| echo "Launching $AVD_NAME" | |
| nohup ~/Library/Android/sdk/emulator/emulator -avd "$AVD_NAME" -no-snapshot-load -no-audio -no-window & | |
| - name: Wait for Emulator to Boot | |
| run: | | |
| echo "Waiting for emulator to boot..." | |
| boot_completed=false | |
| for i in {1..30}; do | |
| if adb shell getprop sys.boot_completed | grep -q "1"; then | |
| echo "Emulator booted!" | |
| boot_completed=true | |
| break | |
| fi | |
| echo "Still waiting for emulator to boot..." | |
| sleep 10 | |
| done | |
| if [ "$boot_completed" = false ]; then | |
| echo "Emulator did not boot in time. Exiting." | |
| exit 1 | |
| fi | |
| - name: Run tests on Android | |
| run: skip android test |