Skip to content

Commit 1d25937

Browse files
authored
[GHA] Make unit tests, benchmarks and cxx interop easier to reuse (#2801)
1 parent 6630cc6 commit 1d25937

File tree

6 files changed

+178
-36
lines changed

6 files changed

+178
-36
lines changed

.github/workflows/benchmarks.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Benchmarks
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
benchmark_package_path:
7+
type: string
8+
description: "Path to the directory containing the benchmarking package. Defaults to ."
9+
default: "."
10+
swift_package_arguments:
11+
type: string
12+
description: "Arguments to the switch package command invocation e.g. `--disable-sandbox`"
13+
linux_5_8_enabled:
14+
type: boolean
15+
description: "Boolean to enable the Linux 5.8 Swift version matrix job. Defaults to true."
16+
default: true
17+
linux_5_9_enabled:
18+
type: boolean
19+
description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to true."
20+
default: true
21+
linux_5_10_enabled:
22+
type: boolean
23+
description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true."
24+
default: true
25+
linux_nightly_6_0_enabled:
26+
type: boolean
27+
description: "Boolean to enable the Linux nightly 6.0 Swift version matrix job. Defaults to true."
28+
default: true
29+
linux_nightly_main_enabled:
30+
type: boolean
31+
description: "Boolean to enable the Linux nightly main Swift version matrix job. Defaults to true."
32+
default: true
33+
34+
jobs:
35+
benchmarks:
36+
name: Benchmarks
37+
uses: ./.github/workflows/swift_matrix.yml
38+
with:
39+
name: "Benchmarks"
40+
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}/"
41+
matrix_linux_5_8_enabled: ${{ inputs.linux_5_8_enabled }}
42+
matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }}
43+
matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }}
44+
matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }}
45+
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/swift_matrix.yml
31+
with:
32+
name: "Cxx interop"
33+
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"
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

+30-34
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,39 @@
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/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_5_8_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
19+
linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
20+
linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
21+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
22+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
2323

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}/"
24+
benchmarks:
25+
name: Checks
26+
uses: ./.github/workflows/benchmarks.yml
27+
with:
28+
benchmark_package_path: "Benchmarks"
3029

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"
30+
cxx-interop:
31+
name: Checks
32+
uses: ./.github/workflows/cxx_interop.yml
3733

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"
34+
integration-tests:
35+
name: Checks / Integration Tests
36+
uses: ./.github/workflows/swift_matrix.yml
37+
with:
38+
name: "Integration tests"
39+
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/pull_request_soundness.yml renamed to .github/workflows/soundness.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pull Request
1+
name: Soundness
22

33
on:
44
workflow_call:

.github/workflows/pull_request_swift_matrix.yml renamed to .github/workflows/swift_matrix.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,4 @@ jobs:
9393
COMMAND_OVERRIDE_NIGHTLY_MAIN: ${{ inputs.matrix_linux_nightly_main_command_override }}
9494
run: |
9595
apt-get -qq update && apt-get -qq -y install curl
96-
curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.sh | bash
96+
curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.sh | bash

.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: ""
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: ""
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: ""
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: ""
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: ""
46+
47+
jobs:
48+
unit-tests:
49+
name: Unit tests
50+
uses: ./.github/workflows/swift_matrix.yml
51+
with:
52+
name: "Unit tests"
53+
matrix_linux_command: "swift test"
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)