|
| 1 | +name: Matrix |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + name: |
| 7 | + type: string |
| 8 | + description: "The name of the workflow used for the concurrency group." |
| 9 | + required: true |
| 10 | + matrix_linux_command: |
| 11 | + type: string |
| 12 | + description: "The command of the current Swift version linux matrix job to execute." |
| 13 | + required: true |
| 14 | + matrix_linux_5_9_enabled: |
| 15 | + type: boolean |
| 16 | + description: "Boolean to enable the 5.9 Swift version matrix job. Defaults to true." |
| 17 | + default: true |
| 18 | + matrix_linux_5_9_container_image: |
| 19 | + type: string |
| 20 | + description: "Container image for the 5.9 Swift version matrix job. Defaults to matching Swift Ubuntu image." |
| 21 | + default: "swift:5.9-jammy" |
| 22 | + matrix_linux_5_9_command_override: |
| 23 | + type: string |
| 24 | + description: "The command of the 5.9 Swift version linux matrix job to execute." |
| 25 | + matrix_linux_5_10_enabled: |
| 26 | + type: boolean |
| 27 | + description: "Boolean to enable the 5.10 Swift version matrix job. Defaults to true." |
| 28 | + default: true |
| 29 | + matrix_linux_5_10_container_image: |
| 30 | + type: string |
| 31 | + description: "Container image for the 5.10 Swift version matrix job. Defaults to matching Swift Ubuntu image." |
| 32 | + default: "swift:5.10-jammy" |
| 33 | + matrix_linux_5_10_command_override: |
| 34 | + type: string |
| 35 | + description: "The command of the 5.10 Swift version linux matrix job to execute." |
| 36 | + matrix_linux_6_0_enabled: |
| 37 | + type: boolean |
| 38 | + description: "Boolean to enable the 6.0 Swift version matrix job. Defaults to true." |
| 39 | + default: true |
| 40 | + matrix_linux_6_0_container_image: |
| 41 | + type: string |
| 42 | + description: "Container image for the 6.0 Swift version matrix job. Defaults to matching Swift Ubuntu image." |
| 43 | + default: "swift:6.0-jammy" |
| 44 | + matrix_linux_6_0_command_override: |
| 45 | + type: string |
| 46 | + description: "The command of the 6.0 Swift version linux matrix job to execute." |
| 47 | + matrix_linux_nightly_6_0_enabled: |
| 48 | + type: boolean |
| 49 | + description: "Boolean to enable the nightly 6.0 Swift version matrix job. Defaults to true." |
| 50 | + default: true |
| 51 | + matrix_linux_nightly_6_0_container_image: |
| 52 | + type: string |
| 53 | + description: "Container image for the nightly 6.0 Swift version matrix job. Defaults to matching Swift Ubuntu image." |
| 54 | + default: "swiftlang/swift:nightly-6.0-jammy" |
| 55 | + matrix_linux_nightly_6_0_command_override: |
| 56 | + type: string |
| 57 | + description: "The command of the nightly 6.0 Swift version linux matrix job to execute." |
| 58 | + matrix_linux_nightly_main_enabled: |
| 59 | + type: boolean |
| 60 | + description: "Boolean to enable the nightly main Swift version matrix job. Defaults to true." |
| 61 | + default: true |
| 62 | + matrix_linux_nightly_main_container_image: |
| 63 | + type: string |
| 64 | + description: "Container image for the nightly main Swift version matrix job. Defaults to matching Swift Ubuntu image." |
| 65 | + default: "swiftlang/swift:nightly-main-jammy" |
| 66 | + matrix_linux_nightly_main_command_override: |
| 67 | + type: string |
| 68 | + description: "The command of the nightly main Swift version linux matrix job to execute." |
| 69 | + |
| 70 | +# We are cancelling previously triggered workflow runs |
| 71 | +concurrency: |
| 72 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.name }} |
| 73 | + cancel-in-progress: true |
| 74 | + |
| 75 | +jobs: |
| 76 | + linux: |
| 77 | + name: Linux (${{ matrix.swift.swift_version }}) |
| 78 | + runs-on: ubuntu-latest |
| 79 | + strategy: |
| 80 | + fail-fast: false |
| 81 | + matrix: |
| 82 | + # We are specifying only the major and minor of the docker images to automatically pick up the latest patch release |
| 83 | + swift: |
| 84 | + - image: ${{ inputs.matrix_linux_5_9_container_image }} |
| 85 | + swift_version: "5.9" |
| 86 | + enabled: ${{ inputs.matrix_linux_5_9_enabled }} |
| 87 | + - image: ${{ inputs.matrix_linux_5_10_container_image }} |
| 88 | + swift_version: "5.10" |
| 89 | + enabled: ${{ inputs.matrix_linux_5_10_enabled }} |
| 90 | + - image: ${{ inputs.matrix_linux_6_0_container_image }} |
| 91 | + swift_version: "6.0" |
| 92 | + enabled: ${{ inputs.matrix_linux_6_0_enabled }} |
| 93 | + - image: ${{ inputs.matrix_linux_nightly_6_0_container_image }} |
| 94 | + swift_version: "nightly-6.0" |
| 95 | + enabled: ${{ inputs.matrix_linux_nightly_6_0_enabled }} |
| 96 | + - image: ${{ inputs.matrix_linux_nightly_main_container_image }} |
| 97 | + swift_version: "nightly-main" |
| 98 | + enabled: ${{ inputs.matrix_linux_nightly_main_enabled }} |
| 99 | + container: |
| 100 | + image: ${{ matrix.swift.image }} |
| 101 | + steps: |
| 102 | + - name: Checkout repository |
| 103 | + if: ${{ matrix.swift.enabled }} |
| 104 | + uses: actions/checkout@v4 |
| 105 | + with: |
| 106 | + persist-credentials: false |
| 107 | + submodules: true |
| 108 | + - name: Mark the workspace as safe |
| 109 | + if: ${{ matrix.swift.enabled }} |
| 110 | + # https://github.com/actions/checkout/issues/766 |
| 111 | + run: git config --global --add safe.directory ${GITHUB_WORKSPACE} |
| 112 | + - name: Run matrix job |
| 113 | + if: ${{ matrix.swift.enabled }} |
| 114 | + env: |
| 115 | + SWIFT_VERSION: ${{ matrix.swift.swift_version }} |
| 116 | + COMMAND: ${{ inputs.matrix_linux_command }} |
| 117 | + COMMAND_OVERRIDE_5_9: ${{ inputs.matrix_linux_5_9_command_override }} |
| 118 | + COMMAND_OVERRIDE_5_10: ${{ inputs.matrix_linux_5_10_command_override }} |
| 119 | + COMMAND_OVERRIDE_6_0: ${{ inputs.matrix_linux_6_0_command_override }} |
| 120 | + COMMAND_OVERRIDE_NIGHTLY_6_0: ${{ inputs.matrix_linux_nightly_6_0_command_override }} |
| 121 | + COMMAND_OVERRIDE_NIGHTLY_MAIN: ${{ inputs.matrix_linux_nightly_main_command_override }} |
| 122 | + run: | |
| 123 | + apt-get -qq update && apt-get -qq -y install curl && apt-get -y install libsasl2-dev |
| 124 | + curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.sh | bash |
| 125 | + services: |
| 126 | + zookeeper: |
| 127 | + image: ubuntu/zookeeper |
| 128 | + kafka: |
| 129 | + image: ubuntu/kafka |
| 130 | + env: |
| 131 | + ZOOKEEPER_HOST: zookeeper |
| 132 | + env: |
| 133 | + KAFKA_HOST: kafka |
0 commit comments