Skip to content

Commit e768c1e

Browse files
authored
Migrate to GitHub Actions (#175)
Migrate CI to use GitHub Actions. ### Motivation: To migrate to GitHub actions and centralised infrastructure. ### Modifications: Changes of note: * Bump the minimum version to Swift 5.9 in line with CI coverage * Adopt swift-format using rules from SwiftNIO * Remove scripts which are no longer needed ### Result: GitHub Actions CI Future improvements: * Re-enable `--warnings-as-errors` * Investigate extending re-used workflows to enable specifying setup commands and services to allow us to drop the bespoke workflows here. * Enable API breakage checks * Set thresholds and enable Benchmarks * Enable documentation checking
1 parent 1638b32 commit e768c1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+754
-485
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
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

.flake8

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[flake8]
2+
3+
ignore =
4+
# These are needed to make our license headers pass the linting
5+
E265,
6+
E266,
7+
8+
# 10% larger than the standard 80 character limit. Conforms to the black
9+
# standard and Bugbear's B950.
10+
max-line-length = 88
11+
12+
# Custom rules:
13+
exclude =
14+
Sources/Crdkafka/
15+
Sources/COpenSSL/

.github/release.yml

Lines changed: 14 additions & 0 deletions
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/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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"

.github/workflows/pull_request.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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-kafka-client"
13+
api_breakage_check_enabled: false # requires libsasl2-dev
14+
docs_check_enabled: false # requires libsasl2-dev
15+
16+
unit-tests:
17+
name: Unit tests
18+
uses: ./.github/workflows/unit_tests.yml
19+
with:
20+
linux_5_9_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -strict-concurrency=complete"
21+
linux_5_10_arguments_override: "--explicit-target-dependency-import-check error -Xswiftc -strict-concurrency=complete"
22+
linux_6_0_arguments_override: "--explicit-target-dependency-import-check error"
23+
linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error"
24+
linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"
25+
26+
cxx-interop:
27+
name: Cxx interop
28+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
29+
with:
30+
name: "Cxx interop"
31+
matrix_linux_command: "apt-get update -y -q && apt-get install -y -q jq && apt-get -y install libsasl2-dev && curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-cxx-interop-compatibility.sh | bash"
32+
matrix_linux_5_9_enabled: true
33+
matrix_linux_5_10_enabled: true
34+
matrix_linux_6_0_enabled: true
35+
matrix_linux_nightly_6_0_enabled: true
36+
matrix_linux_nightly_main_enabled: true
37+
matrix_windows_6_0_enabled: false
38+
matrix_windows_nightly_6_0_enabled: false
39+
matrix_windows_nightly_main_enabled: false
Lines changed: 18 additions & 0 deletions
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

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
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 && apt-get -y install libsasl2-dev
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+
zookeeper:
99+
image: ubuntu/zookeeper
100+
kafka:
101+
image: ubuntu/kafka
102+
env:
103+
ZOOKEEPER_HOST: zookeeper
104+
env:
105+
KAFKA_HOST: kafka

.licenseignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.dockerignore
2+
.gitignore
3+
**/.gitignore
4+
.licenseignore
5+
.gitattributes
6+
.gitmodules
7+
.git-blame-ignore-revs
8+
.mailfilter
9+
.mailmap
10+
.spi.yml
11+
.swift-format
12+
.swiftformatignore
13+
.editorconfig
14+
.yamlignore
15+
.github/*
16+
.yamllint.yml
17+
.flake8
18+
*.md
19+
*.txt
20+
*.yml
21+
*.yaml
22+
*.json
23+
Package.swift
24+
**/Package.swift
25+
Package@-*.swift
26+
**/Package@-*.swift
27+
Package.resolved
28+
**/Package.resolved
29+
Makefile
30+
*.modulemap
31+
**/*.modulemap
32+
**/*.docc/*
33+
*.xcprivacy
34+
**/*.xcprivacy
35+
*.symlink
36+
**/*.symlink
37+
Dockerfile
38+
**/Dockerfile
39+
Snippets/*
40+
dev/git.commit.template
41+
.unacceptablelanguageignore
42+
Sources/Crdkafka/*
43+
Sources/COpenSSL/*

.spi.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version: 1
2+
builder:
3+
configs:
4+
- documentation_targets: [Kafka, KafkaFoundationCompat]

.swift-format

Lines changed: 68 additions & 0 deletions
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)