Skip to content

Commit

Permalink
Merge branch 'main' into cb-isolated
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasa authored Dec 16, 2024
2 parents d3dc7b9 + 55d0f72 commit eaf85fd
Show file tree
Hide file tree
Showing 138 changed files with 3,765 additions and 1,508 deletions.
34 changes: 24 additions & 10 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,32 @@ on:
default: false

jobs:
construct-matrix:
name: Construct Benchmarks matrix
runs-on: ubuntu-latest
outputs:
benchmarks-matrix: '${{ steps.generate-matrix.outputs.benchmarks-matrix }}'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- id: generate-matrix
run: echo "benchmarks-matrix=$(curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT"
env:
MATRIX_LINUX_COMMAND: "swift package --package-path ${{ inputs.benchmark_package_path }} ${{ inputs.swift_package_arguments }} benchmark baseline check --check-absolute-path ${{ inputs.benchmark_package_path }}/Thresholds/${SWIFT_VERSION}/"
MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q libjemalloc-dev"
MATRIX_LINUX_5_9_ENABLED: ${{ inputs.linux_5_9_enabled }}
MATRIX_LINUX_5_10_ENABLED: ${{ inputs.linux_5_10_enabled }}
MATRIX_LINUX_6_0_ENABLED: ${{ inputs.linux_6_0_enabled }}
MATRIX_LINUX_NIGHTLY_6_0_ENABLED: ${{ inputs.linux_nightly_6_0_enabled }}
MATRIX_LINUX_NIGHTLY_MAIN_ENABLED: ${{ inputs.linux_nightly_main_enabled }}

benchmarks:
name: Benchmarks
needs: construct-matrix
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main
with:
name: "Benchmarks"
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q libjemalloc-dev && swift package --package-path ${{ inputs.benchmark_package_path }} ${{ inputs.swift_package_arguments }} benchmark baseline check --check-absolute-path ${{ inputs.benchmark_package_path }}/Thresholds/${SWIFT_VERSION}/"
matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }}
matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }}
matrix_linux_6_0_enabled: ${{ inputs.linux_6_0_enabled }}
matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }}
matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }}
matrix_windows_6_0_enabled: ${{ inputs.windows_6_0_enabled }}
matrix_windows_nightly_6_0_enabled: ${{ inputs.windows_nightly_6_0_enabled }}
matrix_windows_nightly_main_enabled: ${{ inputs.windows_nightly_main_enabled }}
matrix_string: '${{ needs.construct-matrix.outputs.benchmarks-matrix }}'
40 changes: 27 additions & 13 deletions .github/workflows/cxx_interop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,44 @@ on:

windows_6_0_enabled:
type: boolean
description: "Boolean to enable the Windows 6.0 Swift version matrix job. Defaults to true."
description: "Boolean to enable the Windows 6.0 Swift version matrix job. Defaults to false. Currently has no effect!" # TODO: implement Windows Cxx compat checking
default: false
windows_nightly_6_0_enabled:
type: boolean
description: "Boolean to enable the Windows nightly 6.0 Swift version matrix job. Defaults to true."
description: "Boolean to enable the Windows nightly 6.0 Swift version matrix job. Defaults to false. Currently has no effect!" # TODO: implement Windows Cxx compat checking
default: false
windows_nightly_main_enabled:
type: boolean
description: "Boolean to enable the Windows nightly main Swift version matrix job. Defaults to true."
description: "Boolean to enable the Windows nightly main Swift version matrix job. Defaults to false. Currently has no effect!" # TODO: implement Windows Cxx compat checking
default: false

jobs:
construct-matrix:
name: Construct Cxx interop matrix
runs-on: ubuntu-latest
outputs:
cxx-interop-matrix: '${{ steps.generate-matrix.outputs.cxx-interop-matrix }}'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- id: generate-matrix
run: echo "cxx-interop-matrix=$(curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT"
env:
MATRIX_LINUX_COMMAND: "curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-cxx-interop-compatibility.sh | bash"
MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q curl jq"
MATRIX_LINUX_5_9_ENABLED: ${{ inputs.linux_5_9_enabled }}
MATRIX_LINUX_5_10_ENABLED: ${{ inputs.linux_5_10_enabled }}
MATRIX_LINUX_6_0_ENABLED: ${{ inputs.linux_6_0_enabled }}
MATRIX_LINUX_NIGHTLY_6_0_ENABLED: ${{ inputs.linux_nightly_6_0_enabled }}
MATRIX_LINUX_NIGHTLY_MAIN_ENABLED: ${{ inputs.linux_nightly_main_enabled }}

