ci.yaml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. name: CI
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. branches: [main]
  7. jobs:
  8. preflight:
  9. name: License Header and Formatting Checks
  10. runs-on: ubuntu-latest
  11. container:
  12. image: swiftlang/swift:nightly-6.0-jammy
  13. steps:
  14. - name: "Checkout repository"
  15. uses: actions/checkout@v4
  16. - name: Mark the workspace as safe
  17. run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
  18. - name: "Install protoc"
  19. run: apt update && apt install -y protobuf-compiler
  20. - name: "Formatting, License Headers, and Generated Code check"
  21. run: |
  22. ./scripts/sanity.sh
  23. unit-tests:
  24. strategy:
  25. fail-fast: false
  26. matrix:
  27. include:
  28. - image: swiftlang/swift:nightly-jammy
  29. # No TSAN because of: https://github.com/apple/swift/issues/59068
  30. # swift-test-flags: "--sanitize=thread"
  31. - image: swiftlang/swift:nightly-6.0-jammy
  32. # No TSAN because of: https://github.com/apple/swift/issues/59068
  33. # swift-test-flags: "--sanitize=thread"
  34. - image: swift:5.10.1-noble
  35. # No TSAN because of: https://github.com/apple/swift/issues/59068
  36. # swift-test-flags: "--sanitize=thread"
  37. - image: swift:5.9-jammy
  38. # No TSAN because of: https://github.com/apple/swift/issues/59068
  39. # swift-test-flags: "--sanitize=thread"
  40. - image: swift:5.8-focal
  41. # No TSAN because of: https://github.com/apple/swift/issues/59068
  42. # swift-test-flags: "--sanitize=thread"
  43. name: Build and Test on ${{ matrix.image }}
  44. runs-on: ubuntu-latest
  45. container:
  46. image: ${{ matrix.image }}
  47. steps:
  48. - uses: actions/checkout@v4
  49. - name: 🔧 Build
  50. run: swift build ${{ matrix.swift-build-flags }}
  51. timeout-minutes: 20
  52. - name: 🧪 Test
  53. run: swift test ${{ matrix.swift-test-flags }}
  54. timeout-minutes: 20
  55. performance-tests:
  56. strategy:
  57. fail-fast: false
  58. matrix:
  59. include:
  60. - image: swiftlang/swift:nightly-jammy
  61. swift-version: 'main'
  62. env:
  63. MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_10_requests: 323000
  64. MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_1_request: 161000
  65. MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_10_small_requests: 110000
  66. MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_1_small_request: 65000
  67. MAX_ALLOCS_ALLOWED_embedded_server_unary_1k_rpcs_1_small_request: 61000
  68. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong: 163000
  69. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_client: 170000
  70. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_server: 170000
  71. - image: swiftlang/swift:nightly-6.0-jammy
  72. swift-version: '6.0'
  73. env:
  74. MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_10_requests: 323000
  75. MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_1_request: 161000
  76. MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_10_small_requests: 110000
  77. MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_1_small_request: 65000
  78. MAX_ALLOCS_ALLOWED_embedded_server_unary_1k_rpcs_1_small_request: 61000
  79. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong: 163000
  80. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_client: 170000
  81. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_server: 170000
  82. - image: swift:5.10.1-noble
  83. swift-version: '5.10'
  84. env:
  85. MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_10_requests: 323000
  86. MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_1_request: 161000
  87. MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_10_small_requests: 110000
  88. MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_1_small_request: 65000
  89. MAX_ALLOCS_ALLOWED_embedded_server_unary_1k_rpcs_1_small_request: 61000
  90. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong: 163000
  91. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_client: 170000
  92. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_server: 170000
  93. - image: swift:5.9-jammy
  94. swift-version: 5.9
  95. env:
  96. MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_10_requests: 323000
  97. MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_1_request: 161000
  98. MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_10_small_requests: 110000
  99. MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_1_small_request: 65000
  100. MAX_ALLOCS_ALLOWED_embedded_server_unary_1k_rpcs_1_small_request: 61000
  101. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong: 163000
  102. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_client: 170000
  103. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_server: 170000
  104. - image: swift:5.8-focal
  105. swift-version: 5.8
  106. env:
  107. MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_10_requests: 323000
  108. MAX_ALLOCS_ALLOWED_bidi_1k_rpcs_1_request: 161000
  109. MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_10_small_requests: 110000
  110. MAX_ALLOCS_ALLOWED_embedded_server_bidi_1k_rpcs_1_small_request: 65000
  111. MAX_ALLOCS_ALLOWED_embedded_server_unary_1k_rpcs_1_small_request: 61000
  112. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong: 163000
  113. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_client: 170000
  114. MAX_ALLOCS_ALLOWED_unary_1k_ping_pong_interceptors_server: 170000
  115. name: Performance Tests on ${{ matrix.image }}
  116. runs-on: ubuntu-latest
  117. container:
  118. image: ${{ matrix.image }}
  119. steps:
  120. - uses: actions/checkout@v4
  121. - name: 🧮 Allocation Counting Tests
  122. run: ./Performance/allocations/test-allocation-counts.sh
  123. env: ${{ matrix.env }}
  124. timeout-minutes: 20
  125. - name: Install jemalloc for benchmarking
  126. if: ${{ matrix.swift-version == '6.0' || matrix.swift-version == 'main' }}
  127. run: apt update && apt-get install -y libjemalloc-dev
  128. timeout-minutes: 20
  129. - name: Run Benchmarks
  130. if: ${{ matrix.swift-version == '6.0' || matrix.swift-version == 'main' }}
  131. working-directory: ./Performance/Benchmarks
  132. run: swift package benchmark baseline check --no-progress --check-absolute-path Thresholds/${{ matrix.swift-version }}/
  133. timeout-minutes: 20
  134. integration-tests:
  135. strategy:
  136. fail-fast: false
  137. matrix:
  138. include:
  139. - image: swiftlang/swift:nightly-jammy
  140. swift-tools-version: '6.0'
  141. supports-v2: true
  142. - image: swiftlang/swift:nightly-6.0-jammy
  143. swift-tools-version: '6.0'
  144. supports-v2: true
  145. - image: swift:5.10.1-noble
  146. swift-tools-version: '5.10'
  147. supports-v2: false
  148. - image: swift:5.9-jammy
  149. swift-tools-version: '5.9'
  150. supports-v2: false
  151. - image: swift:5.8-focal
  152. swift-tools-version: '5.8'
  153. supports-v2: false
  154. name: Integration Tests on ${{ matrix.image }}
  155. runs-on: ubuntu-latest
  156. container:
  157. image: ${{ matrix.image }}
  158. steps:
  159. - uses: actions/checkout@v4
  160. - name: Install protoc
  161. run: apt update && apt install -y protobuf-compiler
  162. - name: SwiftPM plugin test (v1)
  163. run: ./scripts/run-plugin-tests.sh ${{ matrix.swift-tools-version }} "v1"
  164. - name: SwiftPM plugin test (v2)
  165. if: ${{ matrix.supports-v2 }}
  166. run: ./scripts/run-plugin-tests.sh ${{ matrix.swift-tools-version }} "v2"
  167. - name: Build without NIOSSL
  168. run: swift build
  169. env:
  170. GRPC_NO_NIO_SSL: 1
  171. timeout-minutes: 20
  172. - name: Test without NIOSSL
  173. run: swift test
  174. env:
  175. GRPC_NO_NIO_SSL: 1
  176. timeout-minutes: 20