Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 58 additions & 70 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,94 +10,82 @@ on:
- cron: "0 8,20 * * *"

jobs:
unit-tests:
name: Unit tests
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
package-tests:
name: Package tests
uses: rnro/github-workflows/.github/workflows/package_test.yml@unification
with:
linux_6_1_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_2_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_3_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_next_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
enable_windows: false
linux_version_overrides: |
6.1: -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error
6.2: -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error
6.3: -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error
nightly-release: -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error
nightly-main: --explicit-target-dependency-import-check error

cxx-interop:
name: Cxx interop
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
enable_macos: true
macos_runner_pool: nightly
xcode_scheme: swift-nio-Package
enable_ios_xcode_build: true
enable_ios_xcode_test: true
enable_watchos_xcode_build: true
enable_watchos_xcode_test: true
enable_tvos_xcode_build: true
enable_tvos_xcode_test: true
enable_visionos_xcode_build: true
enable_visionos_xcode_test: true

enable_linux_static_sdk_build: true
enable_wasm_sdk_build: true
wasm_sdk_build_command: "swift build --target NIOCore"
enable_android_sdk_build: true

enable_release_build: true
enable_cxx_interop: true

benchmarks:
name: Benchmarks
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
uses: rnro/github-workflows/.github/workflows/benchmarks.yml@unification
with:
benchmark_package_path: "Benchmarks"
enable_linux_benchmarks: true
enable_macos_benchmarks: false

