Skip to content

Commit 9549306

Browse files
committed
chore: add GitHub workflows and configuration files
- Add CI workflows for testing and linting - Add Swift Package Index configuration - Update .gitignore, swift-format, and swiftlint configuration
1 parent a02141a commit 9549306

File tree

9 files changed

+248
-79
lines changed

9 files changed

+248
-79
lines changed

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: [coenttb]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
polar: # Replace with a single Polar username
13+
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14+
thanks_dev: # Replace with a single thanks.dev username
15+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.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: "monthly"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "monthly"

.github/workflows/ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ci-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
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: macos-swift62-spm-${{ hashFiles('Package.swift', 'Package@*.swift') }}
35+
restore-keys: |
36+
macos-swift62-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+
- name: Check for API breaking changes
46+
id: api-diff
47+
run: |
48+
echo "## API Breaking Changes Check" >> $GITHUB_STEP_SUMMARY
49+
if swift package diagnose-api-breaking-changes --breakage-allowlist-path .swift-api-breakage-allowlist 2>&1 | tee api-diff.txt; then
50+
echo "✅ No API breaking changes detected" >> $GITHUB_STEP_SUMMARY
51+
else
52+
echo "⚠️ API breaking changes detected:" >> $GITHUB_STEP_SUMMARY
53+
echo '```' >> $GITHUB_STEP_SUMMARY
54+
cat api-diff.txt >> $GITHUB_STEP_SUMMARY
55+
echo '```' >> $GITHUB_STEP_SUMMARY
56+
echo "::warning::API breaking changes detected. Review changes before release."
57+
fi
58+
continue-on-error: true
59+
60+
# Production validation: Latest Swift on Linux with release build
61+
linux-latest:
62+
name: Ubuntu (Swift 6.2, release)
63+
runs-on: ubuntu-latest
64+
container: swift:6.2
65+
steps:
66+
- uses: actions/checkout@v5
67+
68+
- name: Cache Swift packages
69+
uses: actions/cache@v4
70+
with:
71+
path: .build
72+
key: linux-swift62-spm-${{ hashFiles('Package.swift', 'Package@*.swift') }}
73+
restore-keys: linux-swift62-spm-
74+
75+
# Note: swift test builds automatically in release mode
76+
- name: Test (release)
77+
run: swift test -c release
78+
79+
# Compatibility check: Minimum supported Swift version (6.2)
80+
# Update to swift:6.3 when available
81+
linux-compat:
82+
name: Ubuntu (Swift 6.2, compatibility)
83+
runs-on: ubuntu-latest
84+
container: swift:6.2
85+
steps:
86+
- uses: actions/checkout@v5
87+
88+
- name: Cache Swift packages
89+
uses: actions/cache@v4
90+
with:
91+
path: .build
92+
key: linux-swift62-compat-spm-${{ hashFiles('Package.swift', 'Package@*.swift') }}
93+
restore-keys: linux-swift62-compat-spm-
94+
95+
# Note: swift test builds automatically
96+
- name: Test (Swift 6.2)
97+
run: swift test -c release

.github/workflows/swift-format.yml

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

.github/workflows/swiftlint.yml

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

.gitignore

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,23 @@
1-
# Swift
2-
.build/
3-
.swiftpm/
4-
Package.resolved
5-
6-
# Environment files
7-
.env*
8-
9-
# Xcode
10-
*.xcodeproj
11-
*.xcworkspace
12-
*.xcuserdata
13-
DerivedData/
14-
15-
# IDEs
16-
.vscode/
17-
.idea/
18-
*.swp
19-
*.swo
201
*~
212

22-
# Generated by MacOS
23-
.DS_Store
24-
25-
# Generated by Windows
3+
Package.resolved
4+
DerivedData/
265
Thumbs.db
276

28-
# Generated by Linux
29-
*~
30-
31-
# Log files
32-
*.log
33-
34-
# AI
35-
.claude
36-
CLAUDE.MD
37-
38-
# Temporary files
39-
*.tmp
40-
*.temp
7+
# Dot files/directories (opt-in only)
8+
/.*
9+
!/.github
10+
!/.gitignore
11+
!/.spi.yml
12+
!/.swift-format
13+
!/.swiftformat
14+
!/.swiftlint.yml
15+
16+
# Documentation (opt-in for top-level .md files only)
17+
/*.md
18+
!README.md
19+
!LICENSE.md
20+
!CHANGELOG.md
21+
!CONTRIBUTING.md
22+
!CODE_OF_CONDUCT.md
23+
!SECURITY.md

.spi.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version: 1
2+
builder:
3+
configs:
4+
- documentation_targets:
5+
- CSS Standard

.swift-format

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
"indentation": {
55
"spaces": 4
66
},
7-
"tabWidth": 8,
87
"maximumBlankLines": 1,
98
"respectsExistingLineBreaks": true,
109
"lineBreakBeforeControlFlowKeywords": false,
1110
"lineBreakBeforeEachArgument": true,
12-
"lineBreakBeforeEachGenericRequirement": false,
11+
"lineBreakBeforeEachGenericRequirement": true,
1312
"prioritizeKeepingFunctionOutputTogether": true,
1413
"indentConditionalCompilationBlocks": true,
15-
"lineBreakAroundMultilineExpressionChainComponents": false,
14+
"indentSwitchCaseLabels": false,
15+
"spacesAroundRangeFormationOperators": false,
1616
"fileScopedDeclarationPrivacy": {
1717
"accessLevel": "private"
1818
},
1919
"rules": {
2020
"AllPublicDeclarationsHaveDocumentation": false,
21-
"AlwaysUseLowerCamelCase": true,
21+
"AlwaysUseLowerCamelCase": false,
2222
"AmbiguousTrailingClosureOverload": true,
2323
"BeginDocumentationCommentWithOneLineSummary": false,
2424
"DoNotUseSemicolons": true,
@@ -31,7 +31,7 @@
3131
"NeverUseForceTry": false,
3232
"NeverUseImplicitlyUnwrappedOptionals": false,
3333
"NoAccessLevelOnExtensionDeclaration": true,
34-
"NoBlockComments": true,
34+
"NoBlockComments": false,
3535
"NoCasesWithOnlyFallthrough": true,
3636
"NoEmptyTrailingClosureParentheses": true,
3737
"NoLabelsInCasePatterns": true,
@@ -43,10 +43,11 @@
4343
"OnlyOneTrailingClosureArgument": true,
4444
"OrderedImports": true,
4545
"ReturnVoidInsteadOfEmptyTuple": true,
46+
"UseEarlyExits": false,
4647
"UseLetInEveryBoundCaseVariable": true,
4748
"UseShorthandTypeNames": true,
4849
"UseSingleLinePropertyGetter": true,
49-
"UseSynthesizedInitializer": true,
50+
"UseSynthesizedInitializer": false,
5051
"UseTripleSlashForDocumentationComments": true,
5152
"UseWhereClausesInForLoops": false,
5253
"ValidateDocumentationComments": false

0 commit comments

Comments
 (0)