Skip to content

Commit 00ab3b4

Browse files
committed
Migrate to GitHub Actions
Migrate CI to use GitHub Actions. Motivation: To migrate to GitHub actions and centralised infrastructure. Modifications: Changes of note: * Bump minimum Swift version to 5.9 in line with CI coverage. * Adopt NIO formatting rules * Remove scripts and docker files which are no longer needed. * Fixup minor changes in `NIOAsyncChannel` API usage Result: Feature parity with old CI plus additional soundness checks.
1 parent c63219e commit 00ab3b4

36 files changed

+515
-571
lines changed

.editorconfig

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true

.github/release.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
changelog:
2+
categories:
3+
- title: SemVer Major
4+
labels:
5+
- ⚠️ semver/major
6+
- title: SemVer Minor
7+
labels:
8+
- semver/minor
9+
- title: SemVer Patch
10+
labels:
11+
- semver/patch
12+
- title: Other Changes
13+
labels:
14+
- semver/none

.github/workflows/benchmarks.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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_9_enabled:
14+
type: boolean
15+
description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to true."
16+
default: true
17+
linux_5_10_enabled:
18+
type: boolean
19+
description: "Boolean to enable the Linux 5.10 Swift version matrix job. Defaults to true."
20+
default: true
21+
linux_6_0_enabled:
22+
type: boolean
23+
description: "Boolean to enable the Linux 6.0 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+
unit-tests:
36+
name: Unit tests
37+
runs-on: ubuntu-latest
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
# We are specifying only the major and minor of the docker images to automatically pick up the latest patch release
42+
swift:
43+
- image: "swift:5.9-jammy"
44+
swift_version: "5.9"
45+
enabled: ${{ inputs.linux_5_9_enabled }}
46+
- image: "swift:5.10-jammy"
47+
swift_version: "5.10"
48+
enabled: ${{ inputs.linux_5_10_enabled }}
49+
- image: "swift:6.0-jammy"
50+
swift_version: "6.0"
51+
enabled: ${{ inputs.linux_6_0_enabled }}
52+
- image: "swiftlang/swift:nightly-6.0-jammy"
53+
swift_version: "nightly-6.0"
54+
enabled: ${{ inputs.linux_nightly_6_0_enabled }}
55+
- image: "swiftlang/swift:nightly-main-jammy"
56+
swift_version: "nightly-main"
57+
enabled: ${{ inputs.linux_nightly_main_enabled }}
58+
steps:
59+
- name: Checkout repository
60+
if: ${{ matrix.swift.enabled }}
61+
uses: actions/checkout@v4
62+
with:
63+
persist-credentials: false
64+
submodules: true
65+
- name: Mark the workspace as safe
66+
if: ${{ matrix.swift.enabled }}
67+
# https://github.com/actions/checkout/issues/766
68+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
69+
- name: Run matrix job
70+
if: ${{ matrix.swift.enabled }}
71+
env:
72+
SWIFT_VERSION: ${{ matrix.swift.swift_version }}
73+
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}/"
74+
COMMAND_OVERRIDE_5_9: ""
75+
COMMAND_OVERRIDE_5_10: ""
76+
COMMAND_OVERRIDE_6_0: ""
77+
COMMAND_OVERRIDE_NIGHTLY_6_0: ""
78+
COMMAND_OVERRIDE_NIGHTLY_MAIN: ""
79+
run: |
80+
apt-get -qq update && apt-get -qq -y install curl
81+
curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.sh | bash
82+
container:
83+
image: ${{ matrix.swift.image }}
84+
services:
85+
memcached:
86+
image: memcached:latest

.github/workflows/main.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
schedule:
7+
- cron: "0 8,20 * * *"
8+
9+
jobs:
10+
unit-tests:
11+
name: Unit tests
12+
uses: ./.github/workflows/unit_tests.yml
13+
with:
14+
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -strict-concurrency=complete"
15+
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -strict-concurrency=complete"
16+
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
17+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
18+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
19+
20+
benchmarks:
21+
name: Benchmarks
22+
uses: apple/swift-nio/.github/workflows/benchmarks.yml@main
23+
with:
24+
benchmark_package_path: "Benchmarks"

