Skip to content
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] Introduce reusable matrix workflow #2789

Merged
merged 3 commits into from
Jul 15, 2024
Merged

Conversation

FranzBusch
Copy link
Member

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.

@FranzBusch FranzBusch added the semver/none No version bump required. label Jul 15, 2024
@FranzBusch FranzBusch force-pushed the fb-gha-matrix-workflow branch 20 times, most recently from f25c2ea to 0d38fd0 Compare July 15, 2024 11:26
@FranzBusch
Copy link
Member Author

Benchmarks and Unit tests are expected to fail since the script isn't on main yet. The previous run showed the expected failures of the nightly-next and nightly-main unit test check due to warnings in the build.

@FranzBusch FranzBusch force-pushed the fb-gha-matrix-workflow branch 3 times, most recently from 2c8e214 to f6a482c Compare July 15, 2024 11:28
@FranzBusch FranzBusch enabled auto-merge (squash) July 15, 2024 11:28
@FranzBusch
Copy link
Member Author

@swift-server-bot test this please

# 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.
@FranzBusch
Copy link
Member Author

Our Jenkins CI seems to have some problems today

Comment on lines 14 to 16
matrix_linux_5_8_enabled:
type: string
description: "The command of the 5.8 Swift version linux matrix job to execute."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and all the other _enableds don't seem right, they should surely be booleans?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, are at the _enableds used at all?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Good catch!

- image: swift:5.10-jammy
swift_version: "5.10"
- image: swiftlang/swift:nightly-6.0-jammy
swift_version: "nightly-next"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the version be more specific? e.g. "nightly-6.0"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next version number is often decided quite close to the release so I wanted to keep it general with next

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's true, it's must be known when it branches and we know it at this point because we have docker image for it. Before the version is known it's just "main" which is a separate entry.

Earlier you made the point about not having "current", "current-minus-1" etc., but "next" falls into that same pattern.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an example the next release was called swift 5.11 for a long time until it got renamed to swift 6.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just changed it to nightly-6.0 now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there was never a 5.11 branch or docker image, it only appeared in swiftc --version. At this point, where we're selecting a docker image we must know the version (apart from main builds)

@@ -50,64 +38,10 @@ on:

## We are cancelling previously triggered workflow runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}-soundness
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ... don't think this addition is needed? Did you run into a problem and this solved it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Without this addition the different reusable workflows cancel each other

Comment on lines 6 to 43
name:
type: string
description: "The name of the workflow used for the concurrency group."
required: true
matrix_linux_command:
type: string
description: "The command of the current Swift version linux matrix job to execute."
required: true
matrix_linux_5_8_enabled:
type: string
description: "The command of the 5.8 Swift version linux matrix job to execute."
matrix_linux_5_8_command_override:
type: string
description: "The command of the 5.8 Swift version linux matrix job to execute."
matrix_linux_5_9_enabled:
type: string
description: "The command of the 5.9 Swift version linux matrix job to execute."
matrix_linux_5_9_command_override:
type: string
description: "The command of the 5.9 Swift version linux matrix job to execute."
matrix_linux_5_10_enabled:
type: string
description: "The command of the 5.10 Swift version linux matrix job to execute."
matrix_linux_5_10_command_override:
type: string
description: "The command of the 5.10 Swift version linux matrix job to execute."
matrix_linux_nightly_next_enabled:
type: string
description: "The command of the nightly next Swift version linux matrix job to execute."
matrix_linux_nightly_next_command_override:
type: string
description: "The command of the nightly next Swift version linux matrix job to execute."
matrix_linux_nightly_main_enabled:
type: string
description: "The command of the nightly main Swift version linux matrix job to execute."
matrix_linux_nightly_main_command_override:
type: string
description: "The command of the nightly main Swift version linux matrix job to execute."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems redundant. You could accept key-value pairs in a JSON.

fromJson(inputs.matrix_linux_command_override).510

assuming we have a

matrix_linux_command_override:
  type: string

I haven't tried but it think using brackets should also work:

fromJson(inputs.matrix_linux_command_override)[matrix.swift_version]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like using a JSON for that since we get no validation from the GitHub side on that. My thinking was that once we bump the minimum version and remove/add new Swift versions we change the names of the overrides and if some repo defined one their CI will fail due to yaml validations. Which gives them a good indication what changed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm but do you really want to be backward incompatible? I think that's not a great idea to be honest.
Imagine doing a PR and noticing that CI is failing due to unrelated reasons.
I guess the maintainers can be advised to look out for these kinds of changes: "if CI failed and was complaining about an invalid value in the inputs, that's because we've probably removed it". But is that a good idea?

@FranzBusch FranzBusch requested a review from glbrntt July 15, 2024 13:00
@Lukasa
Copy link
Contributor

Lukasa commented Jul 15, 2024

Merging over flaky benchmark

@Lukasa Lukasa disabled auto-merge July 15, 2024 17:06
@Lukasa Lukasa merged commit b1bf036 into main Jul 15, 2024
13 of 25 checks passed
@Lukasa Lukasa deleted the fb-gha-matrix-workflow branch July 15, 2024 17:07
chkp-aviads added a commit to chkp-aviads/swift-nio that referenced this pull request Jul 21, 2024
* apple/main: (26 commits)
  [GHA] Only format Swift files that are in Git index (apple#2797)
  Ignore format commit from git blame (apple#2796)
  Adopt swift-format (apple#2794)
  Disable warnings as errors on Swift 6 and main (apple#2793)
  ChannelHandler: provide static (un)wrap(In|Out)bound(In|Out) (apple#2791)
  Add manual control to NIOLockedValueBox (apple#2786)
  [GHA] Cxx interoperability compatibility and integration tests check (apple#2790)
  [GHA] Introduce reusable matrix workflow (apple#2789)
  Fix benchmark thresholds update script (apple#2783)
  [GHA] Broken symlink and format check (apple#2787)
  [GHA] Add license header check (apple#2781)
  Improved documentation for HTTP Parts to clarify how often each part is received (apple#2775)
  [GHA] Download the scripts to make workflow reusable (apple#2785)
  Combine the two NIOAsyncChannel channel handlers (apple#2779)
  [GHA] Benchmark job (apple#2780)
  [GHA] Move docs check to script (apple#2776)
  Add benchmark for creating NIOAsyncChannel (apple#2774)
  Avoid creating a yield ID counter per async writer (apple#2768)
  [GHA] Unacceptable language check (apple#2766)
  Allow in-place mutation of `NIOLoopBoundBox.value` (apple#2771)
  ...

# Conflicts:
#	Sources/NIOPosix/BSDSocketAPICommon.swift
#	Sources/NIOPosix/GetaddrinfoResolver.swift
#	Sources/NIOPosix/HappyEyeballs.swift
cgrindel-self-hosted-renovate bot referenced this pull request in cgrindel/rules_swift_package_manager Aug 19, 2024
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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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 [@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;FranzBusch](https://togithub.com/FranzBusch) in
[https://github.com/apple/swift-nio/pull/2827](https://togithub.com/apple/swift-nio/pull/2827)

#### New Contributors

- [@&#8203;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)
- [@&#8203;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)
- [@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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
[@&#8203;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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/none No version bump required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants