unit-tests.yml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: Unit Tests
  2. on:
  3. push:
  4. branches: [master]
  5. pull_request:
  6. branches: [master]
  7. env:
  8. LC_CTYPE: en_US.UTF-8
  9. LANG: en_US.UTF-8
  10. jobs:
  11. swiftpm:
  12. runs-on: macos-15
  13. steps:
  14. - uses: maxim-lobanov/setup-xcode@v1
  15. with:
  16. xcode-version: ^16.4
  17. - uses: actions/checkout@v5
  18. - name: Run SwiftPM Tests
  19. run: swift test --enable-code-coverage --parallel
  20. - uses: sersoft-gmbh/swift-coverage-action@v4
  21. id: coverage-files
  22. - uses: codecov/codecov-action@v5
  23. with:
  24. token: ${{ secrets.CODECOV_TOKEN }}
  25. files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}
  26. xcode:
  27. runs-on: macos-15
  28. strategy:
  29. matrix:
  30. scheme: [Swift Tests]
  31. platform:
  32. - macOS
  33. - iOS
  34. - iPadOS
  35. - tvOS
  36. - visionOS
  37. skip-testing: [""]
  38. include:
  39. - scheme: iOS Tests
  40. platform: iOS
  41. skip-testing: "iOS Tests/DDFileLoggerPerformanceTests"
  42. - scheme: OS X Tests
  43. platform: macOS
  44. skip-testing: "OS X Tests/DDFileLoggerPerformanceTests"
  45. steps:
  46. - uses: maxim-lobanov/setup-xcode@v1
  47. with:
  48. xcode-version: ^16.4
  49. - name: Determine Xcode destination
  50. id: xcode-destination
  51. env:
  52. PLATFORM: ${{ matrix.platform }}
  53. run: |
  54. DESTINATION=''
  55. case "${PLATFORM}" in
  56. 'macOS') DESTINATION='platform=macOS';;
  57. 'iOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPhone 16 Pro';;
  58. 'iPadOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPad Pro 11-inch (M4)';;
  59. 'tvOS') DESTINATION='platform=tvOS Simulator,OS=latest,name=Apple TV 4K (3rd generation)';;
  60. 'watchOS') DESTINATION='platform=watchOS Simulator,OS=latest,name=Apple Watch Series 10 (46mm)';;
  61. 'visionOS') DESTINATION='platform=visionOS Simulator,OS=latest,name=Apple Vision Pro';;
  62. *) echo "::error title=Unknown platform!::Unknown platform: ${PLATFORM}" && exit 1;;
  63. esac
  64. echo "destination=${DESTINATION}" >> "${GITHUB_OUTPUT}"
  65. - name: Install Platform
  66. if: ${{ matrix.platform != 'macOS' }}
  67. env:
  68. PLATFORM: ${{ matrix.platform }}
  69. run: |
  70. if [ "${PLATFORM}" = 'iPadOS' ]; then
  71. PLATFORM='iOS'
  72. fi
  73. xcrun simctl delete unavailable # Remove unavailable sims - also boots the simulator
  74. xcodebuild -downloadPlatform "${PLATFORM}"
  75. - uses: actions/checkout@v5
  76. - uses: sersoft-gmbh/xcodebuild-action@v3
  77. with:
  78. project: Tests/Tests.xcodeproj
  79. scheme: ${{ matrix.scheme }}
  80. destination: ${{ steps.xcode-destination.outputs.destination }}
  81. skip-testing: ${{ matrix.skip-testing }}
  82. enable-code-coverage: true
  83. parallel-testing-enabled: true
  84. build-settings: GCC_GENERATE_TEST_COVERAGE_FILES=YES
  85. action: test
  86. - uses: sersoft-gmbh/swift-coverage-action@v4
  87. id: coverage-files
  88. - uses: codecov/codecov-action@v5
  89. with:
  90. token: ${{ secrets.CODECOV_TOKEN }}
  91. files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}