mirror of
https://github.com/apple/swift-nio
synced 2026-11-25 04:47:49 +00:00
### Motivation: The static SDK workflow currently assumes a local setup script which isn't true for external adopters. ### Modifications: * The static SDK workflow now curls for the setup script. * Run Static SDK checks on PR commits ### Result: External adopters should be unblocked.
72 lines
2.7 KiB
YAML
72 lines
2.7 KiB
YAML
name: Matrix
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
name:
|
|
type: string
|
|
description: "The name of the workflow used for the concurrency group."
|
|
required: true
|
|
matrix_string:
|
|
type: string
|
|
description: "The test matrix definition."
|
|
required: true
|
|
|
|
# We will cancel previously triggered workflow runs
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.name }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
execute-matrix:
|
|
name: ${{ matrix.config.platform }} (${{ matrix.config.name }})
|
|
runs-on: ${{ matrix.config.runner }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(inputs.matrix_string) }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
submodules: true
|
|
- name: Pull Docker image
|
|
run: docker pull ${{ matrix.config.image }}
|
|
- name: Run matrix job
|
|
if: ${{ matrix.config.platform != 'Windows' }}
|
|
run: |
|
|
if [[ -n '${{ matrix.config.setup_command }}' ]]; then
|
|
setup_command_expression='${{ matrix.config.setup_command }} &&'
|
|
else
|
|
setup_command_expression=""
|
|
fi
|
|
workspace="/$(basename ${{ github.workspace }})"
|
|
docker run -v ${{ github.workspace }}:"$workspace" \
|
|
-w "$workspace" \
|
|
-e CI="$CI" \
|
|
-e GITHUB_ACTIONS="$GITHUB_ACTIONS" \
|
|
-e SWIFT_VERSION="${{ matrix.config.swift_version }}" \
|
|
-e setup_command_expression="$setup_command_expression" \
|
|
-e workspace="$workspace" \
|
|
${{ matrix.config.image }} \
|
|
bash -c "$setup_command_expression ${{ matrix.config.command }} ${{ matrix.config.command_arguments }}"
|
|
- name: Run matrix job (Windows)
|
|
if: ${{ matrix.config.platform == 'Windows' }}
|
|
run: |
|
|
if (-not [string]::IsNullOrEmpty("${{ matrix.config.setup_command }}")) {
|
|
$setup_command_expression = "${{ matrix.config.setup_command }} &"
|
|
} else {
|
|
$setup_command_expression = ""
|
|
}
|
|
$workspace = "C:\" + (Split-Path ${{ github.workspace }} -Leaf)
|
|
docker run -v ${{ github.workspace }}:$($workspace) `
|
|
-w $($workspace) `
|
|
-e CI=%CI% `
|
|
-e GITHUB_ACTIONS=%GITHUB_ACTIONS% `
|
|
-e SWIFT_VERSION="${{ matrix.config.swift_version }}" `
|
|
-e setup_command_expression=%setup_command_expression% `
|
|
${{ matrix.config.image }} `
|
|
cmd /s /c "swift --version & $($setup_command_expression) ${{ matrix.config.command }} ${{ matrix.config.command_arguments }}"
|
|
env:
|
|
SWIFT_VERSION: ${{ matrix.config.swift_version }}
|