160 Commits
Author SHA1 Message Date
Charles Zablit ae78c343cd Honor CMAKE_VERSION in cmake-build.sh by downloading the requested CMake release (#3795)
`cmake_tests.yml` has a `cmake_version` input and passes it to
`scripts/cmake-build.sh` as `CMAKE_VERSION`, but the script does not use
that value, so the CMake from the image's apt is used instead.

With this patch, when `CMAKE_VERSION` is set, the script downloads the
release from Kitware's GitHub releases on Linux (x86_64/aarch64) and
uses it for the build.

This lets projects that need a newer CMake than the image's apt provides
use the shared workflow by setting `cmake_version`.

This is blocking https://github.com/apple/swift-certificates/pull/325.
2026-11-19 13:39:35 +00:00
Gus Cairo 59dc223726 Reenable 6.1 workflows by default (#3760)
Reenable 6.1 CI workflows by default.

### Motivation:

6.1 workflows were disabled by default in
https://github.com/apple/swift-nio/commit/d09ffc8ad6437bc278897279e33150d8e39ee3d5.
However, we haven't been able to drop 6.1 in all repos using these
workflows yet, so this PR temporarily reenables the 6.1 workflows until
we can land that work everywhere else.

### Modifications:

Reenable 6.1 CI workflows by default.

### Result:

6.1 workflows are enabled by default.
2026-10-07 13:39:43 +00:00
Gus Cairo d09ffc8ad6 Disable Swift 6.0 and 6.1 workflows by default (#3755)
This change disables Swift 6.0 and 6.1 workflows by default, as support
for 6.4 has been enabled by default.
2026-09-30 16:46:05 +01:00
Gus Cairo 3d1ee9d45a Add and enable 6.4 workflows (#3750)
### Motivation

* Swift 6.4 has been released, so we should add it to our CI coverage.

### Modifications

* Update `apple/swift-nio/scripts/generate_matrix.sh`
* Update `apple/swift-nio/scripts/check-matrix-job.sh`
* Update reusable adopters of `swift_test_matrix.yml`
* Update end-user adopter workflows of `swift_test_matrix.yml`
* Add Swift 6.4 inputs to `macos_tests.yml` and `macos_benchmarks.yml`
* Add a 6.4 release job to `wasm_swift_sdk.yml`
* Enable the Windows 6.4 unit test job in `main.yml` and
`pull_request.yml`
* Copy benchmark thresholds from 6.3

### Result

* NIO runs Swift 6.4 CI, and downstream repositories can opt-in.

---

- Successful run (minus broken nightlies):
https://github.com/apple/swift-nio/actions/runs/36403423635?pr=3750
2026-09-30 10:05:07 +01:00
Honza Dvorsky 8c063f043d Android CI builds shouldn't link the stdlib statically (#3739)
### Motivation:

We started seeing issues in Swift Log with building for Android when
using types from the Concurrency module.

Folks from the Android workgroup suggested we don't build with static
stdlib, and I confirmed that removing it fixes the issue:
https://github.com/apple/swift-log/actions/runs/34365246956/job/102512196662?pr=509

### Modifications:

Links the stdlib dynamically (default) for Android.

### Result:

Unblock Swift Log's CI. This topic can be further discussed in the
ongoing GitHub Actions unification.
2026-09-09 15:08:30 +00:00
Honza Dvorsky 6687d06032 Fix Android Swift SDK installation in CI workflows (#3737)
### Motivation:

In October 2025, the naming convention for the file name of the Android
Swift SDK changed to drop the version. Our script expected it however,
so all SDK bundles published after that were getting skipped, which has
now caused other problems.

### Modifications:

Fixed the Android SDK file suffix.

However, this is only an immediate fix. A proper fix, which is out of
scope of this PR, will be to adopt the explicit "download" parameter in
the API
(https://www.swift.org/openapi/openapi.html#/Toolchains/listAndroidSDKDevToolchains),
which gives us the filename and we don't have to guess.

### Result:

Projects start downloading up-to-date Android Swift SDKs again.
2026-09-09 07:21:15 +00:00
61a7fe1bda fix(ci): fix static Linux SDK version discovery for main snapshots (#3726)
Fix static Linux SDK snapshot resolution falling back to outdated
versions.

### Motivation:

The `main` job of the static Linux SDK matrix has been resolving
snapshots from over a month ago instead of recent nightlies.
`scripts/install_swift_sdk.sh` hardcodes the static-sdk artifact suffix
as `_static-linux-0.0.1`, but swift.org now publishes it as `0.1.0`.
Every recent snapshot 404s on the SDK URL, so the discovery loop keeps
rejecting them until it lands on a December snapshot that still used the
old suffix.

Fixes #3711

### Modifications:

`scripts/install_swift_sdk.sh` now tries a small list of known
static-sdk suffixes (`0.1.0`, then `0.0.1`) for each candidate snapshot
instead of a single hardcoded value, and stops at the first one that
resolves. The existing snapshot/SDK return-code checks and logging are
unchanged.

### Result:

The `main` branch job picks up current nightly snapshots again instead
of falling back 40+ days. If Apple bumps the static SDK version again in
the future, adding it to the candidate list is a one-line fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Rick Newton-Rogers <rnro@apple.com>
2026-09-07 12:56:15 +00:00
Cory Benfield 404f732619 Explicitly add ncurses to the dependency list. (#3640)
Motivation:

We should be explicit about our dependencies, and not allow them to be
satisfied by transitive deps.

Modifications:

Add ncurses

Result:

More explicitness
2026-06-25 10:59:17 +00:00
Si Beaumont 7586225bc1 Bump nightly-next CI Linux and Windows pipelines to Swift 6.4 (#3619)
### Motivation:

The CI pipelines offer the latest released Swift versions (which have
included Swift 6.3 for some time now) and
a nightly-main and nightly-next. Right now nightly-next pipelines are
all still 6.3, which is a problem and folks are
likely operating under the misguided assumption that they have 6.4
coverage in their pipelines.

### Modifications:

- Update the nightly-next pipelines to use 6.4 nightly images

### Result:

Nightly next pipelines moved to 6.4
2026-06-08 11:42:53 +01:00
Rick Newton-Rogers 158030ef53 Support multiple benchmark packages per macOS workflow invocation (#3602)
### Motivation

* External callers of `macos_benchmarks.yml` (e.g. swift-log) currently
invoke the reusable workflow once per benchmark package, paying
self-hosted macOS runner-recycling cost for each invocation.

### Modifications

* Add a new `benchmark_package_paths` input to
`.github/workflows/macos_benchmarks.yml` and mark the singular
`benchmark_package_path` as deprecated. The run step forwards both
inputs straight to the script via `BENCHMARK_PACKAGE_PATH` and
`BENCHMARK_PACKAGE_PATHS` environment variables; the workflow itself
does no path parsing.
* Teach `scripts/check_benchmark_thresholds.sh` to accept
`BENCHMARK_PACKAGE_PATHS` as either a JSON array of strings
(auto-detected by a leading `[`, requires `jq`) or a newline-separated
list, falling back to the legacy `BENCHMARK_PACKAGE_PATH` when unset or
when the JSON form is an empty array.
* The script now loops over the resolved package list, wraps each
iteration in a GitHub Actions `::group::`, and emits an `::error::`
summary listing failed packages at the end, exiting non-zero if any
failed.

### Result

* A single workflow invocation runs all listed packages serially on each
Swift/Xcode runner, paying runner-recycling cost once per Swift version
instead of once per (version x package).
* Existing single-package callers keep working unchanged.
* Adopters of the script in other contexts (e.g. the Linux
`benchmarks.yml`) can pick up multi-package support by passing
`BENCHMARK_PACKAGE_PATHS` without reimplementing parsing or
failure-collection logic.

An example of this working https://github.com/apple/swift-log/pull/466
2026-05-21 10:47:48 +01:00
32e3d86379 Add multi-version matrix support to Wasm Swift SDK workflow (#3575)
Add multi-version matrix support to Wasm Swift SDK workflow

### Motivation:

The WASM CI only ran against nightly-main, making it impossible to
distinguish toolchain regressions from code issues. Other repos in the
ecosystem using `swiftlang/github-workflows` already test against
`nightly-main`, `nightly-6.3`, and `6.3` by default.

### Modifications:

- Add `nightly_main_enabled`, `nightly_6_3_enabled`, and
`release_6_3_enabled` boolean inputs to `wasm_swift_sdk.yml` (all
defaulting to `true`, matching the coverage of
`swiftlang/github-workflows/swift_package_test.yml`) and update the
matrix generation to emit the appropriate entry per enabled version.
- Update `install_swift_sdk.sh` to support non-main branch snapshots by
deriving the API and download paths from `INSTALL_SWIFT_BRANCH` rather
than hardcoding `main`/`development`.
- Fail early with a clear message if the branch snapshot API returns no
results, rather than hitting an unbound variable error.

### Result:

WASM builds are now tested against multiple Swift versions, providing a
stable baseline to identify nightly-only regressions. Callers using the
workflow without arguments get the new default coverage automatically;
those who want to narrow the matrix can set specific version inputs to
`false`.

---------

Co-authored-by: Rick Newton-Rogers <rnro@apple.com>
Co-authored-by: Cory Benfield <lukasa@apple.com>
2026-04-21 14:48:51 +00:00
Si Beaumont d36223d82c Add support for --security-opt docker flags in custom CI jobs (#3580)
### Motivation:

A recent PR (#3574) added support for customising the container
environment used for the matrix job for users of the reusable workflow.
It supported a custom Dockerfile and controlling `--cap-add` options to
the `docker run` command. Users who require this fine-grained control
with `--cap-add` also will benefit from being able to control the
`--security-opt` of the `docker run` command.

### Modifications:

- Add support for `--security-opt` docker flags in custom CI jobs

### Result:

Users of the reusable matrix CI workflow can control the
`--security-opt` for the container.
2026-04-21 15:38:44 +02:00
Rick Newton-Rogers 24e17eebb1 Support custom Dockerfiles and Docker capabilities in matrix CI (#3574)
### Motivation

* Some consumers need to run CI inside custom Docker images with
additional Linux capabilities. The shared matrix workflows had no way to
express this — consumers had to maintain entirely bespoke CI workflows
instead.

### Modifications

* Added `MATRIX_LINUX_DOCKERFILE` and
`MATRIX_LINUX_DOCKER_CAPABILITIES_JSON` environment variables to
`generate_matrix.sh`. These propagate as `dockerfile` (string) and
`docker_capabilities` (JSON array) fields in the matrix JSON. Defaults
are empty/`[]` so existing callers are unaffected.
* Extended `add_matrix_entry()` with two optional trailing parameters
for the new fields.
* In `swift_test_matrix.yml`:
- Made the "Pull Docker image" step conditional — skipped when a
`dockerfile` is provided.
- Added a "Build Docker image from Dockerfile" step that builds the
image with `--build-arg SWIFT_IMAGE=<matrix image>` so consumers can
parameterise the Swift base image.
- Added `--cap-add` flags to `docker run` when `docker_capabilities` is
non-empty.

### Result

* Consumers can set `MATRIX_LINUX_DOCKERFILE` to a repo-relative path
and `MATRIX_LINUX_DOCKER_CAPABILITIES_JSON` to a JSON array of
capabilities. The matrix will build their Dockerfile per Swift version
and run containers with the requested capabilities.
* Existing consumers that don't set these variables see no change.
2026-04-14 15:40:21 +01:00
Rick Newton-Rogers 5f6f878feb Update nightly container images from jammy to noble (#3573)
### Motivation

* The nightly Swift container images were still using `jammy` (Ubuntu
22.04) while the release images for 6.2+ have moved to `noble` (Ubuntu
24.04). We should align them.

### Modifications

* Changed `linux_nightly_next_container_image` and
`linux_nightly_main_container_image` in `generate_matrix.sh` from
`-jammy` to `-noble`.

### Result

* Nightly CI jobs now use noble-based images, consistent with the 6.2+
release images.
2026-04-13 08:52:39 +00:00
Raphael 4be5ac5872 Add newline to avoid broken source files (#3570)
### Motivation:

An upcoming change in the library template adds a code snippet. Since
our cxx interop compatibility test script does not account for that
tests fail on nightly.

### Modifications:

Insert a newline character before other modifications.

### Result:

The cxx interop compatibility tests pass again on nightly.
2026-04-07 15:18:10 +00:00
Rick Newton-Rogers d80f3bac98 Add and enable Swift 6.3 workflows (#3565)
### Motivation

* Swift 6.3 has been released, we should add it to our CI coverage.

### Modifications

* Update `apple/swift-nio/scripts/generate_matrix.sh`
* Update `apple/swift-nio/scripts/check-matrix-job.sh`
* Update reusable adopters of `swift_test_matrix.yml`
* Update end-user adopter workflows of `swift_test_matrix.yml`
* Remove stale `NIGHTLY_6_1` fallback shims from `generate_matrix.sh`
* Migrate `linux_nightly_6_1_arguments_override` to
`linux_nightly_next_arguments_override` in `main.yml` and
`pull_request.yml`
* Copy benchmark thresholds from 6.2

### Result

* NIO tests against Swift 6.3 in CI and downstream repositories can
opt-in.
 

* A successful run using the new Swift 6.3 jobs:
https://github.com/apple/swift-nio/actions/runs/23841350537/job/69497505715?pr=3565
2026-04-01 13:06:15 +02:00
Rick Newton-Rogers 1e51266e86 Static sdk version (#3534)
Fix static Linux SDK version hardcoding

### Motivation

* Nightly CI was failing with a checksum mismatch because the static
Linux SDK filename was hardcoded to `_static-linux-0.0.1`, but the
SDK has since been released as `0.1.0` with a different checksum.
* The swift.org releases API returns a `version` field alongside
the checksum for the `static-sdk` platform, so the version can be
resolved dynamically.

### Modifications

* Added `extract_static_sdk_version()` to read the `version` field from
the releases API response.
* In the `version` install path, override `sdk_suffix` with the
API-provided version rather than the hardcoded `0.0.1`.

### Result

* The correct SDK filename (`_static-linux-0.1.0`) is now resolved
and hopefully will continue to work for future version bumps.
2026-03-03 11:36:58 +01:00
Rick Newton-Rogers 79404950fa Scope benchmark threshold diff to Thresholds/ directory (#3529)
### Motivation

* `check_benchmark_thresholds.sh` runs `git add --intent-to-add .` and
`git diff HEAD` to show updated threshold files when benchmarks regress.
* The unscoped `.` caused the diff to include everything in the working
tree, including the `.build` directory, producing noisy output.

### Modifications

* Pass `${benchmark_package_path}/Thresholds/` to both `git add
--intent-to-add` and `git diff HEAD --` so only threshold files appear
in the diff.

### Result

* The diff printed on benchmark failure shows only threshold file
changes.
2026-02-27 15:10:34 +00:00
Rick Newton-Rogers 92daddf89b Disable Swift 5.10 CI jobs by default (#3528)
### Motivation

* Swift 5.10 is no longer actively supported and CI does not require it

### Modifications

* Default Swift 5.10 CI jobs to disabled

### Result

* Swift 5.10 CI jobs will not run unless opted-in
2026-02-27 14:38:11 +00:00
Rick Newton-Rogers 8f6f8361ff benchmark diff missing new threshold files (#3516)
### Motivation

* When threshold files don't exist yet, `thresholds update` creates new
untracked files. `git diff HEAD` only shows changes to tracked files, so
newly created threshold files were silently omitted from the diff.

### Modifications

* Run `git add --intent-to-add .` before `git diff HEAD` so that
untracked files are registered in the index and appear in the diff
output without staging their contents.

### Result

* The diff output now includes newly created threshold files.
2026-02-23 13:29:00 +00:00
Rick Newton-Rogers 83b0fcd82d Benchmark diffs not being output on threshold regression (#3515)
### Motivation

* `check_benchmark_thresholds.sh` was updated to check for exit code 2
from `swift package benchmark thresholds check` to distinguish threshold
regression from build errors.
* It seems SwiftPM's `CommandPlugin` infrastructure always exits with
code 1 when `performCommand` throws, regardless of the error's raw
value. So the exit code is never 2, causing all regressions to fall
through to the `else` branch and be misreported as build errors, with no
diff output.

### Modifications

* Remove the `rc == 2` check and instead attempt `thresholds update` for
any non-zero `rc` from `thresholds check`.
* Use the result of `thresholds update` to distinguish regression
(success) from build error (failure).
* Remove `--exit-code` from `git diff` to prevent `set -uo pipefail`
from aborting the script before output is fully flushed.

### Result

* Benchmark threshold regressions correctly output the `=== BEGIN DIFF
===` section again.
* Actual build errors are still correctly detected and reported.
2026-02-20 15:54:04 +00:00
Fabian Fett 2fdda6c78e Fix benchmark succeeding – even though Benchmark build failed (#3502)
### Motivation:

Currently if there is an error in the Benchmark targets, that prevents
the Benchmark to build correctly, we still get a CI success.

### Modifications:

- Check for the threshold changed error

### Result:

- More reliable CI
2026-02-17 10:30:44 +00:00
Si Beaumont c329d1e173 Fix C++ interop CI script to work with changes in SwiftPM (#3510)
### Motivation:

SwiftPM behaviour has changed in recent Swift nightlies.

In most recent released version of Swift, SwiftPM will use the parent
directory name for the source and test target directory too, even when
it contains a period:

```
% docker run -it swift:6.2 bash -c 'mkdir -p /tmp/foo.bar && cd /tmp/foo.bar && swift package init'
Creating library package: foo.bar
Creating Package.swift
Creating .gitignore
Creating Sources
Creating Sources/foo.bar/foo_bar.swift
Creating Tests/
Creating Tests/foo.barTests/
Creating Tests/foo.barTests/foo_barTests.swift
```

Note in the above how it replaces the `.` with a `_` in the source
files, but the directories retain the `.`.

In the recent nightly-main, SwiftPM has also started replacing `.` with
`_` in the target directory names:

```
% docker run -it swiftlang/swift:nightly-main bash -c 'cat /etc/motd && mkdir -p /tmp/foo.bar && cd /tmp/foo.bar && swift package init'
################################################################
#                                                              #
# Swift Nightly Docker Image                                   #
# Tag: swift-DEVELOPMENT-SNAPSHOT-2026-02-06-a                 #
#                                                              #
################################################################
Creating library package: foo.bar
Creating Package.swift
Creating .gitignore
Creating Sources
Creating Sources/foo_bar/foo_bar.swift
Creating Tests/
Creating Tests/foo_barTests/
Creating Tests/foo_barTests/foo_barTests.swift
```

Probably this
https://github.com/swiftlang/swift-package-manager/pull/9252.

This breaks our CI automation, only on nightly-main, because we run
`swift package init` in a directory created by `mktemp -d`, which, by
default, follows the pattern `tmp.XXXXXXX`.

### Modifications:

Create temporary directory for Swift package using explicit pattern
containing no periods.

### Result:

C++ interop CI should now work again on nightly-main Swift, and continue
to work on all supported Swift versions.
2026-02-11 17:13:33 +00:00
Franz Busch 5e72fc1029 Move nightly-next CI to 6.3 (#3496)
This PR moves the nightly-next CI to use the 6.3 images. Since those
checks should be non required on any user of this package and the name
of the check doesn't change with moving images this should be a
non-breaking change.
2026-01-27 16:32:59 +01:00
Rick Newton-Rogers fa91d790ad Generate matrix nested manifests (#3431)
Generate matrix script finds manifests in subdirs

### Motivation:

The genereate matrix script attempts to derive the minimum Swift version
supported by the package so that it doesn't run CI on versions which are
older than that supported. At the moment it can't cope with repositories
with packages in subdirectories like swift-nio-examples.

### Modifications:

The script looks for manifests in subdirectories if
`FIND_SUBDIRECTORY_MANIFESTS_ENABLED=true`. This is opt-in because by
default CI only uses the top-level manifests.

### Result:

CI should generate more appropriate jobs.

An example of this in action
https://github.com/apple/swift-nio/actions/runs/18968739126/job/54171197381?pr=3431
2025-10-31 10:36:21 +00:00
Rick Newton-Rogers 3ed0975c29 Android use static swift stdlib (#3430)
android build use swift static stdlib

### Motivation:

Android build fails and the guide says to use this flag
https://www.swift.org/documentation/articles/swift-sdk-for-android-getting-started.html

Recent failure - although weirdly it doesn't seem to happen every time:
```
error: link command failed with exit code 1 (use -v to see invocation)
ld.lld: error: cannot open crtbegin_dynamic.o: No such file or directory
ld.lld: error: cannot open crtend_android.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[558/601] Linking NIOUDPEchoClient

```

### Modifications:

android build use swift static stdlib

### Result:

hopefully success - making this change locally seemed to work.

This change can be seen in action here
https://github.com/apple/swift-nio/actions/runs/18949279888/job/54110590743?pr=3430
2025-10-31 09:54:51 +00:00
Rick Newton-Rogers d373d41637 Swift SDK installation script improvements (#3429)
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
2025-10-30 17:50:17 +01:00
Marc Prud'hommeaux a24771a4c2 Fix the Android CI workflow by adding a post-install step the configure the SDK (#3424)
Fixes the Android CI workflow

### Motivation:

The recently-added Android SDK workflow
[fails](https://github.com/apple/swift-nio/actions/runs/18718487605/job/53384086329?pr=3418)
(as mentioned at
https://github.com/apple/swift-nio/pull/3418#issue-3540969388). The
confusing error message is due to a post-install step that is needed to
download and link the Android NDK into the Swift SDK's artifactbundle.

This PR also adds a one-line fix to
[Sources/NIOPerformanceTester/main.swift](https://github.com/apple/swift-nio/compare/main...swift-android-sdk:swift-nio:main#diff-de179adbbfacb89c9533f4efd21f7f641eedc0c8642d7d650cdfc9d9278a7a55)
that gets it building for Android so the entire swift-nio package can be
built.

### Modifications:

Adds a post-install step to the SDK installation that is needed for the
Swift SDK for Android. This is the same technique used by
https://github.com/swiftlang/github-workflows/pull/172, and is described
as a necessary step in the [Android getting started
guide](https://github.com/swiftlang/swift-org-website/blob/0dc655ce267e7b6bada2a2032cc7855c3b5e19d9/documentation/articles/swift-android-getting-started.md)

### Result:

The "Android Swift SDK" CI check should now pass successfully. See an
example at
https://github.com/swift-android-sdk/swift-nio/actions/runs/18761057590/job/53525442382

### Note:

This PR will _not_ pass the Android check until it has been merged,
because it relies on being able to down the the script
https://raw.githubusercontent.com/apple/swift-nio/main/scripts/install_swift_sdk.sh
from `apple/swift-nio/main`, which will not include the Android fix
until the PR is merged. But once it is merged, the Android SDK CI should
start passing.
2025-10-30 10:04:17 +00:00
Rick Newton-Rogers 412a870a93 Android SDK Workflow (#3418)
### 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
2025-10-22 15:00:34 +01:00
e46b29f349 WASM SDK GitHub Actions workflows use NIO matrix (#3417)
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>
2025-10-22 14:22:24 +01:00
Rick Newton-Rogers 843c8cf264 Don't generate matrix jobs for Swift versions which aren't supported by the package. (#3415)
Don't generate matrix jobs for Swift versions which aren't supported by
the package.

### Motivation:

Matrix workflows should not generate jobs for Swift versions < tools
version, doing so wastes compute and adds noise.

This means that:
- New repos don’t need to manually opt-out of old Swift versions
- Repos which have dropped an old Swift version (during a migration
window) won’t have failing tests until it’s turned off centrally.

### Modifications:

- The generate script now looks for `Package.swift` and
`Package@swift-*.swift` files and uses the lowest tools version in any
found file to determine the minimum supported Swift version
- Any Swift version lower than the minimum is disregarded and no jobs
are generated for it
- A new parameter is added to the workflows which allows the minimum
Swift version to be set manually (`minimum_swift_version`)

### Result:

By default in this and downstream packages we don't generate matrix jobs
for Swift versions which aren't supported by the package.


An example of this working:
https://github.com/apple/swift-nio/actions/runs/18711362977/job/53360387720?pr=3415
2025-10-22 11:40:01 +01:00
Rick Newton-Rogers 154706efd3 Matrix custom env vars (#3376)
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
```
2025-09-22 16:06:47 +01:00
Fabian Fett 6c114e3c62 Update CI scripts for 6.2 (#3374)
Replaces: #3373
2025-09-19 13:55:48 +01:00
Evan Wilde f9b58f26ca CMake Updater: Output difference in expectations (#3314)
Teach the script to indicate what is different on failure rather than
keeping quiet. This helps when the script is failing in CI but not
locally.

### Motivation:

The script is reporting that there are missing changes in CI on
swift-crypto, but I am unable to reproduce them locally. This is to get
immediate insight on why the check fails rather than keeping quiet.

### Modifications:

Include the diff in the update-cmake-lists script.

### Result:

update-cmake-lists script outputs the difference between what is in a PR
vs what it expects to see instead of shrugging and leaving it as an
exercise to the user.
2025-07-22 13:55:46 +00:00
Rick Newton-Rogers c39d34d0b7 Update generate_matrix.sh for windows nightlies to 2022 images (#3284)
Update generate_matrix.sh for windows nightlies to 2022 images as the
2019 images are retired
2025-07-04 09:25:53 +01:00
Fabrice de Gans f5339fbb21 Add assembly files for Windows (#3275)
Add assembly files for Windows

### Motivation:

These assembly files are now required to build on Windows Arm64.

### Modifications:

* The Windows assembly files are now handled in `update-cmake-lists.sh`.

### Result:

The assembly source files will be properly updated in `swift-crypto`.
2025-06-27 19:52:10 +00:00
Rick Newton-RogersandGeorge Barnett e3e1cb50ec Benchmarks workflow prints diff when changes found (#3258)
### 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>
2025-05-29 14:29:52 +00:00
Rick Newton-Rogers 355bc48edf Update the matrix nightly-next to point to 6.2 (#3250)
### Motivation:

Nightly builds for 6.2 exist, we should test against them.

### Modifications:

Update the matrix nightly-next to point to 6.2. This will affect
downstream adopters but shouldn't break them because they don't gatet
PRs on this passing.

### Result:

nightly tests will run against Swift 6.2

An example of this working
https://github.com/apple/swift-nio/actions/runs/15185876449/job/42706027686?pr=3250
2025-05-22 12:20:03 +00:00
Rick Newton-Rogers d53225264f Update check-matrix-job.sh to default swift commands (#3237)
Update check-matrix-job.sh to default swift commands so that callers
which don't define them can still run workflows. At the moment they see
failures if they don't define any one of the commands.
2025-05-13 11:31:54 +00: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 c5cc43d1df Update matrix job script for 6.1 (#3201)
### Motivation:

The matrix job script used by the legacy Swift matrix workflow is still
used directly in some places where they need to run sidecar services, it
hasn't been updated for Swift 6.1

### Modifications:

Add cases for Swift 6.1 and clean up some missed changes for the
nightly-6.1 -> nightly-next naming change.

### Result:

Downstream services should be able to run matrix workflows with Swift
6.1.
2025-04-14 10:20:46 +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 b4451dc7b9 Update install_static_sdk.sh to cope with versions with no patch (#3166)
Update install_static_sdk.sh to cope with versions with no patch. The
existing `sed` regex assumed `major.minor.patch`
2025-04-01 17:08:04 +01: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 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-Rogers 517dccac42 rename nightly 6 1 to nightly next (#3126)
Use nightly_next as swift version

see https://github.com/apple/swift-nio/pull/3122

Motivation:
To not have to rename threshold directories when the nightly branch
changes.

Modifications:
* Use nightly_next as swift version in the matrix generation script
which
is picked up by the benchmark script.
* Move nightly-next thresholds and add legacy symlink

Result:

Benchmark thresholds will attempt to find directories named
nightly_next, not nightly_6_1.
2025-03-04 09:37:47 +00:00
Rick Newton-Rogers 4c14ce5004 Update generate matrix stript to use nightly_next (#3120)
Update generate matrix stript to use nightly_next

### 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 flags to refer to nightly_next rather than nightly_6_1, implement
a shim so that the old environment variables still work.

### Result:

We will be able to modify adopter workflows to use nightly_next
terminology.

Example of a job where workflows are using the new matrix
https://github.com/apple/swift-nio/actions/runs/13520016728
2025-02-25 13:58:09 +00:00
Rick Newton-Rogers 187bfa8863 check-matrix-job.sh should tolerate unset 6.1 vars (#3080)
### Motivation:

We recently added support for nightly 6.1 Swift and old scripts making
use of `check-matrix-job.sh` do not set `COMMAND_OVERRIDE_NIGHTLY_6_1`
which causes the script to fail. We should tolerate this.

### Modifications:

Add a default case for `COMMAND_OVERRIDE_NIGHTLY_6_1`.

### Result:

No failures if a caller doesn't specify `COMMAND_OVERRIDE_NIGHTLY_6_1`.

```
❯ SWIFT_VERSION=nightly-6.1 COMMAND="echo foo" COMMAND_OVERRIDE_5_9="" COMMAND_OVERRIDE_5_10="" COMMAND_OVERRIDE_6_0="" COMMAND_OVERRIDE_NIGHTLY_MAIN="" ./scripts/check-matrix-job.sh
** Running default command
foo
❯ SWIFT_VERSION=nightly-6.1 COMMAND="echo foo" COMMAND_OVERRIDE_5_9="" COMMAND_OVERRIDE_5_10="" COMMAND_OVERRIDE_6_0="" COMMAND_OVERRIDE_NIGHTLY_MAIN="" COMMAND_OVERRIDE_NIGHTLY_6_1="echo bar" ./scripts/check-matrix-job.sh
** Running nightly 6.1 command override
bar
```
2025-01-22 15:24:37 +00:00