Skip to content

Commit f56ced6

Browse files
authored
Adopt swift-certificates tag (#7)
### Motivation All dependencies need to be tagged releases to make an initial release. ### Modifications * Switch swift-certificates to tagged version. * Update README to clarify new build requirements. * Update CI to set the new build flag. ### Results Builds with tagged swift-certificates version.
1 parent 54e5fc5 commit f56ced6

5 files changed

Lines changed: 69 additions & 6 deletions

File tree

.github/workflows/apibreakage.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: api breakage checks
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_call:
8+
9+
jobs:
10+
api-breakage-check:
11+
name: API breakage check
12+
runs-on: ubuntu-latest
13+
container:
14+
image: swift:6.3
15+
timeout-minutes: 40
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v7
19+
with:
20+
persist-credentials: false
21+
fetch-depth: 0 # Fetching tags requires fetch-depth: 0 (https://github.com/actions/checkout/issues/1471)
22+
- name: Mark the workspace as safe
23+
# https://github.com/actions/checkout/issues/766
24+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
25+
- name: Run API breakage check
26+
shell: bash
27+
# While depending on swift-crypto beta releases an environment variable is required
28+
# to allow swift-certificates to accept the beta versions.
29+
env:
30+
SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA: 1
31+
run: |
32+
git fetch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} ${GITHUB_BASE_REF}:pull-base-ref
33+
BASELINE_REF='pull-base-ref'
34+
echo "Using baseline: $BASELINE_REF"
35+
swift package diagnose-api-breaking-changes "$BASELINE_REF"

.github/workflows/main.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ jobs:
1818
linux_6_3_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
1919
linux_nightly_next_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
2020
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
21+
linux_env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'
2122

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

2730
macos-tests:
2831
name: macOS tests
@@ -33,12 +36,17 @@ jobs:
3336
build_scheme: swift-nio-http3
3437
swift_6_1_enabled: false
3538
swift_6_2_enabled: false
39+
env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'
3640

3741
static-sdk:
3842
name: Static Linux Swift SDK
3943
# Workaround https://github.com/nektos/act/issues/1875
4044
uses: apple/swift-nio/.github/workflows/static_sdk.yml@main
45+
with:
46+
env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'
4147

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

.github/workflows/pull_request.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
with:
1515
license_header_check_project_name: "SwiftNIO"
1616
docs_check_container_image: "swift:6.3"
17-
api_breakage_check_container_image: "swift:6.3"
17+
api_breakage_check_enabled: false
1818
format_check_container_image: "swift:6.3"
1919

2020
unit-tests:
@@ -24,11 +24,14 @@ jobs:
2424
linux_6_3_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
2525
linux_nightly_next_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
2626
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
27+
linux_env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'
2728

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

3336
macos-tests:
3437
name: macOS tests
@@ -39,12 +42,21 @@ jobs:
3942
build_scheme: swift-nio-http3
4043
swift_6_1_enabled: false
4144
swift_6_2_enabled: false
45+
env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'
4246

4347
static-sdk:
4448
name: Static Linux Swift SDK
4549
# Workaround https://github.com/nektos/act/issues/1875
4650
uses: apple/swift-nio/.github/workflows/static_sdk.yml@main
51+
with:
52+
env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'
4753

4854
release-builds:
4955
name: Release builds
5056
uses: apple/swift-nio/.github/workflows/release_builds.yml@main
57+
with:
58+
linux_env_vars: '{"SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA":"1"}'
59+
60+
api-breakage-checks:
61+
name: api breakage checks
62+
uses: ./.github/workflows/apibreakage.yml

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let package = Package(
3232
.package(url: "https://github.com/apple/swift-collections.git", from: "1.1.0"),
3333
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.0"),
3434
.package(url: "https://github.com/apple/swift-crypto.git", from: "5.0.0-beta.1"),
35-
.package(url: "https://github.com/apple/swift-certificates.git", branch: "swift-crypto-5.x"),
35+
.package(url: "https://github.com/apple/swift-certificates.git", from: "1.19.3"),
3636
.package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.22.0"),
3737
.package(url: "https://github.com/apple/swift-nio-quic-helpers.git", branch: "main"),
3838
.package(url: "https://github.com/apple/swift-nio-quic.git", branch: "main"),

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,33 @@ let package = Package(
4747

4848
### Building and testing
4949

50+
Packages in the dependency tree depend on a beta release of swift-crypto.
51+
Set the environment variable
52+
`SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA` to allow swift-certificates
53+
(in the dependency tree) to adopt swift-crypto beta releases as well.
54+
5055
To build via the command line (for all platforms), run at the root of the
5156
package:
5257

5358
```
54-
swift build
59+
SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA=1 swift build
5560
```
5661

5762
To run all unit tests, run
5863

5964
```
60-
swift test
65+
SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA=1 swift test
6166
```
6267

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

6570
```
66-
swift test --filter EncoderTests
67-
swift test --filter EncoderTests.maxBlockedStreams
71+
SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA=1 swift test --filter EncoderTests
72+
SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA=1 swift test --filter EncoderTests.maxBlockedStreams
6873
```
6974

75+
Use `SWIFT_CERTIFICATES_ALLOW_SWIFT_CRYPTO_BETA=1 xed Package.swift` to open
76+
the project in Xcode with the environment variable set.
77+
7078
[swift-nio-quic]: https://github.com/apple/swift-nio-quic
7179
[swift-nio]: https://github.com/apple/swift-nio

0 commit comments

Comments
 (0)