cxx-interop:
name: Cxx interop
needs: construct-matrix
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main
with:
name: "Cxx interop"
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q jq && curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-cxx-interop-compatibility.sh | bash"
matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }}
matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }}
matrix_linux_6_0_enabled: ${{ inputs.linux_6_0_enabled }}
matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }}
matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }}
matrix_windows_6_0_enabled: ${{ inputs.windows_6_0_enabled }}
matrix_windows_nightly_6_0_enabled: ${{ inputs.windows_nightly_6_0_enabled }}
matrix_windows_nightly_main_enabled: ${{ inputs.windows_nightly_main_enabled }}
matrix_string: '${{ needs.construct-matrix.outputs.cxx-interop-matrix }}'
27 changes: 22 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

cxx-interop:
Expand All @@ -30,10 +30,27 @@ jobs:
with:
benchmark_package_path: "Benchmarks"

construct-integration-test-matrix:
name: Construct integration test matrix
runs-on: ubuntu-latest
outputs:
integration-test-matrix: '${{ steps.generate-matrix.outputs.integration-test-matrix }}'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- id: generate-matrix
run: echo "integration-test-matrix=$(curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT"
env:
MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq"
MATRIX_LINUX_COMMAND: "./scripts/integration_tests.sh"

integration-tests:
name: Integration Tests
name: Integration tests
needs: construct-integration-test-matrix
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main
with:
name: "Integration tests"
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq && ./scripts/integration_tests.sh"
matrix_string: '${{ needs.construct-integration-test-matrix.outputs.integration-test-matrix }}'
45 changes: 40 additions & 5 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
with:
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"

benchmarks:
Expand All @@ -34,10 +34,45 @@ jobs:
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main

construct-integration-test-matrix:
name: Construct integration test matrix
runs-on: ubuntu-latest
outputs:
integration-test-matrix: '${{ steps.generate-matrix.outputs.integration-test-matrix }}'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- id: generate-matrix
run: echo "integration-test-matrix=$(curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT"
env:
MATRIX_LINUX_SETUP_COMMAND: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq"
MATRIX_LINUX_COMMAND: "./scripts/integration_tests.sh"

integration-tests:
name: Integration Tests
name: Integration tests
needs: construct-integration-test-matrix
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main
with:
name: "Integration tests"
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq && ./scripts/integration_tests.sh"
matrix_string: '${{ needs.construct-integration-test-matrix.outputs.integration-test-matrix }}'

vsock-tests:
name: Vsock tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Load vsock_loopback kernel module
run: sudo modprobe vsock_loopback
- name: Build package tests
run: swift build --build-tests
- name: Run Vsock tests
shell: bash # explicitly choose bash, which ensures -o pipefail
run: swift test --filter "(?i)vsock" | tee test.out
- name: Check for skipped tests
run: test -r test.out && ! grep -i skipped test.out
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
semver-label-check:
name: Semantic Version label check
name: Semantic version label check
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/swift_load_test_matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Matrix Load

on:
workflow_call:
inputs:
name:
type: string
description: "The name of the workflow used for the concurrency group."
required: true
matrix_path:
type: string
description: "The path of the test matrix definition."
default: ""

