unit-tests.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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-13
  13. steps:
  14. - uses: maxim-lobanov/setup-xcode@v1
  15. with:
  16. xcode-version: ^14.3
  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@v3
  23. with:
  24. token: ${{ secrets.CODECOV_TOKEN }}
  25. files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}
  26. xcode:
  27. runs-on: macos-13
  28. strategy:
  29. matrix:
  30. scheme: [ Swift Tests ]
  31. platform:
  32. - macOS
  33. - iOS
  34. - iPadOS
  35. - tvOS
  36. skip-testing: ['']
  37. include:
  38. - scheme: iOS Tests
  39. platform: iOS
  40. skip-testing: 'iOS Tests/DDFileLoggerPerformanceTests'
  41. - scheme: OS X Tests
  42. platform: macOS
  43. skip-testing: 'OS X Tests/DDFileLoggerPerformanceTests'
  44. steps:
  45. - uses: maxim-lobanov/setup-xcode@v1
  46. with:
  47. xcode-version: ^14.3
  48. - name: Determine Xcode destination
  49. id: xcode-destination
  50. env:
  51. PLATFORM: ${{ matrix.platform }}
  52. run: |
  53. DESTINATION=''
  54. case "${PLATFORM}" in
  55. 'macOS') DESTINATION='platform=macOS';;
  56. 'iOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPhone 14 Pro';;
  57. 'iPadOS') DESTINATION='platform=iOS Simulator,OS=latest,name=iPad Pro (11-inch) (4th generation)';;
  58. 'tvOS') DESTINATION='platform=tvOS Simulator,OS=latest,name=Apple TV 4K (3rd generation)';;
  59. 'watchOS') DESTINATION='platform=watchOS Simulator,OS=latest,name=Apple Watch Series 8 (45mm)';;
  60. 'visionOS') DESTINATION='platform=visionOS Simulator,OS=latest,name=Apple Vision Pro';;
  61. *) echo "::error title=Unknown platform!::Unknown platform: ${PLATFORM}" && exit 1;;
  62. esac
  63. echo "destination=${DESTINATION}" >> "${GITHUB_OUTPUT}"
  64. - uses: actions/checkout@v4
  65. - uses: sersoft-gmbh/xcodebuild-action@v3
  66. with:
  67. project: Tests/Tests.xcodeproj
  68. scheme: ${{ matrix.scheme }}
  69. destination: ${{ steps.xcode-destination.outputs.destination }}
  70. skip-testing: ${{ matrix.skip-testing }}
  71. enable-code-coverage: true
  72. parallel-testing-enabled: true
  73. build-settings: GCC_GENERATE_TEST_COVERAGE_FILES=YES
  74. action: test
  75. - uses: sersoft-gmbh/swift-coverage-action@v4
  76. id: coverage-files
  77. - uses: codecov/codecov-action@v3
  78. with:
  79. token: ${{ secrets.CODECOV_TOKEN }}
  80. files: ${{ join(fromJSON(steps.coverage-files.outputs.files), ',') }}