.github/workflows/pull_request.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize]
6+
7+
jobs:
8+
soundness:
9+
name: Soundness
10+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
11+
with:
12+
license_header_check_project_name: "swift-memcache-gsoc"
13+
14+
unit-tests:
15+
name: Unit tests
16+
uses: ./.github/workflows/unit_tests.yml
17+
with:
18+
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -strict-concurrency=complete"
19+
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -strict-concurrency=complete"
20+
linux_6_0_arguments_override: "--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"
23+
24+
benchmarks:
25+
name: Benchmarks
26+
uses: ./.github/workflows/benchmarks.yml
27+
with:
28+
benchmark_package_path: "Benchmarks"
29+
swift_package_arguments: "--disable-sandbox"
30+
31+
cxx-interop:
32+
name: Cxx interop
33+
uses: apple/swift-nio/.github/workflows/cxx_interop.yml@main
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: PR label
2+
3+
on:
4+
pull_request:
5+
types: [labeled, unlabeled, opened, reopened, synchronize]
6+
7+
jobs:
8+
semver-label-check:
9+
name: Semantic version label check
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 1
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
with:
16+
persist-credentials: false
17+
- name: Check for Semantic Version label
18+
uses: apple/swift-nio/.github/actions/pull_request_semver_label_checker@main

.github/workflows/unit_tests.yml

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Unit tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
linux_5_9_enabled:
7+
type: boolean
8+
description: "Boolean to enable the Linux 5.9 Swift version matrix job. Defaults to true."
9+
default: true
10+
linux_5_9_arguments_override:
11+
type: string
12+
description: "The arguments passed to swift test in the Linux 5.9 Swift version matrix job."
13+
default: ""
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_5_10_arguments_override:
19+
type: string
20+
description: "The arguments passed to swift test in the Linux 5.10 Swift version matrix job."
21+
default: ""
22+
linux_6_0_enabled:
23+
type: boolean
24+
description: "Boolean to enable the Linux 6.0 Swift version matrix job. Defaults to true."
25+
default: true
26+
linux_6_0_arguments_override:
27+
type: string
28+
description: "The arguments passed to swift test in the Linux 6.0 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+
runs-on: ubuntu-latest
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
# We are specifying only the major and minor of the docker images to automatically pick up the latest patch release
55+
swift:
56+
- image: "swift:5.9-jammy"
57+
swift_version: "5.9"
58+
enabled: ${{ inputs.linux_5_9_enabled }}
59+
- image: "swift:5.10-jammy"
60+
swift_version: "5.10"
61+
enabled: ${{ inputs.linux_5_10_enabled }}
62+
- image: "swift:6.0-jammy"
63+
swift_version: "6.0"
64+
enabled: ${{ inputs.linux_6_0_enabled }}
65+
- image: "swiftlang/swift:nightly-6.0-jammy"
66+
swift_version: "nightly-6.0"
67+
enabled: ${{ inputs.linux_nightly_6_0_enabled }}
68+
- image: "swiftlang/swift:nightly-main-jammy"
69+
swift_version: "nightly-main"
70+
enabled: ${{ inputs.linux_nightly_main_enabled }}
71+
steps:
72+
- name: Checkout repository
73+
if: ${{ matrix.swift.enabled }}
74+
uses: actions/checkout@v4
75+
with:
76+
persist-credentials: false
77+
submodules: true
78+
- name: Mark the workspace as safe
79+
if: ${{ matrix.swift.enabled }}
80+
# https://github.com/actions/checkout/issues/766
81+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
82+
- name: Run matrix job
83+
if: ${{ matrix.swift.enabled }}
84+
env:
85+
SWIFT_VERSION: ${{ matrix.swift.swift_version }}
86+
COMMAND: "swift test"
87+
COMMAND_OVERRIDE_5_9: "swift test ${{ inputs.linux_5_9_arguments_override }}"
88+
COMMAND_OVERRIDE_5_10: "swift test ${{ inputs.linux_5_10_arguments_override }}"
89+
COMMAND_OVERRIDE_6_0: "swift test ${{ inputs.linux_6_0_arguments_override }}"
90+
COMMAND_OVERRIDE_NIGHTLY_6_0: "swift test ${{ inputs.linux_nightly_6_0_arguments_override }}"
91+
COMMAND_OVERRIDE_NIGHTLY_MAIN: "swift test ${{ inputs.linux_nightly_main_arguments_override }}"
92+
run: |
93+
apt-get -qq update && apt-get -qq -y install curl
94+
curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.sh | bash
95+
container:
96+
image: ${{ matrix.swift.image }}
97+
services:
98+
memcached:
99+
image: memcached:latest

