| #
aa3bb5e3 |
| 21-Jun-2022 |
Bartłomiej Klocek <[email protected]> |
[ios][tools][ci] Redesign iOS unit tests (#17634)
# Why
iOS Unit Test CI job had several issues:
- Fastlane is being run for each package separately, so it's restarting the simulator each time.
[ios][tools][ci] Redesign iOS unit tests (#17634)
# Why
iOS Unit Test CI job had several issues:
- Fastlane is being run for each package separately, so it's restarting the simulator each time. This makes the job slower and moreover, test results are scattered across all fastlane logs.
- Some tests are being run on bare-expo, others on the client project.
- Packages to be tested need to be defined manually in podfile
- Some dev-client tests aren't being run at all (bug in expotools)
# How
Basically, running tests once from a single xcscheme is faster and clearer than doing it separately for each package.
- Applied some autolinking + fastlane changes from #16993 and https://github.com/expo/expo/commit/0e0c1e3db71535002e56453ff6004b06e2836c8e - now we have `use_expo_modules_tests!` for autolinking only test packages.
- Created (`expo init -t bare`) a new `apps/native-tests` app which has no JS code, but only native iOS project with a single test-only scheme (`NativeTests.xcscheme`)
> It might be possible to integrate it as a separate test target in bare-expo instead of creating a new app
- Created a custom fastlane action `generate_test_scheme`, which takes that NativeTests scheme as a template and automatically finds test targets (named `PodspecName-Unit-Tests`, generated by CocoaPods during `pod install`) and generates a `NativeTests_generated` scheme aggregating all these targets. Package filtering is also supported.
- Created a new ios lane `:unit_tests` which uses that action to generate the scheme and then run tests, adopted the `et ios-native-unit-tests` command to use this lane.
- Fixed expotools not recognizing the `expo-dev-launcher` podspec, because it was in the package root instead of the `ios/` subdir.
- Got rid of `React-hermes` test spec dependencies. They're not needed anymore. JS engine for `apps/native-tests` is set to JSC.
- Added `FASTLANE_SKIP_UPDATE_CHECK=1` to the CI env to prevent fastlane from spamming.
One drawback of this approach is that we now have to maintain another app, another podfile etc
show more ...
|