construct-integration-test-matrix:
name: Construct integration test matrix
generate-integration-test-matrix:
name: Generate integration test matrix
runs-on: ubuntu-latest
outputs:
integration-test-matrix: '${{ steps.generate-matrix.outputs.integration-test-matrix }}'
matrix_yaml: ${{ steps.generate.outputs.matrix_yaml }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- id: generate-matrix
run: echo "integration-test-matrix=$(curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT"
- name: Checkout rnro/github-workflows
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: rnro/github-workflows
ref: unification
path: github-workflows
persist-credentials: false
- name: Generate matrix
id: generate
run: |
matrix_yaml=$(github-workflows/.github/workflows/scripts/generate-matrix.sh)
echo "matrix_yaml<<EOF" >> $GITHUB_OUTPUT
echo "$matrix_yaml" >> $GITHUB_OUTPUT
echo "EOF" >> $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"
MATRIX_LINUX_ENV_VARS_JSON: '{"NIO_ALLOC_COUNTER_TESTS_PARALLEL": "true"}'
ENABLE_LINUX: "true"
ENABLE_WINDOWS: "false"
ENABLE_MACOS: "false"
LINUX_PRE_BUILD_COMMAND: "sudo apt-get update -y -q && sudo apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq"
LINUX_BUILD_COMMAND: "./scripts/integration_tests.sh"
LINUX_ENV_VARS: '{"NIO_ALLOC_COUNTER_TESTS_PARALLEL": "true"}'

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_test_matrix.yml@main
needs: generate-integration-test-matrix
uses: rnro/github-workflows/.github/workflows/execute_matrix.yml@unification
with:
name: "Integration tests"
matrix_string: '${{ needs.construct-integration-test-matrix.outputs.integration-test-matrix }}'

static-sdk:
name: Static Linux Swift SDK
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/static_sdk.yml@main

wasm-sdk:
name: WebAssembly Swift SDK
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/wasm_swift_sdk.yml@main
with:
additional_command_arguments: "--target NIOCore"

android-sdk:
name: Android Swift SDK
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/android_swift_sdk.yml@main

macos-tests:
name: macOS tests
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/macos_tests.yml@main
with:
runner_pool: nightly
build_scheme: swift-nio-Package
debug_output_enabled: true
xcode_16_3_enabled: false
xcode_16_4_enabled: false
xcode_26_0_enabled: false
xcode_26_1_enabled: false
xcode_26_2_enabled: false
swift_6_1_enabled: true
swift_6_2_enabled: true
swift_6_3_enabled: true
macos_xcode_test_enabled: false # Disabled because of an issue
ios_xcode_test_enabled: true
watchos_xcode_test_enabled: true
tvos_xcode_test_enabled: true
visionos_xcode_test_enabled: true

release-builds:
name: Release builds
uses: apple/swift-nio/.github/workflows/release_builds.yml@main
matrix_yaml_string: ${{ needs.generate-integration-test-matrix.outputs.matrix_yaml }}
120 changes: 54 additions & 66 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,54 +16,79 @@ jobs:
# Workaround https://github.com/swiftlang/swift-docc/issues/1280
docs_check_container_image: "swift:6.1-noble"

unit-tests:
name: Unit tests
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
package-tests:
name: Package tests
uses: rnro/github-workflows/.github/workflows/package_test.yml@unification
with:
linux_6_1_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_2_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_6_3_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_next_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
enable_windows: false
linux_version_overrides: |
6.1: -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error
6.2: -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error
6.3: -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error
nightly-release: -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error
nightly-main: --explicit-target-dependency-import-check error

enable_macos: true
macos_runner_pool: general

# SDKs
enable_linux_static_sdk_build: true
enable_wasm_sdk_build: true
wasm_sdk_build_command: "swift build --target NIOCore"
enable_android_sdk_build: true

# Release build and Cxx interop
enable_release_build: true
enable_cxx_interop: true

benchmarks:
name: Benchmarks
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
uses: rnro/github-workflows/.github/workflows/benchmarks.yml@unification
with:
benchmark_package_path: "Benchmarks"
enable_linux_benchmarks: true
enable_macos_benchmarks: false

cxx-interop:
name: Cxx interop
# 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
# Integration tests use a custom matrix — call execute_matrix.yml directly
generate-integration-test-matrix:
name: Generate integration test matrix
runs-on: ubuntu-latest
outputs:
integration-test-matrix: '${{ steps.generate-matrix.outputs.integration-test-matrix }}'
matrix_yaml: ${{ steps.generate.outputs.matrix_yaml }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- id: generate-matrix
run: echo "integration-test-matrix=$(curl -s --retry 3 https://raw.githubusercontent.com/apple/swift-nio/main/scripts/generate_matrix.sh | bash)" >> "$GITHUB_OUTPUT"
- name: Checkout rnro/github-workflows
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: rnro/github-workflows
ref: unification
path: github-workflows
persist-credentials: false
- name: Generate matrix
id: generate
run: |
matrix_yaml=$(github-workflows/.github/workflows/scripts/generate-matrix.sh)
echo "matrix_yaml<<EOF" >> $GITHUB_OUTPUT
echo "$matrix_yaml" >> $GITHUB_OUTPUT
echo "EOF" >> $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"
MATRIX_LINUX_ENV_VARS_JSON: '{"NIO_ALLOC_COUNTER_TESTS_PARALLEL": "true"}'
ENABLE_LINUX: "true"
ENABLE_WINDOWS: "false"
ENABLE_MACOS: "false"
LINUX_PRE_BUILD_COMMAND: "sudo apt-get update -y -q && sudo apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq"
LINUX_BUILD_COMMAND: "./scripts/integration_tests.sh"
LINUX_ENV_VARS: '{"NIO_ALLOC_COUNTER_TESTS_PARALLEL": "true"}'

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_test_matrix.yml@main
needs: generate-integration-test-matrix
uses: rnro/github-workflows/.github/workflows/execute_matrix.yml@unification
with:
name: "Integration tests"
matrix_string: '${{ needs.construct-integration-test-matrix.outputs.integration-test-matrix }}'
matrix_yaml_string: ${{ needs.generate-integration-test-matrix.outputs.matrix_yaml }}

vsock-tests:
name: Vsock tests
Expand All @@ -78,44 +103,7 @@ jobs:
- name: Build package tests
run: swift build --build-tests
- name: Run Vsock tests
shell: bash # explicitly choose bash, which ensures -o pipefail
shell: bash
run: swift test --filter "(?i)vsock" | tee test.out
- name: Check for skipped tests
run: test -r test.out && ! grep -i skipped test.out

macos-tests:
name: macOS tests
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/macos_tests.yml@main
with:
runner_pool: general
build_scheme: swift-nio-Package
xcode_16_3_enabled: false
xcode_16_4_enabled: false
xcode_26_0_enabled: false
xcode_26_1_enabled: false
xcode_26_2_enabled: false
swift_6_1_enabled: true
swift_6_2_enabled: true
swift_6_3_enabled: true

static-sdk:
name: Static Linux Swift SDK
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/static_sdk.yml@main

wasm-sdk:
name: WebAssembly Swift SDK
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/wasm_swift_sdk.yml@main
with:
additional_command_arguments: "--target NIOCore"

android-sdk:
name: Android Swift SDK
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/android_swift_sdk.yml@main

release-builds:
name: Release builds
uses: apple/swift-nio/.github/workflows/release_builds.yml@main
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,17 @@ for mode in debug release; do

# expecting irrecoverable error as process should be terminated through fatalError/precondition/assert
architecture=$(uname -m)
# Inside Docker, bash reports signal kills as 128+signal.
# On a native host, the raw signal number is returned.
if [[ -f /.dockerenv ]]; then
sig_offset=128
else
sig_offset=0
fi
if [[ $architecture =~ ^(arm|aarch) ]]; then
assert_equal $exit_code $(( 128 + 5 )) # 5 == SIGTRAP aka trace trap, expected on ARM
assert_equal $exit_code $(( sig_offset + 5 )) # 5 == SIGTRAP aka trace trap, expected on ARM
elif [[ $architecture =~ ^(x86|i386) ]]; then
assert_equal $exit_code $(( 128 + 4 )) # 4 == SIGILL aka illegal instruction, expected on x86
assert_equal $exit_code $(( sig_offset + 4 )) # 4 == SIGILL aka illegal instruction, expected on x86
else
fail "unknown CPU architecture for which we don't know the expected signal for a crash"
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,17 @@ for mode in debug release; do

# expecting irrecoverable error as process should be terminated through fatalError/precondition/assert
architecture=$(uname -m)
# Inside Docker, bash reports signal kills as 128+signal.
# On a native host, the raw signal number is returned.
if [[ -f /.dockerenv ]]; then
sig_offset=128
else
sig_offset=0
fi
if [[ $architecture =~ ^(arm|aarch) ]]; then
assert_equal $exit_code $(( 128 + 5 )) # 5 == SIGTRAP aka trace trap, expected on ARM
assert_equal $exit_code $(( sig_offset + 5 )) # 5 == SIGTRAP aka trace trap, expected on ARM
elif [[ $architecture =~ ^(x86|i386) ]]; then
assert_equal $exit_code $(( 128 + 4 )) # 4 == SIGILL aka illegal instruction, expected on x86
assert_equal $exit_code $(( sig_offset + 4 )) # 4 == SIGILL aka illegal instruction, expected on x86
else
fail "unknown CPU architecture for which we don't know the expected signal for a crash"
fi
Expand Down
Loading