Skip to content

Commit cbebbf9

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 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: Feature parity with old CI. Future improvements: * Enable API breakage checks * Enable YAML linting * Enable Python linting * Set thresholds and enable Benchmarks
1 parent 1638b32 commit cbebbf9

Some content is hidden

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

48 files changed

+670
-486
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.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

.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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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

.github/workflows/pull_request.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
yamllint_check_enabled: false # failures in librdkafka, need .yamlignore support
15+
python_lint_check_enabled: false # requires librdkafka, need --exclude support
16+
17+
unit-tests:
18+
name: Unit tests
19+
uses: ./.github/workflows/unit-tests.yml
20+
21+
cxx-interop:
22+
name: Cxx interop
23+
uses: apple/swift-nio/.github/workflows/swift_matrix.yml@main
24+
with:
25+
name: "Cxx interop"
26+
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"
27+
matrix_linux_5_9_enabled: ${{ inputs.linux_5_9_enabled }}
28+
matrix_linux_5_10_enabled: ${{ inputs.linux_5_10_enabled }}
29+
matrix_linux_6_0_enabled: ${{ inputs.linux_6_0_enabled }}
30+
matrix_linux_nightly_6_0_enabled: ${{ inputs.linux_nightly_6_0_enabled }}
31+
matrix_linux_nightly_main_enabled: ${{ inputs.linux_nightly_main_enabled }}
32+
matrix_windows_6_0_enabled: ${{ inputs.windows_6_0_enabled }}
33+
matrix_windows_nightly_6_0_enabled: ${{ inputs.windows_nightly_6_0_enabled }}
34+
matrix_windows_nightly_main_enabled: ${{ inputs.windows_nightly_main_enabled }}
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: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Unit tests
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
unit-tests:
8+
name: Unit tests
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
# We are specifying only the major and minor of the docker images to automatically pick up the latest patch release
14+
swift:
15+
- image: "swift:5.9-jammy"
16+
swift_version: "5.9"
17+
enabled: true
18+
- image: "swift:5.10-jammy"
19+
swift_version: "5.10"
20+
enabled: true
21+
- image: "swift:6.0-jammy"
22+
swift_version: "6.0"
23+
enabled: true
24+
- image: "swiftlang/swift:nightly-6.0-jammy"
25+
swift_version: "nightly-6.0"
26+
enabled: true
27+
- image: "swiftlang/swift:nightly-main-jammy"
28+
swift_version: "nightly-main"
29+
enabled: true
30+
steps:
31+
- name: Checkout repository
32+
if: ${{ matrix.swift.enabled }}
33+
uses: actions/checkout@v4
34+
with:
35+
persist-credentials: false
36+
submodules: true
37+
- name: Mark the workspace as safe
38+
if: ${{ matrix.swift.enabled }}
39+
# https://github.com/actions/checkout/issues/766
40+
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
41+
- name: Run matrix job
42+
if: ${{ matrix.swift.enabled }}
43+
env:
44+
SWIFT_VERSION: ${{ matrix.swift.swift_version }}
45+
COMMAND: "swift"
46+
COMMAND_OVERRIDE_5_9: "swift test -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -strict-concurrency=complete"
47+
COMMAND_OVERRIDE_5_10: "swift test -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error -Xswiftc -strict-concurrency=complete"
48+
COMMAND_OVERRIDE_6_0: "swift test --explicit-target-dependency-import-check error"
49+
COMMAND_OVERRIDE_NIGHTLY_6_0: "swift test -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
50+
COMMAND_OVERRIDE_NIGHTLY_MAIN: "swift test -Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error"
51+
run: |
52+
apt-get -qq update && apt-get -qq -y install curl && apt-get -y install libsasl2-dev
53+
curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.sh | bash
54+
container:
55+
image: ${{ matrix.swift.image }}
56+
services:
57+
zookeeper:
58+
image: ubuntu/zookeeper
59+
kafka:
60+
image: ubuntu/kafka
61+
env:
62+
ZOOKEEPER_HOST: zookeeper
63+
env:
64+
KAFKA_HOST: kafka

.licenseignore

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

.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+
}

.swiftformat

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)