.licenseignore

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
.gitignore
2+
**/.gitignore
3+
.licenseignore
4+
.gitattributes
5+
.git-blame-ignore-revs
6+
.mailfilter
7+
.mailmap
8+
.spi.yml
9+
.swift-format
10+
.swiftformatignore
11+
.editorconfig
12+
.github/*
13+
*.md
14+
*.txt
15+
*.yml
16+
*.yaml
17+
*.json
18+
Package.swift
19+
**/Package.swift
20+
Package@-*.swift
21+
**/Package@-*.swift
22+
Package.resolved
23+
**/Package.resolved
24+
Makefile
25+
*.modulemap
26+
**/*.modulemap
27+
**/*.docc/*
28+
*.xcprivacy
29+
**/*.xcprivacy
30+
*.symlink
31+
**/*.symlink
32+
Dockerfile
33+
**/Dockerfile
34+
Snippets/*
35+
dev/git.commit.template
36+
.unacceptablelanguageignore

.swift-format

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"version" : 1,
3+
"indentation" : {
4+
"spaces" : 4
5+
},
6+
"tabWidth" : 4,
7+
"fileScopedDeclarationPrivacy" : {
8+
"accessLevel" : "private"
9+
},
10+
"spacesAroundRangeFormationOperators" : false,
11+
"indentConditionalCompilationBlocks" : false,
12+
"indentSwitchCaseLabels" : false,
13+
"lineBreakAroundMultilineExpressionChainComponents" : false,
14+
"lineBreakBeforeControlFlowKeywords" : false,
15+
"lineBreakBeforeEachArgument" : true,
16+
"lineBreakBeforeEachGenericRequirement" : true,
17+
"lineLength" : 120,
18+
"maximumBlankLines" : 1,
19+
"respectsExistingLineBreaks" : true,
20+
"prioritizeKeepingFunctionOutputTogether" : true,
21+
"noAssignmentInExpressions" : {
22+
"allowedFunctions" : [
23+
"XCTAssertNoThrow",
24+
"XCTAssertThrowsError"
25+
]
26+
},
27+
"rules" : {
28+
"AllPublicDeclarationsHaveDocumentation" : false,
29+
"AlwaysUseLiteralForEmptyCollectionInit" : false,
30+
"AlwaysUseLowerCamelCase" : false,
31+
"AmbiguousTrailingClosureOverload" : true,
32+
"BeginDocumentationCommentWithOneLineSummary" : false,
33+
"DoNotUseSemicolons" : true,
34+
"DontRepeatTypeInStaticProperties" : true,
35+
"FileScopedDeclarationPrivacy" : true,
36+
"FullyIndirectEnum" : true,
37+
"GroupNumericLiterals" : true,
38+
"IdentifiersMustBeASCII" : true,
39+
"NeverForceUnwrap" : false,
40+
"NeverUseForceTry" : false,
41+
"NeverUseImplicitlyUnwrappedOptionals" : false,
42+
"NoAccessLevelOnExtensionDeclaration" : true,
43+
"NoAssignmentInExpressions" : true,
44+
"NoBlockComments" : true,
45+
"NoCasesWithOnlyFallthrough" : true,
46+
"NoEmptyTrailingClosureParentheses" : true,
47+
"NoLabelsInCasePatterns" : true,
48+
"NoLeadingUnderscores" : false,
49+
"NoParensAroundConditions" : true,
50+
"NoVoidReturnOnFunctionSignature" : true,
51+
"OmitExplicitReturns" : true,
52+
"OneCasePerLine" : true,
53+
"OneVariableDeclarationPerLine" : true,
54+
"OnlyOneTrailingClosureArgument" : true,
55+
"OrderedImports" : true,
56+
"ReplaceForEachWithForLoop" : true,
57+
"ReturnVoidInsteadOfEmptyTuple" : true,
58+
"UseEarlyExits" : false,
59+
"UseExplicitNilCheckInConditions" : false,
60+
"UseLetInEveryBoundCaseVariable" : false,
61+
"UseShorthandTypeNames" : true,
62+
"UseSingleLinePropertyGetter" : false,
63+
"UseSynthesizedInitializer" : false,
64+
"UseTripleSlashForDocumentationComments" : true,
65+
"UseWhereClausesInForLoops" : false,
66+
"ValidateDocumentationComments" : false
67+
}
68+
}

0 commit comments

Comments
 (0)