Skip to content

Commit 4595351

Browse files
committed
docs: standardize package with README, CI/CD, and validation tests
1 parent 449d929 commit 4595351

File tree

11 files changed

+581
-105
lines changed

11 files changed

+581
-105
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "swift"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "monthly"

.github/workflows/ci.yml

Lines changed: 73 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,80 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
67
pull_request:
7-
branches: [ main ]
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ci-${{ github.ref }}
14+
cancel-in-progress: true
815

916
jobs:
10-
test:
11-
runs-on: macos-latest
12-
17+
# Primary development workflow: Latest Swift on macOS with debug build
18+
macos-latest:
19+
name: macOS (Swift 6.2, debug)
20+
runs-on: macos-26
21+
steps:
22+
- uses: actions/checkout@v5
23+
24+
- name: Select Xcode 26.0
25+
run: sudo xcode-select -s /Applications/Xcode_26.0.app
26+
27+
- name: Print Swift version
28+
run: swift --version
29+
30+
- name: Cache Swift packages
31+
uses: actions/cache@v4
32+
with:
33+
path: .build
34+
key: ${{ runner.os }}-spm-${{ hashFiles('Package.swift') }}
35+
restore-keys: |
36+
${{ runner.os }}-spm-
37+
38+
# Note: swift test builds automatically, no separate build step needed
39+
- name: Test
40+
run: swift test -c debug
41+
42+
- name: Validate Package.swift
43+
run: swift package dump-package
44+
45+
# Production validation: Latest Swift on Linux with release build
46+
linux-latest:
47+
name: Ubuntu (Swift 6.2, release)
48+
runs-on: ubuntu-latest
49+
container: swift:6.2
1350
steps:
14-
- uses: actions/checkout@v4
15-
16-
- name: Setup Swift
17-
uses: swift-actions/setup-swift@v2
18-
with:
19-
swift-version: "6.0"
20-
21-
- name: Build
22-
run: swift build
23-
24-
- name: Run tests
25-
run: swift test
26-
27-
- name: Check Swift format
28-
run: |
29-
if command -v swiftformat >/dev/null 2>&1; then
30-
swiftformat --lint .
31-
else
32-
echo "swiftformat not installed, skipping format check"
33-
fi
51+
- uses: actions/checkout@v5
52+
53+
- name: Cache Swift packages
54+
uses: actions/cache@v4
55+
with:
56+
path: .build
57+
key: ${{ runner.os }}-spm-${{ hashFiles('Package.swift') }}
58+
restore-keys: ${{ runner.os }}-spm-
59+
60+
# Note: swift test builds automatically in release mode
61+
- name: Test (release)
62+
run: swift test -c release
63+
64+
# Compatibility check: Minimum supported Swift version (6.0)
65+
linux-compat:
66+
name: Ubuntu (Swift 6.0, compatibility)
67+
runs-on: ubuntu-latest
68+
container: swift:6.0
69+
steps:
70+
- uses: actions/checkout@v5
71+
72+
- name: Cache Swift packages
73+
uses: actions/cache@v4
74+
with:
75+
path: .build
76+
key: ${{ runner.os }}-swift60-spm-${{ hashFiles('Package.swift') }}
77+
restore-keys: ${{ runner.os }}-swift60-spm-
78+
79+
# Note: swift test builds automatically
80+
- name: Test (Swift 6.0)
81+
run: swift test -c release

.github/workflows/swift-format.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Swift Format
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: format-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
swift_format:
14+
name: swift-format
15+
runs-on: ubuntu-latest
16+
container: swift:6.0
17+
permissions:
18+
contents: write
19+
steps:
20+
- uses: actions/checkout@v5
21+
22+
- name: Cache swift-format
23+
id: cache-swift-format
24+
uses: actions/cache@v4
25+
with:
26+
path: /usr/local/bin/swift-format
27+
key: ${{ runner.os }}-swift-format-${{ hashFiles('.github/workflows/swift-format.yml') }}
28+
29+
- name: Install swift-format
30+
if: steps.cache-swift-format.outputs.cache-hit != 'true'
31+
run: |
32+
git clone --depth 1 --branch main https://github.com/apple/swift-format.git
33+
cd swift-format
34+
swift build -c release
35+
cp .build/release/swift-format /usr/local/bin/
36+
cd ..
37+
rm -rf swift-format
38+
39+
- name: Format
40+
run: swift-format format --ignore-unparsable-files --recursive --in-place Sources Tests
41+
42+
- uses: stefanzweifel/git-auto-commit-action@v7
43+
with:
44+
commit_message: Run swift-format
45+
branch: 'main'

.github/workflows/swiftlint.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: SwiftLint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: swiftlint-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
lint:
17+
name: SwiftLint
18+
runs-on: ubuntu-latest
19+
container: swift:6.2
20+
steps:
21+
- uses: actions/checkout@v5
22+
23+
- name: Restore swiftlint cache
24+
id: cache-swiftlint-restore
25+
uses: actions/cache/restore@v4
26+
with:
27+
path: /usr/local/bin/swiftlint
28+
key: ${{ runner.os }}-swiftlint-0.62.2
29+
30+
- name: Install swiftlint
31+
if: steps.cache-swiftlint-restore.outputs.cache-hit != 'true'
32+
run: |
33+
git clone --depth 1 --branch 0.62.2 https://github.com/realm/SwiftLint.git
34+
cd SwiftLint
35+
swift build -c release
36+
cp .build/release/swiftlint /usr/local/bin/
37+
cd ..
38+
rm -rf SwiftLint
39+
40+
- name: Lint
41+
run: swiftlint lint --strict --reporter github-actions-logging
42+
43+
- name: Save swiftlint cache
44+
uses: actions/cache/save@v4
45+
if: always() && steps.cache-swiftlint-restore.outputs.cache-hit != 'true'
46+
with:
47+
path: /usr/local/bin/swiftlint
48+
key: ${{ runner.os }}-swiftlint-0.62.2

