Allow custom argument specification in the Static SDK workflow
### Motivation:
Sometimes users may want to specify more/different parameters such as
specifying building only some targets
### Modifications:
Add a parameter for the build arguments
### Result:
More flexible SDK CI.
You can see this in action here
https://github.com/apple/swift-nio/actions/runs/17858707940/job/50783709148?pr=3377
Allow the specification of custom environment variables in our matrix
workflow and those which use it.
### Motivation:
It can be useful to supply custom environment variables to control build
and runtime options.
### Modifications:
Allow users to supply a string of custom environment variable key-value
pairs which are supplied to the docker container running the matrix
commands.
To attempt to avoid issues with this string concatenation the change
also allows the user to specify custom list entry and key-value-pair
separators.
To avoid parameter bloat the env vars are set for all Swift versions,
hopefully that's sufficient for now.
### Result:
Adopters can
Examples of this working on Linux and Windows, note the presence of the
test environment variables I injected:
-
https://github.com/apple/swift-nio/actions/runs/17917619451/job/50943847555?pr=3376
- https://github.com/apple/swift-crypto/pull/413/checks
e.g.
```
Executing Docker command: docker run -v /home/runner/work/swift-nio/swift-nio:/swift-nio -w /swift-nio -e CI=true -e GITHUB_ACTIONS=true -e SWIFT_VERSION=6.0 -e workspace=/swift-nio -e TEST_DEBUG=1 -e TEST_LOG_LEVEL=info swift:6.0-jammy bash -c swift --version && swift test -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error
```
### Motivation:
New Xcodes are out so we should test with them.
### Modifications:
Update the macOS matrix generation script
### Result:
Add Xcode 26.0, 16.4 CI, remove 16.2 jobs by default.
CI with the new Xcodes working (except 26.0 which will come online as
nodes recycle
https://github.com/apple/swift-nio/actions/runs/17834807139/job/50709176060?pr=3375)
Add build check CI for WebAssembly SDK
### Motivation:
Add build check CI for WebAssembly SDK
### Modifications:
Add Wasm build checks in `main.yml` and `pull_request.yml` based on
https://github.com/apple/swift-nio/pull/3331
Extracted from https://github.com/apple/swift-nio/pull/3159
### Result:
Setting up the CI job makes it easier to detect such incompatibility
before merging.
Add build check CI for WebAssembly SDK
### Motivation:
Add build check CI for WebAssembly SDK
### Modifications:
Add only reusable GHA workflow from
https://github.com/apple/swift-nio/pull/3159 to gracefully merge changes
without breaking CI.
After this change being merged into main branch, we can merge the actual
PR checks: https://github.com/apple/swift-nio/pull/3331
### Result:
Setting up the CI job makes it easier to detect such incompatibility
before merging.
Fixes all warnings when `-require-explicit-sendable` flag is enabled and
enables the flag on macOS CI.
### Motivation:
We want to ensure our public API is either explicitly marked as
`Sendable` or not.
### Modifications:
Marked appropriate public types as `Sendable`, or explicitly defined
their conformance to the `Sendable` protocol as unavailable.
### Result:
We can now enable `-require-explicit-sendable` compiler flag in our
codebase.
### Motivation:
Some errors do not show up in debug builds. Enabling release mode builds
improves the CI coverage.
### Modifications:
Enable release mode builds for pull requests and scheduled builds on
main.
### Result:
Improved CI coverage.
### Motivation:
Not everything that relies on these workflows builds on windows. Unit
tests and release builds should be explicitly enabled for windows
builds.
### Modifications:
Change default of windows nightly to false. Fix flag checks that enable
nightly builds.
### Result:
Easier to use CI workflows.
Add a new workflow file for release mode builds
### Motivation:
Some errors do not show up in debug builds. Running release mode builds
improves the CI coverage.
### Modifications:
Add a new workflow for release mode builds.
### Result:
Projects can build on this workflow to enable release mode builds.
Instead of checking for a setup command in bash, we use GitHub Actions
to determine if there is anything to run
### Motivation:
Slightly cleaner output when looking at logs.
### Modifications:
Moved an if statement from bash to yaml.
### Result:
The setup commands step will generally be skipped instead of executing a
no-op
Co-authored-by: Cory Benfield <lukasa@apple.com>
Motivation:
The nightly visionOS tests are failing because there
are too many simulators matching the given destination
selector.
Modifications:
- On Xcode 16.2 use visionOS 2.3
Result:
Nightly CI passes
Specify default macOS variant in non-catalyst builds.
https://developer.apple.com/forums/thread/737851
### Motivation:
macOS build has an extra warning:
```
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, name:Any Mac }
{ platform:macOS, variant:Mac Catalyst, name:Any Mac }
```
### Modifications:
Explicitly select the macOS variant.
### Result:
No warnings
### Motivation:
The macOS runners have a symlink to the latest released Xcode beta at
Xcode-latest.app, by making use of it we will always test against the
most recent version.
### Modifications:
Introduce new parameters for the latest Xcode beta and deprecate those
which mention Xcode 21 betas.
### Result:
Tests will move on to using Xcode 26 beta 2 via the symlink
Example of this working
https://github.com/apple/swift-nio/actions/runs/16075841548/job/45370760690?pr=3285
Fixed issue with macOS CI when overrides are being used.
### Motivation:
When we use Xcode_XX_X_build_arguments_override, the CI fails because of
an extra double quotes ("") making its way to the final command.
### Modifications:
Remove the extra double quote from the Yaml file defining macOS tests.
### Result:
We are able to run `swift build` with extra arguments.
Add Xcode 26 beta 1 to macOS CI and disable Xcode 16.1 jobs by default
### Motivation:
* Xcode 26 beta 1 is now released, we should test our code on it.
* We should drop 16.1 to conserve the number of jobs. 16.1 isn't
offering much coverage anyway since it has the same Swift minor version
(6.0) as Xcode 16.2.
### Modifications:
* Enable use of Xcode 26 beta 1 by default.
* Disable Xcode 16.1 jobs by default
### Result:
* This and downstream repos will run Xcode builds on Xcode 26 beta 1.
* Xcode 16.1 jobs won't run by default on this or downstream repos but
will run if explicitly requested.
An example of this working
https://github.com/apple/swift-nio/actions/runs/15614383580/job/43983277904?pr=3267
### Motivation:
The current method of parsing the ASCII table output is brittle and
because the text output and the stored thresholds in JSON have different
precisions doesn't always work.
### Modifications:
* In the event that a deviation is found re-run the benchmarks in update
mode and print the git diff to the logs.
* The threshold update script scrapes this from the logs and applies it
locally so that it can then be committed.
* Add the functionality in the update script to update thresholds based
on diff in logs
### Result:
More reliable threshold updates.
An example of this working:
https://github.com/apple/swift-nio/actions/runs/15302748893?pr=3257
---------
Co-authored-by: George Barnett <gbarnett@apple.com>
### Motivation:
Some 429: Too many requests responses have been seen when attempting to
curl remote CI scripts.
### Modifications:
Adding `--retry 3` which means that curl will retry 3 times on transient
error codes.
### Result:
Transient errors will be retried 3 times, first for 1 second and then
doubled each retry.
From `man curl`
```
--retry <num>
If a transient error is returned when curl tries to perform a transfer, it
retries this number of times before giving up. Setting the number to 0
makes curl do no retries (which is the default). Transient error means
either: a timeout, an FTP 4xx response code or an HTTP 408, 429, 500, 502,
503 or 504 response code.
When curl is about to retry a transfer, it first waits one second and then
for all forthcoming retries it doubles the waiting time until it reaches 10
minutes which then remains delay between the rest of the retries. By using
--retry-delay you disable this exponential backoff algorithm. See also
--retry-max-time to limit the total time allowed for retries.
curl complies with the Retry-After: response header if one was present to
know when to issue the next retry (added in 7.66.0).
If --retry is provided several times, the last set value is used.
```
### Motivation:
To have more version about which swift is running to aid in debugging.
### Modifications:
Run swift --version on common workflows, this should be safe because
they all assume Swift is already nistalled unlike the Static SDK
workflow.
### Result:
Swift tools information will be printed before job execution
An example of this working:
https://github.com/apple/swift-nio/actions/runs/15049159516/job/42299334292
Motivation:
A setup command for 16.2 was added as a workaround for an infra issue.
This should now be resolved.
Modifications:
- Remove the default setup command
Result:
CI should still work.
### Motivation:
Building for visionOS no longer seems to be having issues on the
runners, we should enable it to increase our test coverage.
### Modifications:
Enable visionOS xcodebuilds by default in CI
### Result:
NIO and downstream repositories will see their *existing* macOS CI
workflows now build for visionOS.
They can be disabled if necessary by passing
`visionos_xcode_build_enabled: false`
See apple/swift-nio#3234, apple/swift-nio#3235
Add per-xcode setup command
### Motivation:
Sometimes individual Xcodes require different steps to fixup simulator
configuration.
### Modifications:
* Allow the config to define custom setup steps
* Add some `simctl` commands to Xcode 16.2 by default to workaround
issues
### Result:
Adopters can specify their own setup steps
Example of this working with a test shim in place
https://github.com/apple/swift-nio/actions/runs/14992683747/job/42119567309?pr=3236
### Motivation:
Building for visionOS no longer seems to be having issues on the
runners, we should enable it to increase our test coverage.
###Modifications:
Enable visionOS xcodebuilds by default in CI
### Result:
NIO and downstream repositories will see their *existing* macOS CI
workflows now build for visionOS.
They can be disabled if necessary by passing
`visionos_xcode_build_enabled: false`
### Motivation:
Swift 5.9 is no longer supported and CI has been updated to no longer
require it, we should disable it by default.
### Modifications:
* Default Swift 5.9 CI jobs to disabled
### Result:
Swift 5.9 CI jobs will not run unless opted-in
Motivation:
Swift 5.9 is no longer supported, we should bump the tools version and
remove it from our CI.
Modifications:
* Bump the Swift tools version to Swift 5.10
* Remove Swift 5.9 jobs where appropriate in main.yml, pull_request.yml
Result:
Code reflects our support window.
Add and enable Swift 6.1 workflows
### Motivation:
Swift 6.1 has been released, we should add it to our CI coverage.
### Modifications:
* Update `appe/swift-nio/scripts/generate_matrix.sh`
* Update reusable adopters of `swift_test_matrix.yml`
* Update end-user adopter workflows of `swift_test_matrix.yml`
* Copy over test flags from Swift 6.0 jobs
### Result:
NIO tests against Swift 6.1 in CI and downstream repositories can
opt-in.
(Successful CI run with the workflows modified to use the changes on
this branch
https://github.com/apple/swift-nio/actions/runs/14400598096?pr=3196)
Static SDK installation script improvements
### Motivation:
Make static SDK installation scripts more modular and make
failures easier to diagnose.
### Modifications:
- Allow specification of binaries from outside the installation script
- Remove script dependency installation from the script
- Separate the Swift dependency installation into its own script
- Fatal error explicitly if the installed Swift can't be found
- Make curl operations for downloading artifacts explicitly fail
### Result:
Scripts which are easier to maintain and operate.
An example CI run with this in operation
https://github.com/apple/swift-nio/actions/runs/14329482180/job/40162003318?pr=3186
### Motivation:
These don't work on all versions but we should allow people to opt-in if
they know they do work
### Modifications:
Uncomment the steps and make the step default to off
### Result:
People can choose to run visionOS builds and tests
### Motivation:
Xcode 16.3 has been released, we should cover it in CI
### Modifications:
* Add Xcode 16.3 runs by default
* Disable Xcode 16.0 runs by default (soft deprecation)
Note that the Xcode version offering is still a work in progress.
### Result:
macOS CI will test using Xcode 16.3
An example run with this working
https://github.com/apple/swift-nio/actions/runs/14220724296/job/39876502770?pr=3171
Add support for macOS CI runner pools
### Motivation:
With new runners coming online we are separating the runners into pools.
* "nightly" runners are to be targeted for asynchronous work which users
aren't waiting on such as overnight work.
* "general" runners can be used for either synchronoous or asynchronous
work.
* At the moment all runers are "general" runners, a subset are "nightly"
runners.
The aim here is to prioritize work which users are waiting for such as
on PRs. Asynchronous work prioritizing the "nightly" runners will likely
end up queuing for the contended runners but synchronous work will claim
any available node.
### Modifications:
* Add a `runner_pool` input for the macOS workflow
* Default the `runner_pool` to `nightly` since the vast majority of
existing workflows are specifying asynchronous work.
* Specify the runner pool in NIO's use of macOS CI.
### Result:
Support for runner pools.
An example of this in action:
https://github.com/apple/swift-nio/actions/runs/14188573697/job/39748250001
Separate build and test steps in `macos_tests.yml`. Test execution can
now also be disabled through an input. This is useful for clarity of
output and also in some cases where test execution may not be supported
yet.
### Motivation:
We are still exploring the shape of macOS CI and exploring the system's
capabilities.
### Modifications:
* Add visionOS jobs
* Remove Xcode 15.4 as it is no longer on the runners
* Add support for running tests targetting other platforms
* Enable test targeting other platforms on daily jobs to increase
coverage without bloating PR runtimes.
### Result:
More macOS CI coverage
CI run with this enabled
https://github.com/apple/swift-nio/actions/runs/13944231147/job/39027647470?pr=3150
- the iOS failure is unrelated to this change
### Motivation
A few repositories have custom workflows for checking CMake, we would
like to unify this for maintenance and adoption simplicity.
Further to this at the moment they only check that the scripts are
up-to-date, we'd also like to have them build using CMake.
### Modifications
Add the re-usable workflow and supporting scripts
### Result:
Repositories using CMake can switch to the centralised workflow.
An example of it in action
https://github.com/apple/swift-crypto/actions/runs/13837092514/job/38782284575
### Motivation:
The static SDK workflow currently assumes a local setup script which
isn't true for external adopters.
### Modifications:
* The static SDK workflow now curls for the setup script.
* Run Static SDK checks on PR commits
### Result:
External adopters should be unblocked.
Enable macOS CI
### Motivation:
To expand test coverage to the Darwin platforms.
### Modifications:
Create a new re-usable workflow `macos_tests.yml` which offers testing
and compilation checks for multiple Xcodes and simulator destinations.
The new workflow first performs `swift test` with configurable
parameters and then goes on to build the code targeting generic
destinations for:
* iOS
* macOS
* macOS Catalyst
* tvOS
* visionOS (temporarily disabled due to a possible runner issue)
* watchOS
At the moment this is workflow is enabled to run on the NIO repository:
* on each commit to a PR
* on each merge to `main`
* overnight on a timer
This will likely be revised due to capacity.
This functionality is implemented as a standalone workflow to preserve
flexibility as requirements and capacity change over time.
### Result:
Increased test coverage.
A re-usable static SDK compilation workflow
### Motivation:
We would like to offer the ability to opt-in to CI coverage for
compilation against the Linux static SDK.
### Modifications:
Introduce a workflow which will install a Swift snapshot and Linux SDK
and test the repository builds against it.
The script which sets up the VM will install snapshots and SDKs for
either branch or released-version snapshots. They can be specified as:
- a specific version string
- the 'latest' version, the script attempts to find the most recent
version enumerated on swift.org with both SDK and toolchain available
- the most recent snapshot for the specified branch name enumerated on
swift.org with both SDK and toolchain available
At the moment the script should work on ubuntu and amazonlinux OSes,
this can be expanded in the future.
The current matrix covers testing building on Ubuntu Jammy for the main
branch and latest released Swift version (6.0.3) and enables it on our
periodic CI runs.
See
https://github.com/apple/swift-nio/actions/runs/13722773053/job/38381907947?pr=3019
for a recent example of this workflow in action.
### Result:
Increased CI coverage
### Motivation:
Updating the CI parameters for changing nightly job targets with each
new Swift version (6.0, 6.1, ...) is onerous. Whilst this gives us some
value in the non-nightly pipelines by forcing adopters to apply thought
to what is applied to each supported version, the nightlies arguably
deliver less value in this regard as they tend to be non-required.
### Modifications:
Change parameters to refer to nightly_next rather than nightly_6_1,
implement
a shim so that the old parameter names still work.
### Result:
We will be able to modify top-level workflows to use nightly_next
terminology.
Test run with an additional commit opting in to use these changes at the
top level
https://github.com/apple/swift-nio/actions/runs/13524774485/job/37792437713?pr=3122
### Motivation:
It can be useful for scripts to be able to check if they are being run
in CI. Because we invoke docker on the CI runners, the env var which
people may use to do this isn't present.
### Modifications:
Expose `GITHUB_ACTIONS` env var to docker containers in the matrix
workflow
### Result:
Adopters of the matrix workflow or downstream workflows will be able to
check if they are running in CI
### Motivation:
Some repositories still use the older CI Swift matrix directly so we
need to update it to handle 6.1 nightlies.
### Modifications:
Replace 6.0 nightly with 6.1 nightly.
### Result:
External CI should use 6.1 nightly.