-
Notifications
You must be signed in to change notification settings - Fork 651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GHA] Make unit tests, benchmarks and cxx interop easier to reuse #2801
Conversation
2c7b77a
to
b0885b4
Compare
|
||
jobs: | ||
cxx-interop: | ||
name: Cxx interop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Any reason to not spell this as "C++" when we have a string label?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kinda stayed consistent with the script name and the flag that's set in the Package.swift
. Also AFAIK all of C++/Cpp/Cxx is valid to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, they're all valid and I'm fine with keeping it. I always assumed Cxx and Cpp were there for when we couldn't use non-ascii characters, like in command line flags and file extensions.
.github/workflows/pull_request.yml
Outdated
name: "Integration tests" | ||
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq && ./scripts/integration_tests.sh" | ||
integration-tests: | ||
name: Checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of these all share the same name: Checks
, what is the result of that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is intentional to get the naming of the checks somewhat aligned. Otherwise it would be Pull Request / Benchmarks / Benchmarks / 5.9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, fine.
.github/workflows/pull_request.yml
Outdated
uses: ./.github/workflows/pull_request_swift_matrix.yml | ||
with: | ||
name: "Integration tests" | ||
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq && ./scripts/integration_tests.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Is this an example of how a project could use the matrix for an arbitrary job that they can name and provide a command for, and have that job be run for all the Swift versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly. This still allows individual project to configure their own jobs.
.github/workflows/unit_tests.yml
Outdated
uses: ./.github/workflows/pull_request_swift_matrix.yml | ||
with: | ||
name: "Unit tests" | ||
matrix_linux_command: "swift test -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC these flags shouldn't be here, since they are provided in the override in the other YAML file?
Wondering if the most acceptable thing to do would be for the default to command to just be swift test
and allow folks to provide their override when they adopt, opting into whatever additional level of validation they want for their project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to pick a default here since this input is required. In practice this input will never actually be used because we provide an override for each version specific job. I do think we should have strong defaults though. In particular those two seem like net wins and I would rather people have to disable warnings as errors than the other way around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you feel super strongly about it, then fine, but I would have had a slight lean the other way...
I think if we're offering this as a reusable building block it shouldn't be so opinionated so would prefer it for this to be free of anything that isn't the default, i.e. just swift test
. I think that will be the least surprising behaviour. It would be annoying for folks to adopt the pipeline when their project currently builds fine (without additional strict flags, and then scratch their heads a little).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You convinced me and I removed the default args now.
# Motivation Currently the `pull_request_swift_matrix` workflow provided an easy way to run a command across many Swift versions. We do have a few common commands that we want to run across the repos. Namely, unit tests, benchmarks and cxx interop. # Modification This PR creates new workflows for the above common matrix commands so it's easier to reuse them from other repos. # Result Even easier to share these workflows.
d79e603
to
a0d66ee
Compare
a0d66ee
to
e0372b2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Still not sure I like the defaults but if you really want them, then OK.
|
||
jobs: | ||
cxx-interop: | ||
name: Cxx interop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, they're all valid and I'm fine with keeping it. I always assumed Cxx and Cpp were there for when we couldn't use non-ascii characters, like in command line flags and file extensions.
.github/workflows/pull_request.yml
Outdated
name: "Integration tests" | ||
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q lsof dnsutils netcat-openbsd net-tools curl jq && ./scripts/integration_tests.sh" | ||
integration-tests: | ||
name: Checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, fine.
.github/workflows/unit_tests.yml
Outdated
uses: ./.github/workflows/pull_request_swift_matrix.yml | ||
with: | ||
name: "Unit tests" | ||
matrix_linux_command: "swift test -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you feel super strongly about it, then fine, but I would have had a slight lean the other way...
I think if we're offering this as a reusable building block it shouldn't be so opinionated so would prefer it for this to be free of anything that isn't the default, i.e. just swift test
. I think that will be the least surprising behaviour. It would be annoying for folks to adopt the pipeline when their project currently builds fine (without additional strict flags, and then scratch their heads a little).
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [apple/swift-nio](https://togithub.com/apple/swift-nio) | minor | `2.68.0` -> `2.70.0` | --- ### Release Notes <details> <summary>apple/swift-nio (apple/swift-nio)</summary> ### [`v2.70.0`](https://togithub.com/apple/swift-nio/releases/tag/2.70.0): SwiftNIO 2.70.0 [Compare Source](https://togithub.com/apple/swift-nio/compare/2.69.0...2.70.0) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### SemVer Minor - `FileSystem.copyItem` can parallelise directory copy by [@​UncleMattHope](https://togithub.com/UncleMattHope) in [https://github.com/apple/swift-nio/pull/2806](https://togithub.com/apple/swift-nio/pull/2806) - `ChannelOption`: Allow types to be accessed with leading dot syntax by [@​ayush1794](https://togithub.com/ayush1794) in [https://github.com/apple/swift-nio/pull/2816](https://togithub.com/apple/swift-nio/pull/2816) - Make `EventLoopPromise` conform to Equatable by [@​gjcairo](https://togithub.com/gjcairo) in [https://github.com/apple/swift-nio/pull/2714](https://togithub.com/apple/swift-nio/pull/2714) - Provide a default `CopyStrategy` overload for copyItem. by [@​UncleMattHope](https://togithub.com/UncleMattHope) in [https://github.com/apple/swift-nio/pull/2818](https://togithub.com/apple/swift-nio/pull/2818) ##### SemVer Patch - Better align shutdown semantics of testing event loops by [@​simonjbeaumont](https://togithub.com/simonjbeaumont) in [https://github.com/apple/swift-nio/pull/2800](https://togithub.com/apple/swift-nio/pull/2800) - Clone files on Darwin rather than copying them by [@​rnro](https://togithub.com/rnro) in [https://github.com/apple/swift-nio/pull/2823](https://togithub.com/apple/swift-nio/pull/2823) ##### Other Changes - Fix compose file used in update-benchmark-thresholds script by [@​simonjbeaumont](https://togithub.com/simonjbeaumont) in [https://github.com/apple/swift-nio/pull/2808](https://togithub.com/apple/swift-nio/pull/2808) - Remove advice to generate linux tests. by [@​PeterAdams-A](https://togithub.com/PeterAdams-A) in [https://github.com/apple/swift-nio/pull/2807](https://togithub.com/apple/swift-nio/pull/2807) - Make `testInstantTCPConnectionResetThrowsError` more reliable by [@​hamzahrmalik](https://togithub.com/hamzahrmalik) in [https://github.com/apple/swift-nio/pull/2810](https://togithub.com/apple/swift-nio/pull/2810) - \[CI] Add `shellcheck` and fix up warnings by [@​FranzBusch](https://togithub.com/FranzBusch) in [https://github.com/apple/swift-nio/pull/2809](https://togithub.com/apple/swift-nio/pull/2809) - \[CI] Fix docs check by [@​FranzBusch](https://togithub.com/FranzBusch) in [https://github.com/apple/swift-nio/pull/2811](https://togithub.com/apple/swift-nio/pull/2811) - \[CI] Add Swift 6 language mode workflow by [@​FranzBusch](https://togithub.com/FranzBusch) in [https://github.com/apple/swift-nio/pull/2812](https://togithub.com/apple/swift-nio/pull/2812) - Fix test compilation on non-macOS Darwin platforms by [@​simonjbeaumont](https://togithub.com/simonjbeaumont) in [https://github.com/apple/swift-nio/pull/2817](https://togithub.com/apple/swift-nio/pull/2817) - Add `.index-build` to `.gitignore` by [@​MaxDesiatov](https://togithub.com/MaxDesiatov) in [https://github.com/apple/swift-nio/pull/2819](https://togithub.com/apple/swift-nio/pull/2819) - \[CI] Add action and workflow to check for semver label by [@​FranzBusch](https://togithub.com/FranzBusch) in [https://github.com/apple/swift-nio/pull/2814](https://togithub.com/apple/swift-nio/pull/2814) - Update repository docs for swift-version support and recent CI check changes by [@​UncleMattHope](https://togithub.com/UncleMattHope) in [https://github.com/apple/swift-nio/pull/2815](https://togithub.com/apple/swift-nio/pull/2815) - Fix failing build for test by [@​ayush1794](https://togithub.com/ayush1794) in [https://github.com/apple/swift-nio/pull/2824](https://togithub.com/apple/swift-nio/pull/2824) - Fix typo in comment in `WebSocketErrorCodes.swift` by [@​valeriyvan](https://togithub.com/valeriyvan) in [https://github.com/apple/swift-nio/pull/2604](https://togithub.com/apple/swift-nio/pull/2604) - \[CI] Add a scheduled workflow for tests and benchmarks by [@​FranzBusch](https://togithub.com/FranzBusch) in [https://github.com/apple/swift-nio/pull/2822](https://togithub.com/apple/swift-nio/pull/2822) - \[CI] Fix label check by [@​FranzBusch](https://togithub.com/FranzBusch) in [https://github.com/apple/swift-nio/pull/2827](https://togithub.com/apple/swift-nio/pull/2827) #### New Contributors - [@​UncleMattHope](https://togithub.com/UncleMattHope) made their first contribution in [https://github.com/apple/swift-nio/pull/2806](https://togithub.com/apple/swift-nio/pull/2806) - [@​ayush1794](https://togithub.com/ayush1794) made their first contribution in [https://github.com/apple/swift-nio/pull/2816](https://togithub.com/apple/swift-nio/pull/2816) - [@​valeriyvan](https://togithub.com/valeriyvan) made their first contribution in [https://github.com/apple/swift-nio/pull/2604](https://togithub.com/apple/swift-nio/pull/2604) **Full Changelog**: apple/swift-nio@2.69.0...2.70.0 ### [`v2.69.0`](https://togithub.com/apple/swift-nio/releases/tag/2.69.0): SwiftNIO 2.69.0 [Compare Source](https://togithub.com/apple/swift-nio/compare/2.68.0...2.69.0) <!-- Release notes generated using configuration in .github/release.yml at main --> #### What's Changed ##### SemVer Minor - Add manual control to `NIOLockedValueBox` by [@​glbrntt](https://togithub.com/glbrntt) in [https://github.com/apple/swift-nio/pull/2786](https://togithub.com/apple/swift-nio/pull/2786) - ChannelHandler: provide static `(un)wrap(In|Out)bound(In|Out)` by [@​weissi](https://togithub.com/weissi) in [https://github.com/apple/swift-nio/pull/2791](https://togithub.com/apple/swift-nio/pull/2791) ##### SemVer Patch - Pre-box some errors to reduce allocations by [@​glbrntt](https://togithub.com/glbrntt) in [https://github.com/apple/swift-nio/pull/2765](https://togithub.com/apple/swift-nio/pull/2765) - Allow in-place mutation of `NIOLoopBoundBox.value` by [@​dnadoba](https://togithub.com/dnadoba) in [https://github.com/apple/swift-nio/pull/2771](https://togithub.com/apple/swift-nio/pull/2771) - Avoid creating a yield ID counter per async writer by [@​glbrntt](https://togithub.com/glbrntt) in [https://github.com/apple/swift-nio/pull/2768](https://togithub.com/apple/swift-nio/pull/2768) - Combine the two `NIOAsyncChannel` channel handlers by [@​glbrntt](https://togithub.com/glbrntt) in [https://github.com/apple/swift-nio/pull/2779](https://togithub.com/apple/swift-nio/pull/2779) - Use the new Android overlay and Bionic module from Swift 6 by [@​finagolfin](https://togithub.com/finagolfin) in [https://github.com/apple/swift-nio/pull/2784](https://togithub.com/apple/swift-nio/pull/2784) - Change `unsafeDownCast` to `as!` by [@​FranzBusch](https://togithub.com/FranzBusch) in [https://github.com/apple/swift-nio/pull/2802](https://togithub.com/apple/swift-nio/pull/2802) ##### Other Changes - CI migration to GitHub Action by [@​FranzBusch](https://togithub.com/FranzBusch) in ([https://github.com/apple/swift-nio/pull/2760](https://togithub.com/apple/swift-nio/pull/2760) [https://github.com/apple/swift-nio/pull/2762](https://togithub.com/apple/swift-nio/pull/2762) [https://github.com/apple/swift-nio/pull/2763](https://togithub.com/apple/swift-nio/pull/2763) [https://github.com/apple/swift-nio/pull/2764](https://togithub.com/apple/swift-nio/pull/2764) [https://github.com/apple/swift-nio/pull/2767](https://togithub.com/apple/swift-nio/pull/2767) [https://github.com/apple/swift-nio/pull/2766](https://togithub.com/apple/swift-nio/pull/2766) [https://github.com/apple/swift-nio/pull/2776](https://togithub.com/apple/swift-nio/pull/2776) [https://github.com/apple/swift-nio/pull/2780](https://togithub.com/apple/swift-nio/pull/2780) [https://github.com/apple/swift-nio/pull/2785](https://togithub.com/apple/swift-nio/pull/2785) [https://github.com/apple/swift-nio/pull/2781](https://togithub.com/apple/swift-nio/pull/2781) [https://github.com/apple/swift-nio/pull/2787](https://togithub.com/apple/swift-nio/pull/2787) [https://github.com/apple/swift-nio/pull/2783](https://togithub.com/apple/swift-nio/pull/2783) [https://github.com/apple/swift-nio/pull/2789](https://togithub.com/apple/swift-nio/pull/2789) [https://github.com/apple/swift-nio/pull/2790](https://togithub.com/apple/swift-nio/pull/2790)) - Ignore format commit from git blame by [@​FranzBusch](https://togithub.com/FranzBusch) in [https://github.com/apple/swift-nio/pull/2796](https://togithub.com/apple/swift-nio/pull/2796) [https://github.com/apple/swift-nio/pull/2797](https://togithub.com/apple/swift-nio/pull/2797) [https://github.com/apple/swift-nio/pull/2801](https://togithub.com/apple/swift-nio/pull/2801) [https://github.com/apple/swift-nio/pull/2803](https://togithub.com/apple/swift-nio/pull/2803) - Adopt swift-format by [@​FranzBusch](https://togithub.com/FranzBusch) in [https://github.com/apple/swift-nio/pull/2794](https://togithub.com/apple/swift-nio/pull/2794) - `HTTPPart` Documentation Clarification by [@​dimitribouniol](https://togithub.com/dimitribouniol) in [https://github.com/apple/swift-nio/pull/2775](https://togithub.com/apple/swift-nio/pull/2775) - Add benchmark for creating `NIOAsyncChannel` by [@​glbrntt](https://togithub.com/glbrntt) in [https://github.com/apple/swift-nio/pull/2774](https://togithub.com/apple/swift-nio/pull/2774) - Disable warnings as errors on Swift 6 and main by [@​glbrntt](https://togithub.com/glbrntt) in [https://github.com/apple/swift-nio/pull/2793](https://togithub.com/apple/swift-nio/pull/2793) **Full Changelog**: apple/swift-nio@2.68.0...2.69.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://togithub.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xOC4xIiwidXBkYXRlZEluVmVyIjoiMzguMzkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: cgrindel-self-hosted-renovate[bot] <139595543+cgrindel-self-hosted-renovate[bot]@users.noreply.github.com>
Motivation
Currently the
pull_request_swift_matrix
workflow provided an easy way to run a command across many Swift versions. We do have a few common commands that we want to run across the repos. Namely, unit tests, benchmarks and cxx interop.Modification
This PR creates new workflows for the above common matrix commands so it's easier to reuse them from other repos.
Result
Even easier to share these workflows.