Skip to content

Commit

Permalink
Merge 0a25f24 into eae2b59
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich authored Oct 10, 2024
2 parents eae2b59 + 0a25f24 commit edd1109
Show file tree
Hide file tree
Showing 14 changed files with 679 additions and 11 deletions.
101 changes: 101 additions & 0 deletions .github/workflows/ui-tests-critical.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: UI Tests Critical
on:
push:
branches:
- main

pull_request:
paths:
- 'Sources/**'
- '.github/workflows/ui-tests-critical.yml'
- 'fastlane/**'
- 'TestSamples/**'

# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build-sample:
name: Build SwiftUITestSample Sample
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- run: ./scripts/ci-select-xcode.sh 16
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bundle exec fastlane build_ios_swift_ui_test_sample
- uses: actions/upload-artifact@v4
with:
name: SwiftUITestSample
path: DerivedData/Build/Products/Debug-iphonesimulator/SwiftUITestSample.app

run-tests:
name: Test iOS ${{matrix.os-version}} on ${{matrix.device}} Simulator
needs: [build-sample]
runs-on: ${{matrix.runs-on}}
env:
APP_ARTIFACT_NAME: "SwiftUITestSample"
APP_PATH: "Sample.app"

MAESTRO_FLOWS_PATH: "TestSamples/SwiftUITestSample/Maestro"
MAESTRO_LOGS_PATH: "MaestroLogs"

# https://github.com/facebook/react-native/blob/24e7f7d25629a7af6d877a0b79fed2faaab96437/.github/actions/maestro-ios/action.yml#L57
MAESTRO_DRIVER_STARTUP_TIMEOUT: 1500000 # 25 min, CI can be slow at times
MAX_ATTEMPTS: 3 # Maestro test suits re runs in case of flakyness
strategy:
fail-fast: false
matrix:
include:
- runs-on: macos-12
xcode: "13.4.1"
device: "iPhone 8"
os-version: "15.5"
create-simulator: true
- runs-on: macos-13
xcode: "14.3.1"
device: "iPhone 14"
os-version: "16.4"
create-simulator: true
- runs-on: macos-14
xcode: "15.4"
device: "iPhone 15"
os-version: "17.5"
- runs-on: macos-15
xcode: "16"
device: "iPhone 16"
os-version: "18.0"

steps:
- uses: actions/checkout@v4
- name: Create ${{matrix.device}} (${{matrix.os-version}}) Simulator using Xcode ${{matrix.xcode}}
if: ${{matrix.create-simulator}}
run: ./scripts/create-simulator.sh "${{matrix.xcode}}" "${{matrix.os-version}}" "${{matrix.device}}"
- name: Install Maestro
run: brew tap mobile-dev-inc/tap && brew install mobile-dev-inc/tap/maestro@1.38
- name: Install iDB Companion
run: brew tap facebook/fb && brew install facebook/fb/idb-companion

- uses: actions/download-artifact@v4
with:
name: ${{env.APP_ARTIFACT_NAME}}
path: ${{env.APP_PATH}}
- uses: futureware-tech/simulator-action@bfa03d93ec9de6dacb0c5553bbf8da8afc6c2ee9 # pin@v3
with:
model: ${{matrix.device}}
os_version: ${{matrix.os-version}}
- name: Run Maestro Flows
run: |
xcrun simctl install booted ${{env.APP_PATH}}
maestro test ${{env.MAESTRO_FLOWS_PATH}} --format junit --debug-output ${{env.MAESTRO_LOGS_PATH}}
- name: Store Maestro Logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: maestro-logs-${{matrix.device}}-${{matrix.os-version}}
path: ${{env.MAESTRO_LOGS_PATH}}
10 changes: 5 additions & 5 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ jobs:
path: |
~/Library/Logs/scan/*.log
./fastlane/test_output/**
ios-swift-ui-tests:
name: iOS-Swift UI Tests ${{matrix.device}}
ui-tests-swift:
name: UI Tests for iOS-Swift ${{matrix.device}} Simulator
runs-on: ${{matrix.runs-on}}
strategy:
fail-fast: false
Expand All @@ -105,10 +105,10 @@ jobs:

- name: Create iOS 16.4 simulator
if: ${{ matrix.device == 'iPhone 14 (16.4)' }}
run: ./scripts/create-simulator.sh 14.3.1 16.4 16-4
run: ./scripts/create-simulator.sh 14.3.1 16.4 "iPhone 14"

- name: Run Fastlane
run: fastlane ui_tests_ios_swift device:"${{matrix.device}}"
run: fastlane ui_tests_ios_swift device:"${{matrix.device}}"

- name: Archiving Raw Test Logs
uses: actions/upload-artifact@v4
Expand Down
7 changes: 4 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repos:
fail_fast: true
args:
- "check-versions"

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
Expand All @@ -20,6 +20,7 @@ repos:
- id: check-symlinks
- id: check-xml
- id: check-yaml
args: [--allow-multiple-documents]
- id: detect-private-key
- id: end-of-file-fixer
- id: no-commit-to-branch
Expand All @@ -30,7 +31,7 @@ repos:
- id: check-github-actions
- id: check-github-workflows
args: [--verbose]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
Expand All @@ -45,7 +46,7 @@ repos:
types_or: ["objective-c", "objective-c++", "c", "c++"]
args:
- "format-clang"

- id: format-swift
name: Format Swift
entry: make
Expand Down
7 changes: 7 additions & 0 deletions Sentry.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions TestSamples/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parent_config: ../.swiftlint.yml

disabled_rules:
- force_unwrapping
1 change: 1 addition & 0 deletions TestSamples/SwiftUITestSample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MaestroLogs/
9 changes: 9 additions & 0 deletions TestSamples/SwiftUITestSample/Maestro/corruptEnvelope.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
appId: io.sentry.tests.SwiftUITestSample
---
- launchApp
- tapOn: "Write Corrupted Envelope"
- tapOn: "Close SDK"
- tapOn: "Write Corrupted Envelope"
- stopApp
- launchApp
- assertVisible: "Welcome!"
6 changes: 6 additions & 0 deletions TestSamples/SwiftUITestSample/Maestro/crash.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
appId: io.sentry.tests.SwiftUITestSample
---
- launchApp
- tapOn: "Crash"
- launchApp
- assertVisible: "Welcome!"
Loading

0 comments on commit edd1109

Please sign in to comment.