Skip to content

Commit b0885b4

Browse files
committed
[GHA] Make unit tests, benchmarks and cxx interop easier to reuse
# 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.
1 parent 4feff3c commit b0885b4

File tree

4 files changed

+164
-34
lines changed

4 files changed

+164
-34
lines changed

.github/workflows/benchmarks.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Benchmarks
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
linux_5_8_enabled:
7+
type: boolean
8+
description: "Boolean to enable the Linux 5.8 Swift version matrix job. Defaults to true."
9+
default: true
10+
linux_5_9_enabled:
11+
type: boolean
12+
description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to true."
13+
default: true
14+
linux_5_10_enabled:
15+
type: boolean
16+
description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true."
17+
default: true
18+
linux_nightly_6_0_enabled:
19+
type: boolean
20+
description: "Boolean to enable the Linux nightly 6.0 Swift version matrix job. Defaults to true."
21+
default: true
22+
linux_nightly_main_enabled:
23+
type: boolean
24+
description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true."
25+
default: true
26+
27+
jobs:
28+
benchmarks:
29+
name: Benchmarks
30+
uses: ./.github/workflows/pull_request_swift_matrix.yml
31+
with:
32+
name: "Benchmarks"
33+
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}/"
34+
matrix_linux_5_8_enabled: ${{ inputs.linux_5_8_enabled }}
35+
matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }}
36+
matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }}
37+
matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }}
38+
matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }}

.github/workflows/cxx_interop.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Cxx interop
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
linux_5_8_enabled:
7+
type: boolean
8+
description: "Boolean to enable the Linux 5.8 Swift version matrix job. Defaults to true."
9+
default: true
10+
linux_5_9_enabled:
11+
type: boolean
12+
description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to true."
13+
default: true
14+
linux_5_10_enabled:
15+
type: boolean
16+
description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true."
17+
default: true
18+
linux_nightly_6_0_enabled:
19+
type: boolean
20+
description: "Boolean to enable the Linux nightly 6.0 Swift version matrix job. Defaults to true."
21+
default: true
22+
linux_nightly_main_enabled:
23+
type: boolean
24+
description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true."
25+
default: true
26+
27+
jobs:
28+
cxx-interop:
29+
name: Cxx interop
30+
uses: ./.github/workflows/pull_request_swift_matrix.yml
31+
with:
32+
name: "Cxx interop"
33+
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q jq && ./scripts/check-cxx-interop-compatibility.sh"
34+
matrix_linux_5_8_enabled: ${{ inputs.linux_5_8_enabled }}
35+
matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }}
36+
matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }}
37+
matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }}
38+
matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }}

.github/workflows/pull_request.yml

+25-34
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,34 @@
11
name: Pull Request
22

33
on:
4-
pull_request:
5-
types: [opened, reopened, synchronize]
4+
pull_request:
5+
types: [opened, reopened, synchronize]
66

77
jobs:
8-
call-pull-request-soundness-workflow:
9-
name: Soundness
10-
uses: ./.github/workflows/pull_request_soundness.yml
11-
with:
12-
license_header_check_project_name: "SwiftNIO"
8+
soundness:
9+
name: Soundness
10+
uses: ./.github/workflows/pull_request_soundness.yml
11+
with:
12+
license_header_check_project_name: "SwiftNIO"
1313

14-
call-pull-request-unit-tests-workflow:
15-
name: Unit tests
16-
uses: ./.github/workflows/pull_request_swift_matrix.yml
17-
with:
18-
name: "Unit tests"
19-
matrix_linux_command: "swift test -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
20-
# Disable warnings as errors: Swift 6 emits sendability warnings that haven't been dealt with yet.
21-
matrix_linux_nightly_main_command_override: "swift test --explicit-target-dependency-import-check error"
22-
matrix_linux_nightly_6_0_command_override: "swift test --explicit-target-dependency-import-check error"
14+
unit-tests:
15+
name: Checks
16+
uses: ./.github/workflows/unit_tests.yml
17+
with:
18+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
19+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
2320

