Skip to content
Merged
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
33 changes: 15 additions & 18 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: iOS Build and Test
permissions:
contents: read
pull-requests: write
checks: write

on:
push:
Expand All @@ -19,38 +20,32 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: List available Xcode versions
run: ls /Applications | grep Xcode

- name: Set Xcode version
run: sudo xcode-select -s /Applications/Xcode_26.0.1.app

- name: Show Xcode version
run: xcodebuild -version
- name: Use the exact SPM lockfile
run: |
# Ensure we use the committed lockfile, do not re-resolve
xcodebuild -resolvePackageDependencies \
-project SnapSafe.xcodeproj \
-scheme SnapSafe

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '3.4'

- name: Install dependencies
- name: Install ruby dependencies for fastlane
run: bundle install

- name: List available schemes
run: xcodebuild -list -project SnapSafe.xcodeproj
- name: Disable macro validation
run: |
defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES

- name: Run tests with fastlane (non-parallel)
- name: Run tests
run: |
set -o pipefail
RESULTDIR="$RUNNER_TEMP/xcresult/$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT-$(date +%s)"
mkdir -p "$RESULTDIR"
bundle exec fastlane scan \
scheme:"SnapSafe" \
result_bundle:true \
disable_concurrent_testing:true \
output_directory:"$RESULTDIR" \
open_report:false
bundle exec fastlane test

- name: Upload test results
if: always()
Expand All @@ -59,8 +54,10 @@ jobs:
name: test-results
path: |
fastlane/test_output/
# 'fastlane scan' creates these
fastlane/test_output/*.junit
fastlane/test_output/*.html
# xcodebuild creates this
fastlane/test_output/*.xcresult
retention-days: 30

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ jobs:
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PROVISION_PATH ~/Library/MobileDevice/Provisioning\ Profiles/

- name: Run tests
run: |
bundle exec fastlane test

- name: Build release IPA
run: bundle exec fastlane build_release

Expand Down
4 changes: 1 addition & 3 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ platform :ios do
lane :test do
run_tests(
scheme: "SnapSafe",
devices: ["iPhone 17", "iPad Pro 11-inch (M4)"],
devices: ["iPhone 17"],
only_testing: ["SnapSafeTests"]
)
end
Expand All @@ -40,10 +40,8 @@ platform :ios do
# Test against latest and latest minus 1
ios_versions = ['18.5', '26.0']

# Test on both iPhone and iPad
device_types = [
{ name: 'iPhone 17', type: 'iPhone' },
{ name: 'iPad Pro 11-inch (M4)', type: 'iPad' }
]

ios_versions.each do |version|
Expand Down
14 changes: 13 additions & 1 deletion fastlane/Scanfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

scheme("SnapSafe")
project "SnapSafe.xcodeproj"
devices(["iPhone 17", "iPad Pro 11-inch (M4)"])
devices(["iPhone 17"])

# Generate xcresult bundle which can be opened in Xcode for detailed results
result_bundle(true)
Expand All @@ -22,3 +22,15 @@ output_directory("./fastlane/test_output")

# Enable skip_build to skip debug builds for faster test performance
skip_build(false)

# Skip macro validation in CI environments
# This is needed for Swift macro packages like Mockable
xcargs("-skipMacroValidation")

# Simulator reliability settings
reset_simulator(true) # Reset simulator before running tests
disable_slide_to_type(false) # Don't disable slide to type (can cause issues)
prelaunch_simulator(true) # Boot simulator before running tests

# Only run unit tests, not UI tests (UI tests can be run separately with snapshot)
only_testing(["SnapSafeTests"])