Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
83 changes: 83 additions & 0 deletions .github/workflows/android-emulator-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Android Emulator Demo

permissions:
contents: read

on:
workflow_dispatch:
inputs:
tag:
description: 'The tag name of @midscene/android'
required: true
default: 'beta'
branch:
description: 'The branch to checkout'
required: false
default: 'main'
pull_request:
branches:
- main
paths:
- 'android/vitest-demo/**'
- '.github/workflows/android-emulator-demo.yaml'
push:
branches:
- main
paths:
- 'android/vitest-demo/**'
- '.github/workflows/android-emulator-demo.yaml'

env:
TAG: ${{ github.event.inputs.tag || 'beta' }}

jobs:
android-emulator-demo:
runs-on: ubuntu-22.04
timeout-minutes: 45
env:
CI: '1'
MIDSCENE_MODEL_API_KEY: ${{ secrets.MIDSCENE_MODEL_API_KEY }}
MIDSCENE_MODEL_BASE_URL: ${{ vars.MIDSCENE_MODEL_BASE_URL }}
MIDSCENE_MODEL_NAME: ${{ vars.MIDSCENE_MODEL_NAME }}
MIDSCENE_MODEL_FAMILY: ${{ vars.MIDSCENE_MODEL_FAMILY }}
MIDSCENE_REPORT_QUIET: 'true'

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}

- name: Enable KVM access
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: Run Android TodoMVC demo
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: 35
target: google_apis
arch: x86_64
profile: pixel_6
cores: 2
ram-size: 4096M
emulator-boot-timeout: 600
disable-animations: true
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot-save -noaudio -no-boot-anim -camera-back none
script: |
cd android/vitest-demo
npm i pnpm -g
pnpm i @midscene/android@${{ env.TAG }} --save-dev
pnpm install --no-frozen-lockfile
pnpm run test -- tests/todo.test.ts

- name: Upload Midscene report
if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: warn
name: android-emulator-demo-report
path: android/vitest-demo/midscene_run/report
117 changes: 117 additions & 0 deletions .github/workflows/ios-simulator-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: iOS Simulator Demo

permissions:
contents: read

on:
workflow_dispatch:
inputs:
tag:
description: 'The tag name of @midscene/ios'
required: true
default: 'beta'
branch:
description: 'The branch to checkout'
required: false
default: 'main'
pull_request:
branches:
- main
paths:
- 'ios/vitest-demo/**'
- '.github/workflows/ios-simulator-demo.yaml'
push:
branches:
- main
paths:
- 'ios/vitest-demo/**'
- '.github/workflows/ios-simulator-demo.yaml'

env:
TAG: ${{ github.event.inputs.tag || 'beta' }}
WDA_PORT: '8100'

jobs:
ios-simulator-demo:
runs-on: macos-15
timeout-minutes: 50
env:
CI: '1'
MIDSCENE_MODEL_API_KEY: ${{ secrets.MIDSCENE_MODEL_API_KEY }}
MIDSCENE_MODEL_BASE_URL: ${{ vars.MIDSCENE_MODEL_BASE_URL }}
MIDSCENE_MODEL_NAME: ${{ vars.MIDSCENE_MODEL_NAME }}
MIDSCENE_MODEL_FAMILY: ${{ vars.MIDSCENE_MODEL_FAMILY }}
MIDSCENE_REPORT_QUIET: 'true'

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}

- name: Checkout WebDriverAgent
uses: actions/checkout@v4
with:
repository: appium/WebDriverAgent
ref: 5f8280e761dc0b5b9b28368e63a8f0cc8d868346
path: .ci/WebDriverAgent
persist-credentials: false

- name: Start iPhone simulator and WebDriverAgent
shell: bash
run: |
set -euo pipefail
udid=$(xcrun simctl list devices available |
awk -F'[()]' '/iPhone/ { print $2; exit }')

if [[ -z "$udid" ]]; then
echo "Unable to find an available iPhone simulator." >&2
xcrun simctl list runtimes
xcrun simctl list devices available
exit 1
fi

xcrun simctl boot "$udid" || true
xcrun simctl bootstatus "$udid" -b
xcrun simctl openurl "$udid" https://todomvc.com/examples/react/dist/

xcodebuild \
-project .ci/WebDriverAgent/WebDriverAgent.xcodeproj \
-scheme WebDriverAgentRunner \
-destination "id=$udid" \
USE_PORT="$WDA_PORT" \
test > "$RUNNER_TEMP/webdriveragent.log" 2>&1 &

