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>
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
# 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.
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.
# 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.
# 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.
# 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.
# Motivation
Our support strategy includes the last three released Swift versions.
After the recent release of Swift 6 this means we now support 5.9, 5.10
and 6.0.
# Modification
This PR updates our CI configuration and scripts to align with our
supported Swift versions.
# Result
Up to date CI coverage.
# Motivation
Switch to the reusable workflows from the swiftlang organization for
soundness.
# Modification
This PR moves over to the new reusable soundness workflow. Additionally,
it also deletes all files in this repo for the soundness checks since
they are no longer needed.
### Motivation:
This repo contains reusable workflows, intended for use in _other_
repos. Right now, some of these reusable workflows are nested, i.e. some
of the YAML files refer to other YAML files in the repo by a relative
path.
Unfortunately, this makes them currently unusable locally with `act`
because of https://github.com/nektos/act/issues/1875.
For now, it appears the only workaround is to have these referred to
without the local, relative path.
### Modifications:
Use the remote syntax for referencing nested workflows.
### Result:
Commands like `act -j unit-tests` will work in repos that aren't NIO
itself.
---------
Co-authored-by: Franz Busch <privat@franz-busch.de>
### Motivation:
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
### 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
# 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.
…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.
# 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
# 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.
# 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
# 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.
# 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.
# 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.
# 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
# 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.
* Apply formatting
* Apply no block comments rule
* Apply OmitExplicitReturns
* Apple OnlyOneTrailingClosureArgument
* Apply NoAssignmentInExpressions
* Fix up DontRepeatTypeInStaticProperties lint errors
* Apply `OrderedImports`
* Apply `ReplaceForEachWithForLoop`
* format file
* Enable the formatting pipeline
* Adopt `AmbiguousTrailingClosureOverload`
* Fix license header
* Fix format check
* Fix `EndOfLineComment`
* Fix CI
* Adapt CI script to check if changes when running formatting
* Separate lint and format into to steps
* Fix format
* Adopt `UseEarlyExits`
* Revert "Adopt `UseEarlyExits`"
This reverts commit d1ac5bbe12.
Motivation:
The Swift 6 compiler emits a number of warnings about sendability which
we haven't dealt with yet. The CI failing on warnings may mask other
compilation issues or test failures.
Modifications:
- Disable warnings as errors on Swift 6 and main
Result:
Swift 6 and main CI should pass
# Motivation
Another reusable check is to make sure that all library products of a package are successfully building when consumed from a module that has Cxx interoperability enabled. Another check that's missing is running the integration tests.
# Modification
This PR adds two new checks to the reusable workflow. One to check for Cxx interoperability compatibility and another one to run the integration tests. I also fixed a misalgined name for the nightly benchmarks.
# Result
This should be one of the last reusable workflow checks.
* [GHA] Introduce reusable matrix workflow
# Motivation
We have a few checks that we want to run across all supported Swift versions e.g. unit tests and benchmarks. Right now we already added two matrix based jobs to the reusable workflow. This leads to a lot of duplication and harder maintenance.
# Modification
This PR splits off the current reusable workflow to only contain soundness related checks and introduces a new reusable matrix based workflow which can be customized to execute different commands.
# Result
It is now easy to setup multiple matrix based workflows.
* Code review
* Change nightly next
# Motivation
The next two reusable checks that we need to create are for broken symlinks and formatting. The latter is disabled for this repo for now since we need to discuss the formatting rules separately.
# Modification
This PR adds two new checks - broken symlinks and formatting.
# Result
Closer to having everything on GitHub actions.
* [GHA] Add license header check
# Motivation
We need to make sure all code files have the appropriate license headers in place. This is currently part of the soundness check and we need to replace this with a GH action.
# Modification
Adds a new job to the reusable workflow the check all files for license headers. Since some files are ignored every repo can specify a `.licenseignore` file.
# Result
Last part of the soundness script migrated.
* Review
* Remove default excludes
# Motivation
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
# 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.
* [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
# 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.
# 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
# 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.
# 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