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
35 changes: 35 additions & 0 deletions .github/workflows/apibreakage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: api breakage checks

permissions:
contents: read

on:
workflow_call:

jobs:
api-breakage-check:
name: API breakage check
runs-on: ubuntu-latest
container:
image: swift:6.3
timeout-minutes: 40
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0 # Fetching tags requires fetch-depth: 0 (https://github.com/actions/checkout/issues/1471)
- name: Mark the workspace as safe
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Run API breakage check
shell: bash
# While depending on swift-crypto beta releases an environment variable is required
# to allow swift-certificates to accept the beta versions.
env:
SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA: 1
run: |
git fetch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} ${GITHUB_BASE_REF}:pull-base-ref
BASELINE_REF='pull-base-ref'
echo "Using baseline: $BASELINE_REF"
swift package diagnose-api-breaking-changes "$BASELINE_REF"
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ jobs:
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"
linux_env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'

cxx-interop:
name: Cxx interop
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
with:
linux_env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'

macos-tests:
name: macOS tests
Expand All @@ -33,12 +36,17 @@ jobs:
build_scheme: swift-nio-http3
swift_6_1_enabled: false
swift_6_2_enabled: false
env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'

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
with:
env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'

release-builds:
name: Release builds
uses: apple/swift-nio/.github/workflows/release_builds.yml@main
with:
linux_env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'
14 changes: 13 additions & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
license_header_check_project_name: "SwiftNIO"
docs_check_container_image: "swift:6.3"
api_breakage_check_container_image: "swift:6.3"
api_breakage_check_enabled: false
format_check_container_image: "swift:6.3"

unit-tests:
Expand All @@ -24,11 +24,14 @@ jobs:
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"
linux_env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'

cxx-interop:
name: Cxx interop
# Workaround https://github.com/nektos/act/issues/1875
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
with:
linux_env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'

macos-tests:
name: macOS tests
Expand All @@ -39,12 +42,21 @@ jobs:
build_scheme: swift-nio-http3
swift_6_1_enabled: false
swift_6_2_enabled: false
env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'

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
with:
env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'

release-builds:
name: Release builds
uses: apple/swift-nio/.github/workflows/release_builds.yml@main
with:
linux_env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'

api-breakage-checks:
name: api breakage checks
uses: ./.github/workflows/apibreakage.yml
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let package = Package(
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.0"),
.package(url: "https://github.com/apple/swift-crypto.git", from: "5.0.0-beta.1"),
.package(url: "https://github.com/apple/swift-certificates.git", branch: "swift-crypto-5.x"),
.package(url: "https://github.com/apple/swift-certificates.git", from: "1.19.3"),
.package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.22.0"),
.package(url: "https://github.com/apple/swift-nio-quic-helpers.git", branch: "main"),
.package(url: "https://github.com/apple/swift-nio-quic.git", branch: "main"),
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,33 @@ let package = Package(

### Building and testing

Packages in the dependency tree depend on a beta release of swift-crypto.
Set the environment variable
`SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA` to allow swift-certificates
(in the dependency tree) to adopt swift-crypto beta releases as well.

To build via the command line (for all platforms), run at the root of the
package:

```
swift build
SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA=1 swift build
```

To run all unit tests, run

```
swift test
SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA=1 swift test
```

Unit tests can also be run by filtering a specific class or function:

```
swift test --filter EncoderTests
swift test --filter EncoderTests.maxBlockedStreams
SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA=1 swift test --filter EncoderTests
SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA=1 swift test --filter EncoderTests.maxBlockedStreams
```

Use `SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA=1 xed Package.swift` to open
the project in Xcode with the environment variable set.

[swift-nio-quic]: https://github.com/apple/swift-nio-quic
[swift-nio]: https://github.com/apple/swift-nio
Loading