.swift-format

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"version": 1,
3+
"lineLength": 100,
4+
"indentation": {
5+
"spaces": 4
6+
},
7+
"tabWidth": 8,
8+
"maximumBlankLines": 1,
9+
"respectsExistingLineBreaks": true,
10+
"lineBreakBeforeControlFlowKeywords": false,
11+
"lineBreakBeforeEachArgument": true,
12+
"lineBreakBeforeEachGenericRequirement": false,
13+
"prioritizeKeepingFunctionOutputTogether": true,
14+
"indentConditionalCompilationBlocks": true,
15+
"lineBreakAroundMultilineExpressionChainComponents": false,
16+
"fileScopedDeclarationPrivacy": {
17+
"accessLevel": "private"
18+
},
19+
"rules": {
20+
"AllPublicDeclarationsHaveDocumentation": false,
21+
"AlwaysUseLowerCamelCase": true,
22+
"AmbiguousTrailingClosureOverload": true,
23+
"BeginDocumentationCommentWithOneLineSummary": false,
24+
"DoNotUseSemicolons": true,
25+
"DontRepeatTypeInStaticProperties": true,
26+
"FileScopedDeclarationPrivacy": true,
27+
"FullyIndirectEnum": true,
28+
"GroupNumericLiterals": true,
29+
"IdentifiersMustBeASCII": true,
30+
"NeverForceUnwrap": false,
31+
"NeverUseForceTry": false,
32+
"NeverUseImplicitlyUnwrappedOptionals": false,
33+
"NoAccessLevelOnExtensionDeclaration": true,
34+
"NoBlockComments": true,
35+
"NoCasesWithOnlyFallthrough": true,
36+
"NoEmptyTrailingClosureParentheses": true,
37+
"NoLabelsInCasePatterns": true,
38+
"NoLeadingUnderscores": false,
39+
"NoParensAroundConditions": true,
40+
"NoVoidReturnOnFunctionSignature": true,
41+
"OneCasePerLine": true,
42+
"OneVariableDeclarationPerLine": true,
43+
"OnlyOneTrailingClosureArgument": true,
44+
"OrderedImports": true,
45+
"ReturnVoidInsteadOfEmptyTuple": true,
46+
"UseLetInEveryBoundCaseVariable": true,
47+
"UseShorthandTypeNames": true,
48+
"UseSingleLinePropertyGetter": true,
49+
"UseSynthesizedInitializer": true,
50+
"UseTripleSlashForDocumentationComments": true,
51+
"UseWhereClausesInForLoops": false,
52+
"ValidateDocumentationComments": false
53+
}
54+
}

.swiftlint.yml

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,64 @@
11
disabled_rules:
2-
- trailing_whitespace
32
- line_length
3+
- trailing_comma
4+
- redundant_discardable_let
45

56
opt_in_rules:
7+
- explicit_init
8+
- closure_spacing
69
- empty_count
7-
- file_header
10+
- empty_string
11+
- fatal_error_message
12+
- first_where
13+
- joined_default_parameter
14+
- operator_usage_whitespace
15+
- overridden_super_call
816

917
included:
1018
- Sources
1119
- Tests
1220

1321
excluded:
1422
- .build
15-
- .swiftpm
16-
17-
file_header:
18-
required_pattern: |
19-
\/\/
20-
\/\/ .*\.swift
21-
\/\/ swift-rfc-.*
22-
\/\/
23-
\/\/ Created by .* on .*\.
24-
\/\/
23+
- Carthage
24+
- Pods
25+
- fastlane
26+
27+
# Type body length settings
28+
type_body_length:
29+
warning: 500
30+
error: 600
31+
32+
# File length settings
33+
file_length:
34+
warning: 800
35+
error: 1000
36+
ignore_comment_only_lines: true
37+
38+
# Function body length settings
39+
function_body_length:
40+
warning: 100
41+
error: 120
42+
43+
# Function parameter count
44+
function_parameter_count:
45+
warning: 6
46+
error: 8
47+
48+
# Cyclomatic complexity
49+
cyclomatic_complexity:
50+
warning: 15
51+
error: 20
52+
53+
# Identifier name settings
54+
identifier_name:
55+
min_length:
56+
warning: 2
57+
max_length:
58+
warning: 50
59+
error: 60
60+
excluded:
61+
- id
62+
- URL
63+
- to
64+
- db

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ let package = Package(
2222
.library(name: .rfc5321, targets: [.rfc5321]),
2323
],
2424
dependencies: [
25-
.package(url: "https://github.com/swift-web-standards/swift-rfc-1123.git", from: "0.0.1"),
25+
.package(url: "https://github.com/swift-standards/swift-rfc-1123.git", from: "0.0.1"),
2626
],
2727
targets: [
2828
.target(

0 commit comments

Comments
 (0)