pr-ci-matrix.rb 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/usr/bin/env ruby
  2. # A script to generate the .jenkins.yml file for the CI pull request job
  3. XCODE_VERSIONS = %w(14.1 14.2 14.3.1)
  4. all = ->(v) { true }
  5. latest_only = ->(v) { v == XCODE_VERSIONS.last }
  6. oldest_and_latest = ->(v) { v == XCODE_VERSIONS.first or v == XCODE_VERSIONS.last }
  7. def minimum_version(major)
  8. ->(v) { v.split('.').first.to_i >= major }
  9. end
  10. targets = {
  11. 'docs' => latest_only,
  12. 'swiftlint' => latest_only,
  13. 'osx' => all,
  14. 'osx-encryption' => latest_only,
  15. 'osx-object-server' => oldest_and_latest,
  16. 'swiftpm' => oldest_and_latest,
  17. 'swiftpm-debug' => all,
  18. 'swiftpm-address' => latest_only,
  19. 'swiftpm-thread' => latest_only,
  20. 'ios-xcode-spm' => all,
  21. 'ios-static' => oldest_and_latest,
  22. 'ios' => oldest_and_latest,
  23. 'watchos' => oldest_and_latest,
  24. 'tvos' => oldest_and_latest,
  25. 'osx-swift' => all,
  26. 'ios-swift' => oldest_and_latest,
  27. 'tvos-swift' => oldest_and_latest,
  28. 'osx-swift-evolution' => latest_only,
  29. 'ios-swift-evolution' => latest_only,
  30. 'tvos-swift-evolution' => latest_only,
  31. 'catalyst' => oldest_and_latest,
  32. 'catalyst-swift' => oldest_and_latest,
  33. 'xcframework' => latest_only,
  34. 'cocoapods-osx' => all,
  35. 'cocoapods-ios-static' => latest_only,
  36. 'cocoapods-ios' => latest_only,
  37. 'cocoapods-watchos' => latest_only,
  38. 'cocoapods-tvos' => latest_only,
  39. 'cocoapods-catalyst' => latest_only,
  40. 'swiftui-ios' => latest_only,
  41. 'swiftui-server-osx' => latest_only,
  42. }
  43. output_file = """
  44. # Yaml Axis Plugin
  45. # https://wiki.jenkins-ci.org/display/JENKINS/Yaml+Axis+Plugin
  46. # This is a generated file produced by scripts/pr-ci-matrix.rb.
  47. xcode_version:#{XCODE_VERSIONS.map { |v| "\n - #{v}" }.join()}
  48. target:#{targets.map { |k, v| "\n - #{k}" }.join()}
  49. configuration:
  50. - N/A
  51. exclude:
  52. """
  53. targets.each { |name, filter|
  54. XCODE_VERSIONS.each { |version|
  55. if not filter.call(version)
  56. output_file << """
  57. - xcode_version: #{version}
  58. target: #{name}
  59. """
  60. end
  61. }
  62. }
  63. File.open('.jenkins.yml', "w") do |file|
  64. file.puts output_file
  65. end