Motivation
* `@main` references to `swiftlang/github-workflows` are deprecated.
Modifications
* Replace `@main` with `@0.0.7` in all workflow files.
Result
* Workflow files reference a pinned version of
`swiftlang/github-workflows`.
Swift SDK installation script improvements
### Motivation:
The SDK installation scripts had a few rough edges and didn't verify the
artefacts they downloaded.
### Modifications:
* Change naming to the more accurate "Swift SDK" where we can without
breaking downstream adopters.
* Separate Android NDK installation into its own script.
* Avoid using `cd` when setting up Android NDK.
* Verify checksums for SDKs and signatures for toolchains.
* Specify/control the SDK directory.
### Result:
* More accurate naming.
* More maintainable scripts.
* More secure downloads.
An example of this working
https://github.com/apple/swift-nio/actions/runs/18944235613/job/54090944716?pr=3429
### Motivation:
Android SDKs now exist and testing is good.
### Modifications:
Add an Android GitHub Actions workflow using the latest nightly image
and enable it in NIO targetting NIOCore (matching WASM testing).
### Result:
More reusable workflows and more test coverage for NIO
See this in action here (the CI job works but NIOCore fails to build):
https://github.com/apple/swift-nio/actions/runs/18718487605/job/53384086329?pr=3418
WASM SDK GitHub Actions workflows use NIO matrix rather than the
swiftlang one
### Motivation:
Using the NIO one is more in line with the surrounding workflows and
surfaces a simpler UI (possible jobs which aren't run don't appear in
the UI)
### Modifications:
Pull in changes from https://github.com/apple/swift-nio/pull/3159 and
add in the ability to specify environment variables and other build
arguments in line with the static Linux SDK workflow.
### Result:
More regularity, simpler checks UI.
See this in action here:
https://github.com/apple/swift-nio/actions/runs/18717131164/job/53379323803?pr=3417
---------
Co-authored-by: Yuta Saito <kateinoigakukun@gmail.com>
Co-authored-by: Max Desiatov <m_desiatov@apple.com>
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.
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:
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:
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)
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
### 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.
### Motivation:
Some changes were missed in #3076, passing through parameters for the
new 6.1 version.
### Modifications:
Pass through more parameters, clean up misleading comments.
### Result:
6.1 nightly runs will be more like 6.0 nightly runs were
Re-usable workflows curl scripts
### Motivation:
Other workflows re-use the NIO workflows they don't do a full git
checkout so they don't have access to the scripts, we need to curl them.
### Modifications:
curl the scripts
### Result:
Downstream repositories should be able to re-use these workflows
Matrix workflows refer to main branch
### Motivation:
Now that the workflow files are committed we can refer to them on the
main branch
### Modifications:
Replace @matrix_file with @main
### Result:
More stable references in workflows.
Introduce and adopt a new method for defining test matrices,
`swift_test_matrix.yml`.
⚠️ Any external adopters of the unit tests, Cxx interop and benchmarks
workflows are automatically opted in to use the new infrastructure.
### Motivation:
* The current matrix workflow has the limitation that it only supports
pre-defined sets of variables which are explored in the test matrix. At
the moment this is a pre-defined set of Swift versions on Linux and
Windows.
* Adding more means hard-coding them at multiple levels of the workflow
hierarchy.
* Currently skipped Windows matrix jobs show up as successes in the
GitHub UI leading to a misleading impression of good coverage.
### Modifications:
Introduce and adopt a new method for defining test matrices,
`swift_test_matrix.yml`. The new method is based around the approach of
defining the test matrix via a JSON object which may be supplied via an
input string from another workflow or from a file on-disk in a
repository.
Taking this approach means that we have the ability to add new targets
to the matrix simply by adding new elements to the JSON array,
increasing flexibility and the scope for future growth.
The unit tests, Cxx interop and benchmarks workflows are all modified to
use the new approach, this opts-in all downstream adopters. This should
be transparent to all downstream adopters.
In order to unify the Linux and Windows jobs I removed the use of the
`container:` GitHub Actions affordance in the Linux jobs which
transparently means all steps are executed within the nested container.
Instead we must manually call in to the docker container which
complicates scripting a little. I tested to see if doing this slowed
down the jobs (perhaps GitHub was caching the docker images more
intelligently) but it does not.
This approach follows the pattern of @FranzBusch 's open PR
https://github.com/apple/swift-nio/pull/2942
### Result:
* More flexible test matrix definitions
* No more false-passes for disabled Windows targets
### Motivation:
We have some tests for our Vsock support that only run when we detect
the system supports Vsock. These weren't running in CI but, now we've
migrated CI to GitHub Actions, they can. In prototyping this though, I
discovered that one of our tests was too strict, and will fail for VMs
running on Hyper-V, which is the hypervisor used by GitHub actions.
Specifically, we have support for getting the local context ID by a
channel option. This is implemented by an ioctl, but the semantics of
the return value differ between the various Vsock transport kernel
modules:
- `virtio_transport`: returns the guest CID, which is a number greater
than `VMADDR_CID_HOST`, but less than `VMADDR_CID_ANY`, and returns
`VMADDR_CID_ANY` as an error.
- `vsock_loopback`: returns `VMADDR_CID_LOCAL` always.
- `vmci_transport`: returns the guest CID if the guest and host
transport are active; `VMADDR_CID_HOST` if only the host transport is
active; and `VMCI_INVALID_ID` otherwise, which happens to be the same
value as `VMADDR_CID_ANY`.
- `hyperv_transport`: returns `VMADDR_CID_ANY` always.
For this reason, we should probably remove any attempts to interpret the
validity of the value that comes back from the driver and users will
need to know what to do with it.
### Modifications:
- tests: Only run Vsock echo tests on Linux, when `vsock_loopback` is
loaded.
- tests: Remove asserts on the value of local Vsock CID.
- ci: Add pipeline that runs Vsock tests.
### Result:
- Vsock tests will no longer run unless `vsock_loopback` kernel module
is loaded.
- Vsock tests will no longer fail in Hyper-V VMs.
- Vsock tests will now run in CI.
### Motivation:
Documentation checking catches more issues in Swift 6.0.
### Modifications:
Adopt the Swift 6.0 image and fix the errors.
### Result:
More accurate docs.
# Motivation
Our support strategy includes the last three released Swift versions.
After the recent release of Swift 6 this means we now support 5.9, 5.10
and 6.0.
# Modification
This PR updates our CI configuration and scripts to align with our
supported Swift versions.
# Result
Up to date CI coverage.
# Motivation
Switch to the reusable workflows from the swiftlang organization for
soundness.
# Modification
This PR moves over to the new reusable soundness workflow. Additionally,
it also deletes all files in this repo for the soundness checks since
they are no longer needed.
### Motivation:
This repo contains reusable workflows, intended for use in _other_
repos. Right now, some of these reusable workflows are nested, i.e. some
of the YAML files refer to other YAML files in the repo by a relative
path.
Unfortunately, this makes them currently unusable locally with `act`
because of https://github.com/nektos/act/issues/1875.
For now, it appears the only workaround is to have these referred to
without the local, relative path.
### Modifications:
Use the remote syntax for referencing nested workflows.
### Result:
Commands like `act -j unit-tests` will work in repos that aren't NIO
itself.
---------
Co-authored-by: Franz Busch <privat@franz-busch.de>
# Motivation
We want to check how our packages perform in Swift 6 language mode.
# Modification
This PR adds a new reusable workflow that sets the tools version to Swift 6 and then builds with warnings as errors enabled.
Additionally, I did a bit of cleanup for the workflow names to hopefully make them look nice in every GH Action UI.
# Result
We now get a feeling for our Swift 6 language mode compatibility.
* Apply formatting
* Apply no block comments rule
* Apply OmitExplicitReturns
* Apple OnlyOneTrailingClosureArgument
* Apply NoAssignmentInExpressions
* Fix up DontRepeatTypeInStaticProperties lint errors
* Apply `OrderedImports`
* Apply `ReplaceForEachWithForLoop`
* format file
* Enable the formatting pipeline
* Adopt `AmbiguousTrailingClosureOverload`
* Fix license header
* Fix format check
* Fix `EndOfLineComment`
* Fix CI
* Adapt CI script to check if changes when running formatting
* Separate lint and format into to steps
* Fix format
* Adopt `UseEarlyExits`
* Revert "Adopt `UseEarlyExits`"
This reverts commit d1ac5bbe12.
Motivation:
The Swift 6 compiler emits a number of warnings about sendability which
we haven't dealt with yet. The CI failing on warnings may mask other
compilation issues or test failures.
Modifications:
- Disable warnings as errors on Swift 6 and main
Result:
Swift 6 and main CI should pass
# Motivation
Another reusable check is to make sure that all library products of a package are successfully building when consumed from a module that has Cxx interoperability enabled. Another check that's missing is running the integration tests.
# Modification
This PR adds two new checks to the reusable workflow. One to check for Cxx interoperability compatibility and another one to run the integration tests. I also fixed a misalgined name for the nightly benchmarks.
# Result
This should be one of the last reusable workflow checks.
* [GHA] Introduce reusable matrix workflow
# Motivation
We have a few checks that we want to run across all supported Swift versions e.g. unit tests and benchmarks. Right now we already added two matrix based jobs to the reusable workflow. This leads to a lot of duplication and harder maintenance.
# Modification
This PR splits off the current reusable workflow to only contain soundness related checks and introduces a new reusable matrix based workflow which can be customized to execute different commands.
# Result
It is now easy to setup multiple matrix based workflows.
* Code review
* Change nightly next
# Motivation
The next two reusable checks that we need to create are for broken symlinks and formatting. The latter is disabled for this repo for now since we need to discuss the formatting rules separately.
# Modification
This PR adds two new checks - broken symlinks and formatting.
# Result
Closer to having everything on GitHub actions.
* [GHA] Add license header check
# Motivation
We need to make sure all code files have the appropriate license headers in place. This is currently part of the soundness check and we need to replace this with a GH action.
# Modification
Adds a new job to the reusable workflow the check all files for license headers. Since some files are ignored every repo can specify a `.licenseignore` file.
# Result
Last part of the soundness script migrated.
* Review
* Remove default excludes
# Motivation
In the future, we want to share the workflow definition across multiple repos to avoid duplication.
# Modification
This PR extracts the current workflow definition into a reusable workflow and calls the reusable workflow from a new workflow that is triggered on PR events. The new reusable workflow starts off with a few simple inputs to enable/disable the three current jobs. By default all jobs are enabled.
# Result
First step into reusability of our workflow.