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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ bazel-*
# Coverage file
coverage.xml

# Xcode test results
*.xcresult

# Fastlane artifacts (anywhere in repo)
**/fastlane/report.xml
**/fastlane/Preview.html
Expand Down
30 changes: 25 additions & 5 deletions Demo/SmartAsyncImageDemo/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,39 @@

default_platform(:ios)

# Shared derived data folder for faster incremental builds
DERIVED_DATA_PATH = File.expand_path("../../../.build/DerivedData", __dir__)

platform :ios do
desc "Build package and demo app"
desc "Build package and demo app (including tests with coverage)"
lane :build do
# Build package tests first with coverage instrumentation
# This way the demo app build can reuse the compiled package
repo_root = File.expand_path("../../..", __dir__)
Dir.chdir(repo_root) do
sh <<~CMD
xcodebuild build-for-testing \
-scheme SmartAsyncImage \
-sdk iphonesimulator \
-destination "generic/platform=iOS Simulator" \
-derivedDataPath #{DERIVED_DATA_PATH} \
-enableCodeCoverage YES
CMD
end

# Build demo app (should reuse compiled package from above)
build_app(
project: "SmartAsyncImageDemo.xcodeproj",
scheme: "SmartAsyncImageDemo",
configuration: "Debug",
skip_package_ipa: true, # important: avoids IPA packaging
destination: "generic/platform=iOS Simulator"
skip_package_ipa: true,
destination: "generic/platform=iOS Simulator",
derived_data_path: DERIVED_DATA_PATH
)
end


desc "Run package unit tests and gather coverage"
desc "Run package unit tests (no recompilation)"
lane :package_tests do
repo_root = File.expand_path("../../..", __dir__)

Expand All @@ -38,10 +57,11 @@ platform :ios do
rm -rf TestResults.xcresult coverage xccov.json coverage.xml
mkdir -p coverage

xcodebuild test \
xcodebuild test-without-building \
-scheme SmartAsyncImage \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=iPhone 17" \
-derivedDataPath #{DERIVED_DATA_PATH} \
-enableCodeCoverage YES \
-resultBundlePath TestResults.xcresult
CMD
Expand Down
4 changes: 2 additions & 2 deletions Demo/SmartAsyncImageDemo/fastlane/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do
[bundle exec] fastlane ios build
```

Build package and demo app
Build package and demo app (including tests with coverage)

### ios package_tests

```sh
[bundle exec] fastlane ios package_tests
```

Run package unit tests and gather coverage
Run package unit tests (no recompilation)

### ios coverage_xml

Expand Down
Loading