Skip to content
Merged
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
52 changes: 42 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
test-macos:
name: Swift ${{ matrix.swift }} on macOS ${{ matrix.macos }} with Xcode ${{ matrix.xcode }}
name: Swift ${{ matrix.swift }} on macOS ${{ matrix.macos }} with Xcode ${{ matrix.xcode }}${{ matrix.variant == 'async_http_client' && ' (AsyncHTTPClient)' || '' }}
runs-on: macos-${{ matrix.macos }}
env:
DEVELOPER_DIR: "/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer"
Expand All @@ -19,12 +19,23 @@ jobs:
- macos: "15"
swift: "6.0"
xcode: "16.0"
variant: default
- macos: "15"
swift: "6.1"
xcode: "16.3"
variant: default
- macos: "26"
swift: "6.2"
xcode: "26.0"
variant: default
- macos: "15"
swift: "6.1"
xcode: "16.3"
variant: async_http_client
- macos: "26"
swift: "6.2"
xcode: "26.0"
variant: async_http_client
timeout-minutes: 5
steps:
- name: Checkout code
Expand All @@ -36,27 +47,40 @@ jobs:
path: |
~/.cache/org.swift.swiftpm
.build
key: ${{ runner.os }}-swift-${{ matrix.swift }}-spm-${{ hashFiles('**/Package.resolved') }}
key: ${{ runner.os }}-swift-${{ matrix.swift }}-${{ matrix.variant }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-swift-${{ matrix.swift }}-spm-
${{ runner.os }}-swift-${{ matrix.swift }}-${{ matrix.variant }}-spm-

- name: Configure variant
run: |
if [ "${{ matrix.variant }}" = "async_http_client" ]; then
echo "SWIFT_VARIANT_ARGS=--traits AsyncHTTPClient --scratch-path .build/async-http-client" >> "$GITHUB_ENV"
else
echo "SWIFT_VARIANT_ARGS=--scratch-path .build/default" >> "$GITHUB_ENV"
fi

- name: Lint
run: swift format lint --recursive . --strict

- name: Build
run: swift build -v
run: swift build $SWIFT_VARIANT_ARGS

- name: Test
run: swift test -v
run: swift test $SWIFT_VARIANT_ARGS

test-linux:
name: Swift ${{ matrix.swift-version }} on Linux
name: Swift ${{ matrix.swift-version }} on Linux${{ matrix.variant == 'async_http_client' && ' (AsyncHTTPClient)' || '' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
swift-version:
- 6.1.0
include:
- swift-version: "6.0.3"
variant: default
- swift-version: "6.1.0"
variant: default
- swift-version: "6.1.0"
variant: async_http_client
timeout-minutes: 10
steps:
- name: Checkout code
Expand All @@ -67,8 +91,16 @@ jobs:
with:
toolchain: ${{ matrix.swift-version }}

- name: Configure variant
run: |
if [ "${{ matrix.variant }}" = "async_http_client" ]; then
echo "SWIFT_VARIANT_ARGS=--traits AsyncHTTPClient --scratch-path .build/async-http-client" >> "$GITHUB_ENV"
else
echo "SWIFT_VARIANT_ARGS=--scratch-path .build/default" >> "$GITHUB_ENV"
fi

- name: Build
run: swift build -v
run: swift build $SWIFT_VARIANT_ARGS

- name: Test
run: swift test -v
run: swift test $SWIFT_VARIANT_ARGS
204 changes: 204 additions & 0 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 23 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 6.0
// swift-tools-version: 6.1
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -20,15 +20,35 @@ let package = Package(
targets: ["EventSource"]
)
],
traits: [
.trait(name: "AsyncHTTPClient")
],
dependencies: [
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.24.0")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
// Targets can depend on other targets in this package and products from dependencies.
.target(
name: "EventSource"
name: "EventSource",
dependencies: [
.product(
name: "AsyncHTTPClient",
package: "async-http-client",
condition: .when(traits: ["AsyncHTTPClient"])
)
]
),
.testTarget(
name: "EventSourceTests",
dependencies: ["EventSource"]
dependencies: [
"EventSource",
.product(
name: "AsyncHTTPClient",
package: "async-http-client",
condition: .when(traits: ["AsyncHTTPClient"])
),
]
),
]
)
31 changes: 31 additions & 0 deletions Package@swift-6.0.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "EventSource",
platforms: [
.iOS("15.0"),
.macOS("12.0"),
.macCatalyst("15.0"),
.watchOS("8.0"),
.tvOS("15.0"),
.visionOS("1.0"),
],
products: [
.library(
name: "EventSource",
targets: ["EventSource"]
)
],
targets: [
.target(
name: "EventSource"
),
.testTarget(
name: "EventSourceTests",
dependencies: ["EventSource"]
),
]
)
Loading