Commit Graph
144 Commits
Author SHA1 Message Date
Rick Newton-Rogers 56310b526c Execute swift --version in shared workflows (#3247)
### 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
2025-05-15 17:35:26 +01:00
Rick Newton-Rogers 1d1f47b5f9 Revert "Print the swift version in Linux matrix jobs" (#3245)
Reverts apple/swift-nio#3241 This is breaking Static SDK jobs
2025-05-15 15:23:31 +00:00
George Barnett 9e1ec21900 Revert "Remove default setup command for Xcode 16.2 (#3242)" (#3244)
This reverts commit 774c09975a.
2025-05-15 15:58:36 +01:00
George Barnett 774c09975a Remove default setup command for Xcode 16.2 (#3242)
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.
2025-05-15 10:08:42 +00:00
Rick Newton-Rogers c1542f0201 Print the swift version in Linux matrix jobs (#3241)
Print the output of `swift --version` in Linux matrix jobs before we do
any other work to aid in debugging
2025-05-15 10:36:59 +01:00
Rick Newton-Rogers 05f64f4644 Update macos_tests.yml to limit run time to 30 minutes (#3240)
Update macos_tests.yml to limit run time to 30 minutes - in the future
this should be configurable
2025-05-14 13:58:09 +01:00
Rick Newton-Rogers d8b0dbeb4d Enable visionOS xcodebuilds by default in CI - attempt 2 (#3238)
### 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
2025-05-13 14:01:50 +00:00
Rick Newton-Rogers 7ed5a41281 Macos setup command (#3236)
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
2025-05-13 11:12:35 +01:00
Rick Newton-Rogers 34d486b01c Revert "Enable visionOS xcodebuilds by default in CI" (#3235)
Reverts apple/swift-nio#3234

This seems to have caused some instability which I'll investigate so we
should revert for now.
2025-05-09 14:40:35 +01:00
Rick Newton-Rogers 00fedd68f4 Enable visionOS xcodebuilds by default in CI (#3234)
### 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`
2025-05-08 10:26:40 +01:00
Rick Newton-Rogers c78bc87f8f Disable Swift 5.9 CI jobs by default (#3233)
### 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
2025-05-08 08:37:40 +01:00
Rick Newton-Rogers 57658e12ff Drop Swift 5.9 (#3228)
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.
2025-05-07 12:24:44 +00:00
Rick Newton-Rogers b8c446368d Add and enable Swift 6.1 workflows (#3196)
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)
2025-04-11 13:45:49 +01:00
Rick Newton-Rogers 5a9130b5c2 Static SDK installation script improvements (#3186)
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
2025-04-08 14:27:30 +00:00
Rick Newton-Rogers 350794f229 uncomment visionOS CI tasks (#3176)
### 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
2025-04-04 14:01:18 +01:00
Rick Newton-Rogers b3704d764b Add support for Xcode 16.3 (#3171)
### 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
2025-04-03 10:32:50 +01:00
Rick Newton-Rogers be80eb6e5d macOS CI pools (#3163)
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
2025-04-01 10:35:17 +02:00
Rick Newton-Rogers 213cc0b894 Separate build and test steps in macos_tests.yml (#3162)
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.
2025-03-31 14:19:42 +00:00
Rick Newton-Rogers 6ff70b5555 Update macOS CI workflow (#3150)
### 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
2025-03-20 09:42:18 +00:00
Rick Newton-Rogers dc06cf85f3 install jq, use correct quotes (#3145)
install jq, use correct quotes.

Running this locally in `act` highlighted that it was always failing to
find `jq`
2025-03-14 16:24:46 +00:00
Rick Newton-Rogers 4582f55c0d A re-usable CMake check workflow (#3144)
### 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
2025-03-14 15:09:21 +00:00
Rick Newton-Rogers cb26862c5d Make static SDK curl for setup script (#3142)
### 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.
2025-03-13 09:52:25 +00:00
Rick Newton-Rogers af7d4e081f Remove macOS CI shim (#3143)
Remove macOS CI shim which was needed so that the PR yaml would parse
and execute tests.
2025-03-13 09:34:26 +01:00
Rick Newton-Rogers f2f36afb19 Experimental macOS CI (#3141)
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.
2025-03-12 20:19:19 +00:00
Rick Newton-Rogers 2de70653ce A re-usable static SDK compilation workflow (#3019)
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
2025-03-10 10:04:15 +00:00
Rick Newton-RogersandCory Benfield c93873b546 Populate CI env var in swift_test_matrix.yml (#3125)
Populate `CI` env var in `swift_test_matrix.yml` so that test scripts
can tell they are being run in CI. See
https://github.com/apple/swift-nio/pull/3123#issuecomment-2684489291

Co-authored-by: Cory Benfield <lukasa@apple.com>
2025-03-03 16:04:19 +00:00
Rick Newton-Rogers 0f794a4979 Update re-usable workflows to use nightly_next (#3122)
### 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
2025-03-03 13:07:39 +00:00
Rick Newton-Rogers ad3cbecb3c Expose GITHUB_ACTIONS env var to docker containers (#3123)
### 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
2025-02-26 10:03:07 +00:00
Rick Newton-Rogers 42bea78572 Simplify Windows matrix command invocation (#3118)
Simplify Windows matrix command invocation

### Motivation:

The existing invocation hid command execution failures.

### Modifications:

Removed the powershell invocation layer.

### Result:

Failing commands result in workflow failures as expected.

I tested this by pointing CI pipelines to this branch.
* Example of a workflow expected to pass passing:
https://github.com/apple/swift-log/actions/runs/13331113564/job/37235228530?pr=350
* Example of a workflow expected to fail failing:
https://github.com/apple/swift-nio/actions/runs/13331079601/job/37235122359?pr=3118
2025-02-14 15:43:15 +00:00
Rick Newton-Rogers 577e893f7e Update the legacy CI matrix for 6.1 nightly (#3094)
### 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.
2025-01-31 13:17:51 +00:00
Rick Newton-Rogers 9336e1f259 more 6.0 nightly to 6.1 nightly CI changes (#3078)
### 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
2025-01-22 13:38:02 +00:00
Rick Newton-Rogers 5595698895 Update nightly CI pipelines to 6.1 instead of 6.0 (#3076)
### Motivation:

Active development has moved to 6.1 so the Swift 6.0 nightlies no longer
deliver much value.

### Modifications:

* Deprecate 6.0 nightly CI configuration parameters
* Introduce new 6.1 nightly CI configuration parameters
* Update the matrix generation script to handle 6.1
 
### Result:

* No more nightly 6.0 CI, 6.1 nightlies are introduced.
* Configuration for 6.0 nightlies no longer has any effect.
* All repos are automatically opted-in to 6.1 nightly linux pipelines
**even if they opted out of 6.0**.
2025-01-22 08:26:58 +00:00
Franz Busch 7dea8e7ad1 Update release.yml and label action (#3035)
Update the release.yml file with the latest label changes
2024-12-18 11:51:53 +00:00
Rick Newton-Rogers 969b06b844 rename top matrix workflow object 'swift'->'config' (#3024)
### Motivation:

The use of 'swift' here is very arbitrary and adds no value. The object
is only there at all because GitHub Actions seems to require it.

### Modifications:

Rename the top-level object from 'swift' to 'config' to maybe add value
to the intent of the object and hopefully be less cryptic.

### Result:

Everything should just keep working.
2024-12-13 14:50:27 +01:00
Rick Newton-Rogers 74f767454f GHA: Separate matrix input handling (#3018)
### Motivation:

The new test matrix workflow is quite verbose in the most common case,
unit tests, outputting two workflow entries for handling and preparing
the matrix inputs.

In addition to this, it appeared that when running in `act` the matrix
preparation step would run multiple times.

### Modifications:

* Prioritize the current most common case, string inputs, and skip the
matrix preparation step in this case reducing the number of workflows
run.
* Separate the path for loading the JSON matrix from a file into its own
workflow.

### Result:

* Less noise in the output
* More reliable and efficient local matrix runs
2024-12-05 15:03:53 +00:00
Rick Newton-Rogers 234ea1051f Re-usable workflows curl scripts (#3017)
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
2024-12-05 09:22:20 +00:00
Rick Newton-Rogers 692cf0a7b8 Matrix workflows refer to main branch (#3016)
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.
2024-12-05 08:47:27 +00:00
Rick Newton-Rogers d3e8c8c67d Introduce JSON matrix workflow (#3013)
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
2024-12-05 08:23:51 +00:00
Franz Busch 8a1523fb1a Aligning semantic version label check name (#3007) 2024-11-28 15:20:37 +01:00
Johannes WeissandCory Benfield 49b9d9725e fix remaining warnings & enable -warnings-as-errors in CI (#3000)
### Motivation:

Warnings are annoying.

### Modifications:

- Remove unnecessary use of `Foundation.Thread` which isn't Sendable.
- Remove now unnecessary `@retroactive`s.
- Enable `-warnings-as-errors` in CI

### Result:

- Warnings can't sneak in as easily anymore
- No more warnings left in `swift-nio`

```
$ rm -rf .build/arm64-apple-macosx/ && swift build --build-tests -Xswiftc -warnings-as-errors > /dev/null
echo $?
$ echo $?
0
```

Co-authored-by: Cory Benfield <lukasa@apple.com>
2024-11-26 16:02:36 +00:00
Si Beaumont 64eb8bfeb0 tests: Remove asserts on the value of local Vsock CID (#2975)
### 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.
2024-11-21 10:33:24 +00:00
Rick Newton-RogersandGeorge Barnett 49bc87a888 remove unused Swift 6 language mode workflow (#2976)
remove unused Swift 6 language mode workflow

Co-authored-by: George Barnett <gbarnett@apple.com>
2024-11-15 13:10:57 +00:00
Rick Newton-Rogers 5ffd8d7cf4 unify scheduled and main yamls (#2972) 2024-11-15 10:09:47 +00:00
Franz Busch 2139438dda Fix SemVer major label check (#2970) 2024-11-12 13:35:26 +00:00
Rick Newton-Rogers adfd61adc5 Use Swift 6.0 docs pipeline (#2966)
### 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.
2024-11-07 13:03:47 +00:00
Peter Adams 062b28eeb0 Checkout any submodules when running Actions (#2946)
Motivation:

Some repos using this as their source of GitHub Actions logic have
submodules.

Modifications:

Change workflows to checkout submodules.

Result:

All CI will work cleanly
2024-10-24 10:38:16 +01:00
Franz Busch be823e6d1e [CI] Fix the Windows 6.0 check name (#2941)
# Motivation

Currently, the Windows 6.0 check name includes the matrix properties.

# Modification

This PR makes it dynamic with the swift version again.

# Result

Aligned CI check names across platforms.
2024-10-23 08:39:34 +00:00
Franz Busch 6d24ab0222 [CI] Enable benchmarks & cxx Windows CI (#2940)
This PR makes it possible to enable benchmarks and cxx interop checks on
Windows. By default they are turned off. This PR also fixes the job of
the Windows 6 pipeline which was broken since single configuration
matrix jobs seem to behave differently.
2024-10-23 09:38:21 +02:00
Franz Busch ecbb5ea78a [CI] Small adjustments to the Windows actions (#2939)
# Motivation

There were two small problems:
1. The CI for the nightlies wasn't properly skipped
2. The name for the matrix wasn't applied in the case where it was
skipped

# Modification

This PR hopefully fixes both issues.
2024-10-22 10:36:48 +01:00
Franz Busch ff6dea9d11 [CI] Add Windows matrix build (#2929)
# Motivation

In the long term we want to add support for Windows in our Swift
packages. To do this we need a CI setup to ensure that our packages are
building and the tests are passing.

# Modification

This PR adds a windows job to our swift matrix that installs Swift on
the runner and then uses Swift PM to build and test the package. Windows
jobs are disabled by default since most of our packages require some
work to add Windows support.

# Result

We have a Windows CI pipeline that allows us to verify that our packages
are working.
2024-10-22 08:53:24 +00:00