Commit Graph
25 Commits
Author SHA1 Message Date
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 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 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 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
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 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
Franz Busch 290b349e2c [CI] Fix python lint (#2925)
# Motivation

Fix the python lint check.

# Modification

This PR fixes all the warnings related to the new python lint check.

# Result

Only green CI.
2024-10-17 09:57:40 +00:00
Franz Busch c16420c4a7 [CI] Migrate to Swift 6.0 and drop 5.8 (#2920)
# 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.
2024-10-14 16:07:49 +01:00
Franz Busch 8bcc35d062 [CI] Switch to reusable soundness (#2913)
# 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.
2024-10-11 12:53:16 +01:00
Si BeaumontandFranz Busch 1109474e9d ci: Refer to nested reusable workflows using remote variant (#2884)
### 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>
2024-09-20 14:32:49 +00:00
Franz Busch b6a6e430df [CI] Add Swift 6 language mode workflow (#2812)
# 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.
2024-07-26 13:14:34 +01:00
Franz Busch 1d25937c97 [GHA] Make unit tests, benchmarks and cxx interop easier to reuse (#2801) 2024-07-24 12:15:17 +02:00
Franz Busch c9756e1083 Adopt swift-format (#2794)
* 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.
2024-07-19 11:48:17 +02:00
George Barnett 980bd3e630 Disable warnings as errors on Swift 6 and main (#2793)
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
2024-07-18 12:10:50 +00:00
Franz Busch 8a69bd9d88 [GHA] Cxx interoperability compatibility and integration tests check (#2790)
# 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.
2024-07-16 01:22:04 -07:00
Franz Busch b1bf036143 [GHA] Introduce reusable matrix workflow (#2789)
* [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
2024-07-15 18:07:03 +01:00
Franz Busch eea0f74cb2 [GHA] Broken symlink and format check (#2787)
# 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.
2024-07-12 12:58:37 +01:00
Franz Busch 654bf41c03 [GHA] Add license header check (#2781)
* [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
2024-07-12 03:07:06 -07:00
Franz Busch 86316020a5 [GHA] Benchmark job (#2780) 2024-07-11 03:23:24 -07:00
Franz Busch 96149964cb [GHA] Create reusable workflow (#2767)
# 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.
2024-07-05 01:47:12 -07:00