Skip to content

Commit

Permalink
Include iOS tests (close #49)
Browse files Browse the repository at this point in the history
  • Loading branch information
amodm committed Sep 9, 2022
1 parent 3ee22d3 commit f6e0273
Show file tree
Hide file tree
Showing 16 changed files with 1,015 additions and 2 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ios.yaml
@@ -0,0 +1,58 @@
name: iOS

on:
push:
branches-ignore: [ '**win**', '**android**', '**linux**', '**bsd**', '**haiku**', '**wasm**', '**macos**' ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1

jobs:
build:
name: Build
runs-on: macos-latest
strategy:
matrix:
rust: [stable]
continue-on-error: ${{ matrix.rust != 'stable' }}
steps:
- uses: actions/checkout@v2
name: Checkout
- uses: actions-rs/toolchain@v1
name: Install Rust Toolchain
with:
profile: minimal
toolchain: ${{ matrix.rust }}
target: x86_64-apple-ios
override: true
components: rustfmt, clippy
- name: Configure and start iOS Simulator
run: |
set -e
open -a Simulator
sleep 5
IOSRUNTIME=$(xcrun simctl list 2>&1 | egrep '^iOS' | head -n 1 | awk '{ print $NF }')
IOSDEV=$(xcrun simctl list 2>&1 | grep com.apple.CoreSimulator.SimDeviceType.iPhone | grep -v ' SE ' | tail -n 1 | tr -d '()' | awk '{ print $NF }')
DEVID=$(xcrun simctl create iphone-latest $IOSDEV $IOSRUNTIME)
echo "==== using device $IOSDEV, $IOSRUNTIME ===="
xcrun simctl boot $DEVID
sleep 5
xcrun simctl list 2>&1
- name: Run Tests
env:
WEBBROWSER_DEBUG_TESTS: "true"
WEBBROWSER_FORCE_NO_SUPPRESS: "true"
run: cargo test --verbose --test test_ios -- --include-ignored
- uses: actions-rs/cargo@v1
name: Check Code Formatting
with:
command: fmt
args: --all -- --check
- uses: actions-rs/cargo@v1
name: Lints
with:
command: clippy
args: --all-targets -- -D warnings
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -7,6 +7,7 @@
![Linux Build](https://github.com/amodm/webbrowser-rs/workflows/Linux/badge.svg?branch=main&x=1)
![Windows Build](https://github.com/amodm/webbrowser-rs/workflows/Windows/badge.svg?branch=main&x=1)
![MacOS Build](https://github.com/amodm/webbrowser-rs/workflows/MacOS/badge.svg?branch=main&x=1)
![iOS Build](https://github.com/amodm/webbrowser-rs/workflows/iOS/badge.svg?branch=main&x=1)
![Android Build](https://github.com/amodm/webbrowser-rs/workflows/Android/badge.svg?branch=main&x=1)
![WASM Build](https://github.com/amodm/webbrowser-rs/workflows/WASM/badge.svg?branch=main&x=1)

Expand Down Expand Up @@ -39,7 +40,7 @@ if webbrowser::open("http://github.com").is_ok() {
| android || default only ||
| wasm || default only ||
| haiku | ✅ (experimental) | default only ||
| ios | | default only | |
| ios | | default only | |

## Consistent Behaviour
`webbrowser` defines consistent behaviour on all platforms as follows:
Expand All @@ -50,7 +51,8 @@ if webbrowser::open("http://github.com").is_ok() {

PRs invited for

* Support for other platforms, e.g. iOS
* Bugs
* Supporting non-default browser invocation on any platform

Important note (while testing):

Expand Down
6 changes: 6 additions & 0 deletions tests/test-ios-app/.gitignore
@@ -0,0 +1,6 @@
build/
testglue/Cargo.lock
testglue/target/
test-ios-app.xcodeproj/xcuserdata/
test-ios-app.xcodeproj/project.xcworkspace/

0 comments on commit f6e0273

Please sign in to comment.