test_catalyst.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/usr/bin/env bash
  2. # Copyright 2020 Google LLC
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # USAGE: test_catalyst.sh pod build_mode [scheme]
  16. #
  17. # Builds and run tests for Catalyst since it's not yet supported by
  18. # `pod lib lint`.
  19. # The second argument should be "build" or "test". "test" indicates both build
  20. # and test.
  21. # TODO - Determine why test specs that include `requires_app_host` fail to
  22. # launch tests. Locally, they will pass if the only Objective-C unit test scheme
  23. # is specified. However, on GHA, they fail to launch both from the test scheme
  24. # and the app scheme.
  25. set -xeuo pipefail
  26. pod="$1"
  27. build_mode="$2"
  28. if [[ $# -gt 2 ]]; then
  29. scheme="$3"
  30. else
  31. scheme="$pod"
  32. fi
  33. bundle exec pod gen --local-sources=./ --sources=https://github.com/firebase/SpecsDev.git,https://github.com/firebase/SpecsStaging.git,https://cdn.cocoapods.org/ \
  34. "$pod".podspec --platforms=ios
  35. args=(
  36. # Build or test.
  37. "$build_mode"
  38. # Tests that require NSAssert's to fire need Debug.
  39. "-configuration" "Debug"
  40. # The generated workspace.
  41. "-workspace" "gen/$pod/$pod.xcworkspace"
  42. # Specify the app if all test should run. Otherwise, specify the test scheme.
  43. "-scheme" "$scheme"
  44. # Specify Catalyst.
  45. "ARCHS=x86_64" "VALID_ARCHS=x86_64" "SUPPORTS_MACCATALYST=YES"
  46. # Run on macOS.
  47. "-sdk" "macosx" "-destination platform=\"OS X\"" "TARGETED_DEVICE_FAMILY=2"
  48. # Disable signing.
  49. "CODE_SIGN_IDENTITY=-" "CODE_SIGNING_REQUIRED=NO" "CODE_SIGNING_ALLOWED=NO"
  50. # GHA is still running 10.15.
  51. "MACOSX_DEPLOYMENT_TARGET=10.15"
  52. )
  53. source scripts/buildcache.sh
  54. args=("${args[@]}" "${buildcache_xcb_flags[@]}")
  55. xcodebuild -version
  56. gem install xcpretty
  57. xcodebuild "${args[@]}" | xcpretty