Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export NX_SELF_HOSTED_REMOTE_CACHE_SERVER=https://cache.nickthesick.com
export NX_SELF_HOSTED_REMOTE_CACHE_ACCESS_TOKEN=g8@ucL8em4*Z9TKXDY9OEX@!upf^Nz9
export NX_SELF_HOSTED_REMOTE_CACHE_ACCESS_TOKEN=
118 changes: 118 additions & 0 deletions .github/workflows/emulator-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Emulator tests

# The OS-emulator layer of the device suite (tests/device/): real Chrome and
# real Gboard on an Android emulator, and real iOS Safari on a simulator via
# Appium/XCUITest — driving flows no browser emulation can, including pressing
# the on-screen keyboard's IME action key. Free minutes, no credentials, so it
# runs as normal CI. See tests/device/README.md.
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

concurrency:
group: emulator-tests-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

permissions:
contents: read

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
android-emulator:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: voidzero-dev/setup-vp@313600b80b104eadebb9111787d37a2e83e014ca # v1.17.0
with:
node-version-file: ".node-version"
cache: true

- name: Install dependencies
run: vp install

- name: Enable KVM group perms
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: Start playground dev server
run: |
vp run dev &
for _ in $(seq 1 120); do
if curl -sf http://127.0.0.1:5173/ > /dev/null; then exit 0; fi
sleep 2
done
echo "playground dev server never came up" >&2
exit 1

- name: Run device suite on the emulator
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0
with:
api-level: 35
arch: x86_64
target: google_apis
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -no-audio -no-boot-anim
disable-animations: true
script: DEVICE_FILTER=local-android vp run test:device
Comment on lines +59 to +67

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait so this runs on an "actual" android & ios. This is asking for reproducibility issues in the future between CI and local dev. I'm not sure that I like this direction.


- name: Upload screenshots
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: emulator-test-screenshots
path: tests/device/.artifacts/
if-no-files-found: ignore

ios-simulator:
runs-on: macos-15
timeout-minutes: 45
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: voidzero-dev/setup-vp@313600b80b104eadebb9111787d37a2e83e014ca # v1.17.0
with:
node-version-file: ".node-version"
cache: true

- name: Install dependencies
run: vp install

- name: Start playground dev server
run: |
vp run dev &
for _ in $(seq 1 120); do
if curl -sf http://127.0.0.1:5173/ > /dev/null; then exit 0; fi
sleep 2
done
echo "playground dev server never came up" >&2
exit 1

# A cold xcrun on a fresh runner can take long enough to trip the
# suite's availability probe; the first invocation pays the
# initialization cost here, visibly.
- name: Warm the simulator toolchain
run: xcrun simctl list devices available

- name: Run device suite on the simulator
run: DEVICE_FILTER=local-ios vp run test:device

- name: Upload screenshots
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: simulator-test-screenshots
path: tests/device/.artifacts/
if-no-files-found: ignore
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"prestart": "vp run build",
"start": "vp run --filter @blocknote/example-editor preview",
"test": "vp run --filter \"@blocknote/*\" --filter \"docs\" test",
"test:device": "vp -C tests exec vitest run --config device/vitest.config.mts",
"format": "vp fmt",
"prepare": "vp config"
},
Expand Down
Loading
Loading