unit-tests.yml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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@v4
  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: Download visionOS
  66. if: ${{ matrix.platform == 'visionOS' }}
  67. run: |
  68. sudo xcodebuild -runFirstLaunch
  69. sudo xcrun simctl list # needed to boot the simulator
  70. sudo xcodebuild -downloadPlatform visionOS
  71. sudo xcodebuild -runFirstLaunch
  72. - uses: actions/checkout@v4
  73. - uses: sersoft-gmbh/xcodebuild-action@v3
  74. with:
  75. project: Tests/Tests.xcodeproj
  76. scheme: ${{ matrix.scheme }}
  77. destination: ${{ steps.xcode-destination.outputs.destination }}
  78. skip-testing: ${{ matrix.skip-testing }}
  79. enable-code-coverage: true
  80. parallel-testing-enabled: true
  81. build-settings: GCC_GENERATE_TEST_COVERAGE_FILES=YES
  82. action: test
  83. - uses: sersoft-gmbh/swift-coverage-action@v4
  84. id: coverage-files
  85. - uses: codecov/codecov-action@v5
  86. with:
  87. token: ${{ secrets.CODECOV_TOKEN }}
  88. files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}