24-
call-pull-request-benchmark-workflow:
25-
name: Benchmarks
26-
uses: ./.github/workflows/pull_request_swift_matrix.yml
27-
with:
28-
name: "Benchmarks"
29-
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}/"
21+
benchmarks:
22+
name: Checks
23+
uses: ./.github/workflows/benchmarks.yml
3024

31-
call-pull-request-cxx-interop-workflow:
32-
name: Cxx interop
33-
uses: ./.github/workflows/pull_request_swift_matrix.yml
34-
with:
35-
name: "Cxx interop"
36-
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q jq && ./scripts/check-cxx-interop-compatibility.sh"
25+
cxx-interop:
26+
name: Checks
27+
uses: ./.github/workflows/cxx_interop.yml
3728

38-
call-pull-request-integration-tests-workflow:
39-
name: Integration tests
40-
uses: ./.github/workflows/pull_request_swift_matrix.yml
41-
with:
42-
name: "Integration tests"
43-
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"
29+
integration-tests:
30+
name: Checks
31+
uses: ./.github/workflows/pull_request_swift_matrix.yml
32+
with:
33+
name: "Integration tests"
34+
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"

.github/workflows/unit_tests.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Unit tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
linux_5_8_enabled:
7+
type: boolean
8+
description: "Boolean to enable the Linux 5.8 Swift version matrix job. Defaults to true."
9+
default: true
10+
linux_5_8_arguments_override:
11+
type: string
12+
description: "The arguments passed to swift test in the Linux 5.8 Swift version matrix job."
13+
default: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
14+
linux_5_9_enabled:
15+
type: boolean
16+
description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to true."
17+
default: true
18+
linux_5_9_arguments_override:
19+
type: string
20+
description: "The arguments passed to swift test in the Linux 5.9 Swift version matrix job."
21+
default: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
22+
linux_5_10_enabled:
23+
type: boolean
24+
description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true."
25+
default: true
26+
linux_5_10_arguments_override:
27+
type: string
28+
description: "The arguments passed to swift test in the Linux 5.10 Swift version matrix job."
29+
default: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
30+
linux_nightly_6_0_enabled:
31+
type: boolean
32+
description: "Boolean to enable the Linux nightly 6.0 Swift version matrix job. Defaults to true."
33+
default: true
34+
linux_nightly_6_0_arguments_override:
35+
type: string
36+
description: "The arguments passed to swift test in the Linux nightly 6.0 Swift version matrix job."
37+
default: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
38+
linux_nightly_main_enabled:
39+
type: boolean
40+
description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true."
41+
default: true
42+
linux_nightly_main_arguments_override:
43+
type: string
44+
description: "The arguments passed to swift test in the Linux nightly main Swift version matrix job."
45+
default: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
46+
47+
jobs:
48+
unit-tests:
49+
name: Unit tests
50+
uses: ./.github/workflows/pull_request_swift_matrix.yml
51+
with:
52+
name: "Unit tests"
53+
matrix_linux_command: "swift test -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
54+
matrix_linux_5_8_enabled: ${{ inputs.linux_5_8_enabled }}
55+
matrix_linux_5_8_command_override: "swift test ${{ inputs.linux_5_8_arguments_override }}"
56+
matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }}
57+
matrix_linux_5_9_command_override: "swift test ${{ inputs.linux_5_9_arguments_override }}"
58+
matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }}
59+
matrix_linux_5_10_command_override: "swift test ${{ inputs.linux_5_10_arguments_override }}"
60+
matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }}
61+
matrix_linux_nightly_6_0_command_override: "swift test ${{ inputs.linux_nightly_6_0_arguments_override }}"
62+
matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }}
63+
matrix_linux_nightly_main_command_override: "swift test ${{ inputs.linux_nightly_main_arguments_override }}"

0 commit comments

Comments
 (0)