Files

88 lines
4.0 KiB
YAML

name: PR
permissions:
contents: read
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
license_header_check_project_name: "SwiftNIO"
unit-tests:
name: Unit tests
uses: apple/swift-nio/.github/workflows/unit_tests.yml@main
with:
# `Package.swift` requires Swift 6.2, so the older matrix entries cannot build this
# package and are not configured here.
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_main_arguments_override: "--explicit-target-dependency-import-check error"
# Swift Testing 6.3 captures a backtrace for every thrown error, which makes tests that
# throw heavily (e.g. the deep ENVELOPE parser tests) ~5x slower. There is no per-version
# env input, so this applies to all Linux jobs; other versions ignore it.
linux_env_vars: '{"SWT_SWIFT_ERROR_BACKTRACING_ENABLED": "0"}'
cxx-interop:
name: Cxx interop
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
android-sdk:
name: Android Swift SDK
uses: apple/swift-nio/.github/workflows/android_swift_sdk.yml@main
with:
# swift-collections 1.6.0 uses `@inline(always)` under `#if compiler(>=6.3)`, but the
# attribute is still gated behind the experimental `InlineAlways` feature in the nightly
# `main` toolchain this job builds with. Enable it until the dependency's guard is fixed
# upstream (cf. apple/swift-collections #580/#584).
additional_command_arguments: "-Xswiftc -enable-experimental-feature -Xswiftc InlineAlways"
macos-tests:
name: macOS tests
uses: apple/swift-nio/.github/workflows/macos_tests.yml@main
with:
runner_pool: general
# Xcode auto-generates the schemes for this package (`.swiftpm` is not checked in).
# A package with two or more products gets one scheme per product plus an aggregate
# `<package>-Package` scheme; a package with a single product gets just one scheme,
# named `<package>`. Since this package vends both `NIOIMAP` and `IMAPCommands`, the
# aggregate scheme is `swift-nio-imap-Package`. Verify with `xcodebuild -list` in a
# clean checkout if the product list ever changes.
build_scheme: swift-nio-imap-Package
# macos_tests.yml requires explicit disable of 6.1.
swift_6_1_enabled: false
swift_6_2_build_arguments_override: "-Xswiftc -Xfrontend -Xswiftc -require-explicit-sendable -Xswiftc -warnings-as-errors"
swift_6_3_build_arguments_override: "-Xswiftc -Xfrontend -Xswiftc -require-explicit-sendable -Xswiftc -warnings-as-errors"
# Temporary: Swift Testing 6.2/6.3 can deadlock running tests in parallel on macOS.
swift_6_2_test_arguments_override: "--no-parallel"
swift_6_3_test_arguments_override: "--no-parallel"
# See `linux_env_vars` above. The setup command runs before build/test and exports via
# `$GITHUB_ENV`, which scopes this to the Swift 6.2 and 6.3 jobs.
swift_6_2_setup_command: 'echo "SWT_SWIFT_ERROR_BACKTRACING_ENABLED=0" >> "$GITHUB_ENV"'
swift_6_3_setup_command: 'echo "SWT_SWIFT_ERROR_BACKTRACING_ENABLED=0" >> "$GITHUB_ENV"'
examples:
name: Build examples
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
example: [IMAPTool, CLI, Proxy, Fuzzer, PerformanceTester]
container:
image: swift:6.2
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Build
run: swift build --package-path "Examples/${{ matrix.example }}"
- name: Test
if: matrix.example == 'CLI' || matrix.example == 'IMAPTool'
run: swift test --package-path "Examples/${{ matrix.example }}"