Commit Graph
43 Commits
Author SHA1 Message Date
Cory BenfieldandRick Newton-Rogers 653da4d987 Backport: Use Swift 6.0 docs pipeline (#2966) (#2991)
Documentation checking catches more issues in Swift 6.0.

Adopt the Swift 6.0 image and fix the errors.

More accurate docs.

(cherry picked from commit adfd61adc5)

Co-authored-by: Rick Newton-Rogers <rnro@apple.com>
2024-11-22 09:24:33 +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
Franz Busch 2fe3d92cf5 Drop support for Swift 5.8 (#2924)
# Motivation

We only support the last three Swift released versions which are at this
time 5.9, 5.10 and 6.

# Modification

This PR drops anything related to Swift 5.8.

# Result

Version support aligned.
2024-10-17 12:22:10 +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 50fd74c66d [CI] Fix unit test yaml file (#2915)
I messed up the indention of the `unit_tests.yml` file in a previous PR.
This fixes it.
2024-10-11 14:51:07 +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
Si Beaumont c9781cf7da ci: Use ${GITHUB_BASE_REF} as treeish for checking API break (#2883)
### Motivation:

This repo is providing a reusable workflow for checking API breaks but
it has two shortcomings:

1. It presumes the target branch name for the PR to be `main`.
2. It presumes the remote is named `origin`.

(2) is always the case in CI, but isn't always locally. My remote is
named `upstream` so cannot run this using `act`. (1) is worse, because
it's not actually testing against the target branch of the PR—consider
if someone was enabling this reusable workflow on a feature branch or
other-named branch.

Fortunately, Github Actions makes the target ref of the pull request
available in the `GITHUB_BASE_REF` environment variable[^0].

### Modifications:

Use `GITHUB_BASE_REF` as the argument to `swift package
diagnose-api-breaking-changes`.

### Result:

This can now be run locally.

[^0]:
https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables
2024-09-16 16:54:59 +02:00
Si Beaumont 1851ae6e7d ci: Install shellcheck if not present in CI runner (#2882)
### Motivation:

We want to be able to run the soundness checks locally, and our current
guidance for this is to use `act`. However, there is a documented[^0]
difference in the runner images it uses and those used by Github Actions
proper. One such difference is a lack of `shellcheck` in both the small
and medium runners, which _is_ present in Github's image for the
`ubuntu-latest` platform.

### Modifications:

There are official images for `shellcheck`: both a single binary and an
alpine-based image, which are very small. Neither of these has `bash`,
nor `git`, which are dependencies of the script.

This PR updates the workflow to use a container for this job and uses
the same image used in some other jobs, along with a step to install
`shellcheck`, which is in keeping with what we do for other jobs in the
soundness workflow already to e.g. install `yq`.

### Result:

Can run the soundness job locally using `act`. No change in CI.

[^0]:
https://nektosact.com/usage/runners.html#default-runners-are-intentionally-incomplete
2024-09-16 11:46:54 +02:00
Franz Busch ff9492cbbf [CI] Run tests on push to main (#2868)
# Motivation

We want to get green check marks on our commits to main. To do this we
have to run part of our CI jobs when a new commit is pushed.

# Modification

This PR adds a new workflow trigger to run our CI when a commit is
pushed to the main branch.

# Result

Green checkmarks on our commits.
2024-09-06 13:51:29 +00:00
Franz Busch 76f39c1cdb [CI] Make container images configurable in soundness and matrix jobs … (#2851)
…and remove docc plugin

# Motivation

Some repositories might want to run their soundness and matrix jobs
checks on different container images e.g. a repo might build against the
nightly toolchains only so their soundness jobs should also use nightly
images. Other repos might want to build against a different linux
distribution since their usual deployment target is not Ubuntu based.

Additionally, we currently require our repos to depend on the docc
plugin for building documentation which adds an unnecessary dependency
to all of our packages.

# Modification

This PR makes the container images for the soundness and matrix jobs
configurable. Furthermore, it modifies the docs check script to add the
docc-plugin dependency and removes the current dependency from our
manifest.

# Result

Our workflows can be adopted by more repositories.
2024-08-29 09:15:58 +01:00
Franz Busch 65db2dbfcb [CI] Mark the workspace as safe for the matrix job (#2848)
# Motivation

Some scripts that run as part of a matrix job may want to call git
commands and the workspace needs to be marked as safe.

# Modification

This PR adds a step to mark the workspace as safe
2024-08-20 09:50:03 +01:00
Franz Busch 837a1ddf57 [CI] Don't persist git credentials in CI (#2847)
# Motivation


https://yossarian.net/til/post/actions-checkout-can-leak-github-credentials
shows a common way to leak git credentials in CI. While we are not
publishing artifacts right now, we can harden our security here by
disabling the persistence of git credentials as much as possible.

# Modification

Don't persist git credentials when not needed.

# Result

Less likely to leak credentials.
2024-08-19 18:42:23 +01:00
Franz Busch 80af56f805 Update the triggers for the Semantic Version label check (#2833)
# Motivation

The checks get cleared when the PR state changes however we weren't
re-running the label workflow.

# Modification

This PR modifiers the triggers for the label workflow to also run on the
triggers when the other workflow runs

# Result

Always correct label checks
2024-08-08 12:15:11 +00:00
Franz Busch 4c4453b489 [CI] Fix label check (#2827)
# Motivation

The label check workflow doesn't seem to work properly.

# Modification

This PR fixes it.

# Result

Proper label checks.
2024-08-05 12:41:20 +00:00
Franz Busch 260c899e7e [CI] Add a scheduled workflow for tests and benchmarks (#2822)
# Motivation

We want to run our unit tests, integration tests and benchmarks on a
regular schedule to understand how stable they are.

# Modification

This PR adds a scheduled workflow for the three above jobs. It runs it
three times a day so we get enough data throughout the day.

# Result

Continuous feedback about the stability of our tests.
2024-08-05 11:29:30 +00:00
Franz Busch 883540fdd0 [CI] Add action and workflow to check for semver label (#2814)
# Motivation

We want to make sure every PR that gets merged is appropriately labeled.

# Modification

This PR adds a new workflow and action to check for a semver label to be present.

# Result

No more labeling after a PR got merged.
2024-07-31 16:28:07 +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 28f9cae996 [CI] Fix docs check (#2811)
# Motivation

I broke the docs check in one of my previous PRs.

# Modification

This PR fixes the docs check again.

# Result

No more broken CI
2024-07-25 17:52:34 +01:00
Franz Busch f17f7e5909 [CI] Add shellcheck and fix up warnings (#2809)
# Motivation

We have quite a lot of shell scripts in our repo and want to make sure that they all pass `shellcheck`.

# Modification

This PR adds a GH action workflow to the soundness script for `shellcheck` and fixes up all errors and warnings.

# Result

No more shell/bash discussions
2024-07-25 14:55:44 +00:00
Franz Busch 541a90026a [CI] Add format ignore file (#2803)
# Motivation

Some repositories may want to exclude files from being format checked.

# Modification

This PR moves the formatting into a separate script and adds an optional `.swiftformatignore` file that can be placed at the repo root similar to the `.licenseignore` file.

# Result

Repos can now decide what files are ignored when running the formatter.
2024-07-24 14:57:59 +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
Si Beaumont 284125791a [GHA] Only format Swift files that are in Git index (#2797) 2024-07-19 16:54:08 +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 2798a6e92f [GHA] Download the scripts to make workflow reusable (#2785)
# Motivation

The reusable workflow is intended to be called from other repos; however, the workflow contains jobs that execute shell scripts. Those scripts are part of the NIO repo. When another repo calls the reusable workflow those scripts aren't present on the machine.

# Modification

This PR downloads the scripts via curl and executes them.

# Result

Makes the reusable workflow truly reusable
2024-07-12 01:41:40 -07:00
Franz Busch 86316020a5 [GHA] Benchmark job (#2780) 2024-07-11 03:23:24 -07:00
Franz Busch fd31c9504c [GHA] Move docs check to script (#2776)
# Motivation

For longer scripts we want to use a standalone shell script instead of using a multiline script inside the workflow yml.

# Modification

This PR uses the existing doc script instead of an inline script in the workflow

# Result

Better maintainability of the scripts.
2024-07-10 15:51:45 +01:00
Franz Busch 5cc05490c4 [GHA] Unacceptable language check (#2766)
* [GHA] Unacceptable language check

# Motivation

Next up replacing part of our soundness script that checked for unacceptable language.

# Modification

This PR adds a new GH action that checks for unacceptable language.

# Result

One more script replaced

* PR review

* Change homepage link to repo
2024-07-09 07:56:26 +01: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
Franz Busch 9730938793 [GHA] Documentation check (#2764)
# Motivation

Next up replacing the documentation check.

# Modification

This moves the current approach of the script into a GH action. I tried just running the documentation check against all targets but that also results in warnings from downstream deps in their docs to show up.

I also fixed up some new errors that appeared since our current pipeline was running on 5.8.

# Result

Next CI job migrated to GHA
2024-07-04 16:21:18 +01:00
Franz Busch 9d5d0b6007 [GHA] Add API breaking check (#2763)
# Motivation

The next GH action pipeline that we need is to add our API breaking change checker.

# Modification

This PR adds an API breaking change job to our pull request workflow.
2024-07-04 03:27:38 -07:00
Franz Busch 304a238b09 [GHA] Fix docker images (#2762) 2024-07-02 07:58:07 -07:00
Franz Busch 2f99bc3fa5 [GHA] Introduce the first GitHub Action (#2760)
# Motivation

We want to move our CI over to use GitHub Actions. We need to cover multiple different things like unit tests, benchmarks, soundness, API breaks, doc validation etc.

# Modification

This PR starts our journey to GitHub Actions by introducing the PR workflow. Right now this workflow only runs the Swift tests on our repository without any additional compiler flags like `-warnings-as-errors`. This aims to get us started and we will continue to modify them in subsequent PRs.

# Result

We got our first GH workflows running
2024-07-02 05:26:56 -07:00