config.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. version: 2.1
  2. #
  3. # Variables
  4. #
  5. project_directory: &project_directory ~/project
  6. update_carthage: &update_carthage
  7. name: Homebrew + Carthage Setup
  8. command: |
  9. if ! [ -x "$(command -v brew)" ]; then
  10. # Install Homebrew
  11. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  12. fi
  13. if brew ls carthage > /dev/null; then
  14. brew upgrade carthage || echo "Continuing…"
  15. else
  16. brew install carthage
  17. fi
  18. carthage_bootstrap: &carthage_bootstrap
  19. name: Carthage Bootstrap
  20. command: |
  21. echo "Bootstrapping carthage dependencies"
  22. unset LLVM_TARGET_TRIPLE_SUFFIX
  23. if ! cmp -s Cartfile.Resolved Carthage/Cartfile.resolved; then
  24. time ./Scripts/carthage.sh bootstrap --project-directory "$SRCROOT" --platform ios,watchos --cache-builds --verbose
  25. cp Cartfile.resolved Carthage
  26. else
  27. echo "Carthage: not bootstrapping"
  28. fi
  29. carthage_save_cache: &carthage_save_cache
  30. name: Save Carthage Cache
  31. key: carthage-v1-{{ .Branch }}-{{ checksum "Cartfile.resolved" }}
  32. paths:
  33. - Carthage
  34. carthage_restore_cache: &carthage_restore_cache
  35. name: Restore Carthage Cache
  36. keys:
  37. - carthage-v1-{{ .Branch }}-{{ checksum "Cartfile.resolved" }}
  38. #
  39. # Jobs
  40. #
  41. jobs:
  42. test:
  43. working_directory: *project_directory
  44. macos:
  45. xcode: 12.2.0
  46. steps:
  47. - checkout
  48. - restore_cache: *carthage_restore_cache
  49. - run: *update_carthage
  50. - run: *carthage_bootstrap
  51. - run:
  52. name: Test
  53. command: |
  54. set -o pipefail && xcodebuild -project LoopKit.xcodeproj -scheme Shared build -destination 'name=iPhone 8' test | xcpretty
  55. - save_cache: *carthage_save_cache
  56. - store_test_results:
  57. path: test_output
  58. build-example:
  59. working_directory: *project_directory
  60. macos:
  61. xcode: 12.2.0
  62. steps:
  63. - checkout
  64. - restore_cache: *carthage_restore_cache
  65. - run: *update_carthage
  66. - run: *carthage_bootstrap
  67. - run:
  68. name: Build Example
  69. command: |
  70. set -o pipefail && xcodebuild -project LoopKit.xcodeproj -scheme "LoopKit Example" build -destination 'name=iPhone 8' CODE_SIGNING_ALLOWED=NO | xcpretty
  71. - save_cache: *carthage_save_cache
  72. #
  73. # Workflows
  74. #
  75. workflows:
  76. version: 2.1
  77. build_and_test:
  78. jobs:
  79. - test
  80. - build-example