for _ in {1..90}; do
if curl -fsS "http://127.0.0.1:$WDA_PORT/status" >/dev/null; then
exit 0
fi
sleep 2
done

cat "$RUNNER_TEMP/webdriveragent.log"
exit 1

- name: Run iOS TodoMVC demo
working-directory: ios/vitest-demo
run: |
npm i pnpm -g
pnpm i @midscene/ios@${{ env.TAG }} --save-dev
pnpm install --no-frozen-lockfile
pnpm run test -- todo.test.ts

- name: Upload Midscene report
if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: warn
name: ios-simulator-demo-report
path: ios/vitest-demo/midscene_run/report

- name: Upload WebDriverAgent log
if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: warn
name: ios-simulator-demo-webdriveragent-log
path: ${{ runner.temp }}/webdriveragent.log
71 changes: 71 additions & 0 deletions .github/workflows/macos-computer-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: macOS Computer Demo

permissions:
contents: read

on:
workflow_dispatch:
inputs:
tag:
description: 'The tag name of @midscene/computer'
required: true
default: 'beta'
branch:
description: 'The branch to checkout'
required: false
default: 'main'
pull_request:
branches:
- main
paths:
- 'computer/vitest-demo/**'
- '.github/workflows/macos-computer-demo.yaml'
push:
branches:
- main
paths:
- 'computer/vitest-demo/**'
- '.github/workflows/macos-computer-demo.yaml'

env:
TAG: ${{ github.event.inputs.tag || 'beta' }}

jobs:
macos-computer-demo:
runs-on: macos-15-intel
timeout-minutes: 35
env:
CI: '1'
MIDSCENE_MODEL_API_KEY: ${{ secrets.MIDSCENE_MODEL_API_KEY }}
MIDSCENE_MODEL_BASE_URL: ${{ vars.MIDSCENE_MODEL_BASE_URL }}
MIDSCENE_MODEL_NAME: ${{ vars.MIDSCENE_MODEL_NAME }}
MIDSCENE_MODEL_FAMILY: ${{ vars.MIDSCENE_MODEL_FAMILY }}
MIDSCENE_REPORT_QUIET: 'true'

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}

- name: Inspect desktop permissions
shell: bash
run: |
sw_vers
osascript -e 'tell application "System Events" to return UI elements enabled'

- name: Run TodoMVC desktop demo
working-directory: computer/vitest-demo
run: |
npm i pnpm -g
pnpm i @midscene/computer@${{ env.TAG }} --save-dev
pnpm install --no-frozen-lockfile
pnpm run test

- name: Upload Midscene report
if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: warn
name: macos-computer-demo-report
path: computer/vitest-demo/midscene_run/report
66 changes: 66 additions & 0 deletions .github/workflows/windows-computer-demo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Windows Computer Demo

permissions:
contents: read

on:
workflow_dispatch:
inputs:
tag:
description: 'The tag name of @midscene/computer'
required: true
default: 'beta'
branch:
description: 'The branch to checkout'
required: false
default: 'main'
pull_request:
branches:
- main
paths:
- 'computer/vitest-demo/**'
- '.github/workflows/windows-computer-demo.yaml'
push:
branches:
- main
paths:
- 'computer/vitest-demo/**'
- '.github/workflows/windows-computer-demo.yaml'

env:
TAG: ${{ github.event.inputs.tag || 'beta' }}

jobs:
windows-computer-demo:
runs-on: windows-2022
timeout-minutes: 35
env:
CI: '1'
MIDSCENE_MODEL_API_KEY: ${{ secrets.MIDSCENE_MODEL_API_KEY }}
MIDSCENE_MODEL_BASE_URL: ${{ vars.MIDSCENE_MODEL_BASE_URL }}
MIDSCENE_MODEL_NAME: ${{ vars.MIDSCENE_MODEL_NAME }}
MIDSCENE_MODEL_FAMILY: ${{ vars.MIDSCENE_MODEL_FAMILY }}
MIDSCENE_REPORT_QUIET: 'true'

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || github.ref }}

- name: Run TodoMVC desktop demo
shell: pwsh
working-directory: computer/vitest-demo
run: |
npm i pnpm -g
pnpm i @midscene/computer@${{ env.TAG }} --save-dev
pnpm install --no-frozen-lockfile
pnpm run test

- name: Upload Midscene report
if: always()
uses: actions/upload-artifact@v4
with:
if-no-files-found: warn
name: windows-computer-demo-report
path: computer/vitest-demo/midscene_run/report