jobs:
load-matrix:
name: Prepare matrices
runs-on: ubuntu-latest
outputs:
swift-matrix: ${{ steps.load-matrix.outputs.swift-matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Mark the workspace as safe
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- id: load-matrix
run: |
printf "swift-matrix=%s" "$(jq -c '.' ${{ inputs.matrix_path }})" >> "$GITHUB_OUTPUT"
execute-matrix:
name: Execute matrix
needs: load-matrix
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main
with:
name: ${{ inputs.name }}
matrix_string: '${{ needs.load-matrix.outputs.swift-matrix }}'
67 changes: 67 additions & 0 deletions .github/workflows/swift_test_matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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 SWIFT_VERSION="${{ matrix.config.swift_version }}" \
-e setup_command_expression="$setup_command_expression" \
-e workspace="$workspace" \
${{ matrix.config.image }} \
bash -c "swift --version && git config --global --add safe.directory \"$workspace\" && $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 SWIFT_VERSION="${{ matrix.config.swift_version }}" `
-e setup_command_expression=%setup_command_expression% `
${{ matrix.config.image }} `
cmd /s /c "swift --version & powershell Invoke-Expression ""$($setup_command_expression) ${{ matrix.config.command }} ${{ matrix.config.command_arguments }}"""
env:
SWIFT_VERSION: ${{ matrix.config.swift_version }}
54 changes: 35 additions & 19 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,43 @@ on:
default: ""

jobs:
construct-matrix:
name: Construct unit test matrix
runs-on: ubuntu-latest
outputs:
unit-test-matrix: '${{ steps.generate-matrix.outputs.unit-test-matrix }}'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- id: generate-matrix
run: echo "unit-test-matrix=$(curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT"
env:
MATRIX_LINUX_COMMAND: "swift test"
MATRIX_LINUX_5_9_ENABLED: ${{ inputs.linux_5_9_enabled }}
MATRIX_LINUX_5_9_COMMAND_ARGUMENTS: ${{ inputs.linux_5_9_arguments_override }}
MATRIX_LINUX_5_10_ENABLED: ${{ inputs.linux_5_10_enabled }}
MATRIX_LINUX_5_10_COMMAND_ARGUMENTS: ${{ inputs.linux_5_10_arguments_override }}
MATRIX_LINUX_6_0_ENABLED: ${{ inputs.linux_6_0_enabled }}
MATRIX_LINUX_6_0_COMMAND_ARGUMENTS: ${{ inputs.linux_6_0_arguments_override }}
MATRIX_LINUX_NIGHTLY_6_0_ENABLED: ${{ inputs.linux_nightly_6_0_enabled }}
MATRIX_LINUX_NIGHTLY_6_0_COMMAND_ARGUMENTS: ${{ inputs.linux_nightly_6_0_arguments_override }}
MATRIX_LINUX_NIGHTLY_MAIN_ENABLED: ${{ inputs.linux_nightly_main_enabled }}
MATRIX_LINUX_NIGHTLY_MAIN_COMMAND_ARGUMENTS: ${{ inputs.linux_nightly_main_arguments_override }}
MATRIX_WINDOWS_COMMAND: "swift test"
MATRIX_WINDOWS_6_0_ENABLED: ${{ inputs.windows_6_0_enabled }}
MATRIX_WINDOWS_6_0_COMMAND_ARGUMENTS: ${{ inputs.windows_6_0_arguments_override }}
MATRIX_WINDOWS_NIGHTLY_6_0_ENABLED: ${{ inputs.windows_nightly_6_0_enabled }}
MATRIX_WINDOWS_NIGHTLY_6_0_COMMAND_ARGUMENTS: ${{ inputs.windows_nightly_6_0_arguments_override }}
MATRIX_WINDOWS_NIGHTLY_MAIN_ENABLED: ${{ inputs.windows_nightly_main_enabled }}
MATRIX_WINDOWS_NIGHTLY_MAIN_COMMAND_ARGUMENTS: ${{ inputs.windows_nightly_main_arguments_override }}

unit-tests:
name: Unit tests
needs: construct-matrix
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
uses: apple/swift-nio/.github/workflows/swift_test_matrix.yml@main
with:
name: "Unit tests"
matrix_linux_command: "swift test"
matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }}
matrix_linux_5_9_command_override: "swift test ${{ inputs.linux_5_9_arguments_override }}"
matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }}
matrix_linux_5_10_command_override: "swift test ${{ inputs.linux_5_10_arguments_override }}"
matrix_linux_6_0_enabled: ${{ inputs.linux_6_0_enabled }}
matrix_linux_6_0_command_override: "swift test ${{ inputs.linux_6_0_arguments_override }}"
matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }}
matrix_linux_nightly_6_0_command_override: "swift test ${{ inputs.linux_nightly_6_0_arguments_override }}"
matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }}
matrix_linux_nightly_main_command_override: "swift test ${{ inputs.linux_nightly_main_arguments_override }}"
matrix_windows_command: "swift test"
matrix_windows_6_0_enabled: ${{ inputs.windows_6_0_enabled }}
matrix_windows_6_0_command_override: "swift test ${{ inputs.windows_6_0_arguments_override }}"
matrix_windows_nightly_6_0_enabled: ${{ inputs.windows_nightly_6_0_enabled }}
matrix_windows_nightly_6_0_command_override: "swift test ${{ inputs.windows_nightly_6_0_arguments_override }}"
matrix_windows_nightly_main_enabled: ${{ inputs.windows_nightly_main_enabled }}
matrix_windows_nightly_main_command_override: "swift test ${{ inputs.windows_nightly_main_arguments_override }}"
matrix_string: '${{ needs.construct-matrix.outputs.unit-test-matrix }}'
Loading

0 comments on commit eaf85fd

Please sign in to comment.