-
Notifications
You must be signed in to change notification settings - Fork 652
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
Changes from 4 commits
bf5cabe
9ad513d
12bd6c5
e0372b2
5cb864f
9bc8b3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Benchmarks | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
benchmark_package_path: | ||
type: string | ||
description: "Path to the directory containing the benchmarking package. Defaults to ." | ||
default: "." | ||
swift_package_arguments: | ||
type: string | ||
description: "Arguments to the switch package command invocation e.g. `--disable-sandbox`" | ||
linux_5_8_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux 5.8 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_5_9_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_5_10_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_nightly_6_0_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux nightly 6.0 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_nightly_main_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true." | ||
default: true | ||
|
||
jobs: | ||
benchmarks: | ||
name: Benchmarks | ||
uses: ./.github/workflows/swift_matrix.yml | ||
with: | ||
name: "Benchmarks" | ||
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q libjemalloc-dev && swift package --package-path ${{ inputs.benchmark_package_path }} ${{ inputs.swift_package_arguments }} benchmark baseline check --check-absolute-path ${{ inputs.benchmark_package_path }}/Thresholds/${SWIFT_VERSION}/" | ||
matrix_linux_5_8_enabled: ${{ inputs.linux_5_8_enabled }} | ||
matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }} | ||
matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }} | ||
matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }} | ||
matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Cxx interop | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
linux_5_8_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux 5.8 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_5_9_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_5_10_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_nightly_6_0_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux nightly 6.0 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_nightly_main_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true." | ||
default: true | ||
|
||
jobs: | ||
cxx-interop: | ||
name: Cxx interop | ||
uses: ./.github/workflows/swift_matrix.yml | ||
with: | ||
name: "Cxx interop" | ||
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q jq && curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-cxx-interop-compatibility.sh | bash" | ||
matrix_linux_5_8_enabled: ${{ inputs.linux_5_8_enabled }} | ||
matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }} | ||
matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }} | ||
matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }} | ||
matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,36 @@ | ||
name: Pull Request | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
call-pull-request-soundness-workflow: | ||
name: Soundness | ||
uses: ./.github/workflows/pull_request_soundness.yml | ||
with: | ||
license_header_check_project_name: "SwiftNIO" | ||
soundness: | ||
name: Soundness | ||
uses: ./.github/workflows/soundness.yml | ||
with: | ||
license_header_check_project_name: "SwiftNIO" | ||
|
||
call-pull-request-unit-tests-workflow: | ||
name: Unit tests | ||
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" | ||
# Disable warnings as errors: Swift 6 emits sendability warnings that haven't been dealt with yet. | ||
matrix_linux_nightly_main_command_override: "swift test --explicit-target-dependency-import-check error" | ||
matrix_linux_nightly_6_0_command_override: "swift test --explicit-target-dependency-import-check error" | ||
unit-tests: | ||
name: Checks | ||
uses: ./.github/workflows/unit_tests.yml | ||
with: | ||
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error" | ||
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error" | ||
|
||
call-pull-request-benchmark-workflow: | ||
name: Benchmarks | ||
uses: ./.github/workflows/pull_request_swift_matrix.yml | ||
with: | ||
name: "Benchmarks" | ||
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q libjemalloc-dev && swift package --package-path Benchmarks/ --disable-sandbox benchmark baseline check --check-absolute-path Benchmarks/Thresholds/${SWIFT_VERSION}/" | ||
benchmarks: | ||
name: Checks | ||
uses: ./.github/workflows/benchmarks.yml | ||
with: | ||
benchmark_package_path: "Benchmarks" | ||
|
||
call-pull-request-cxx-interop-workflow: | ||
name: Cxx interop | ||
uses: ./.github/workflows/pull_request_swift_matrix.yml | ||
with: | ||
name: "Cxx interop" | ||
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q jq && ./scripts/check-cxx-interop-compatibility.sh" | ||
cxx-interop: | ||
name: Checks | ||
uses: ./.github/workflows/cxx_interop.yml | ||
|
||
call-pull-request-integration-tests-workflow: | ||
name: Integration tests | ||
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" | ||
integration-tests: | ||
name: Checks | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A bunch of these all share the same There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, fine. |
||
uses: ./.github/workflows/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" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Pull Request | ||
name: Soundness | ||
|
||
on: | ||
workflow_call: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Unit tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
linux_5_8_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux 5.8 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_5_8_arguments_override: | ||
type: string | ||
description: "The arguments passed to swift test in the Linux 5.8 Swift version matrix job." | ||
default: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" | ||
linux_5_9_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_5_9_arguments_override: | ||
type: string | ||
description: "The arguments passed to swift test in the Linux 5.9 Swift version matrix job." | ||
default: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" | ||
linux_5_10_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_5_10_arguments_override: | ||
type: string | ||
description: "The arguments passed to swift test in the Linux 5.10 Swift version matrix job." | ||
default: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" | ||
linux_nightly_6_0_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux nightly 6.0 Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_nightly_6_0_arguments_override: | ||
type: string | ||
description: "The arguments passed to swift test in the Linux nightly 6.0 Swift version matrix job." | ||
default: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" | ||
linux_nightly_main_enabled: | ||
type: boolean | ||
description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true." | ||
default: true | ||
linux_nightly_main_arguments_override: | ||
type: string | ||
description: "The arguments passed to swift test in the Linux nightly main Swift version matrix job." | ||
default: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" | ||
|
||
jobs: | ||
unit-tests: | ||
name: Unit tests | ||
uses: ./.github/workflows/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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You convinced me and I removed the default args now. |
||
matrix_linux_5_8_enabled: ${{ inputs.linux_5_8_enabled }} | ||
matrix_linux_5_8_command_override: "swift test ${{ inputs.linux_5_8_arguments_override }}" | ||
matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }} | ||
matrix_linux_5_9_command_override: "swift test ${{ inputs.linux_5_9_arguments_override }}" | ||
matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }} | ||
matrix_linux_5_10_command_override: "swift test ${{ inputs.linux_5_10_arguments_override }}" | ||
matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }} | ||
matrix_linux_nightly_6_0_command_override: "swift test ${{ inputs.linux_nightly_6_0_arguments_override }}" | ||
matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }} | ||
matrix_linux_nightly_main_command_override: "swift test ${{ inputs.linux_nightly_main_arguments_override }}" |
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.