Skip to content

Commit 8b0dc4e

Browse files
authored
Swift 6 updates (#3)
- Swift 6.1 rework - Brand new database driver implementation
1 parent f6c7cc2 commit 8b0dc4e

27 files changed

Lines changed: 1822 additions & 398 deletions

.github/workflows/deployment.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Deployment
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
- '[0-9]*'
8+
9+
jobs:
10+
11+
create-docc-and-deploy:
12+
uses: BinaryBirds/github-workflows/.github/workflows/docc_deploy.yml@main
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write

.github/workflows/testing.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Testing
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
10+
swiftlang_checks:
11+
name: Swiftlang Checks
12+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
13+
with:
14+
license_header_check_project_name: "project"
15+
format_check_enabled : true
16+
broken_symlink_check_enabled : true
17+
unacceptable_language_check_enabled : true
18+
shell_check_enabled : true
19+
docs_check_enabled : false
20+
api_breakage_check_enabled : false
21+
license_header_check_enabled : false
22+
yamllint_check_enabled : false
23+
python_lint_check_enabled : false
24+
25+
bb_checks:
26+
name: BB Checks
27+
uses: BinaryBirds/github-workflows/.github/workflows/extra_soundness.yml@main
28+
with:
29+
local_swift_dependencies_check_enabled : true
30+
headers_check_enabled : true
31+
docc_warnings_check_enabled : true
32+
33+
swiftlang_tests:
34+
name: Swiftlang Tests
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v4
39+
- name: Generate certificates
40+
run: make test-certs
41+
- name: Start Postgres Docker Container
42+
run: docker compose up -d --build
43+
- name: Wait For Postgres Docker Container
44+
run: |
45+
for i in {1..30}; do
46+
if docker compose exec -T postgres pg_isready -U postgres -d postgres; then
47+
exit 0
48+
fi
49+
sleep 1
50+
done
51+
docker compose logs postgres
52+
exit 1
53+
- name: Run Tests
54+
run: swift test --parallel
55+
- name: Stop Postgres Docker Container
56+
if: always()
57+
run: docker compose down -v

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ Packages
55
xcuserdata
66
DerivedData
77
.swiftpm
8-
*.xctestplan
8+
*.xctestplan
9+
docker/postgres/certificates

.swift-format

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

.swiftformatignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Package.swift

.swiftheaderignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.github/**
2+
docker/**
3+
AGENTS.md
4+
.gitignore
5+
.swift-format
6+
.swiftformatignore
7+
.swiftheaderignore
8+
LICENSE
9+
Makefile
10+
Package.swift
11+
Package.resolved
12+
README.md
13+
docker-compose.yaml

AGENTS.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Repository Guidelines
2+
3+
This repository contains an project written with Swift 6. Please follow the guidelines below so that the development experience is built on modern, safe API usage.
4+
5+
6+
## Role
7+
8+
You are a **Senior Swift Engineer**, specializing in server-side Swift development, and related frameworks (Vapor, Hummingbird).
9+
10+
11+
## Core instructions
12+
13+
- Swift 6.2 or later, using modern Swift concurrency.
14+
- Do not introduce third-party frameworks without asking first.
15+
- Avoid Foundation unless requested.
16+
- Build system: Swift Package Manager.
17+
- Testing framework: Swift Testing (`swift test`).
18+
19+
20+
## Swift instructions
21+
22+
- Assume strict Swift concurrency rules are being applied.
23+
- Prefer Swift-native alternatives to Foundation methods where they exist, such as using `replacing("hello", with: "world")` with strings rather than `replacingOccurrences(of: "hello", with: "world")`.
24+
- Prefer modern Foundation API, if Foundation can not be avoided, for example `URL.documentsDirectory` to find the app’s documents directory, and `appending(path:)` to append strings to a URL.
25+
- Never use C-style number formatting such as `Text(String(format: "%.2f", abs(myNumber)))`; always use `Text(abs(change), format: .number.precision(.fractionLength(2)))` instead.
26+
- Prefer static member lookup to struct instances where possible, such as `.circle` rather than `Circle()`, and `.borderedProminent` rather than `BorderedProminentButtonStyle()`.
27+
- Never use old-style Grand Central Dispatch concurrency such as `DispatchQueue.main.async()`. If behavior like this is needed, always use modern Swift concurrency.
28+
- Avoid force unwraps and force `try` unless it is unrecoverable.
29+
- Never use `Task.sleep(nanoseconds:)`; always use `Task.sleep(for:)` instead.
30+
31+
32+
## Project structure
33+
34+
- Use a consistent project structure.
35+
- Follow strict naming conventions for types, properties, methods, and data models.
36+
- Break different types up into different Swift files rather than placing multiple structs, classes, or enums into a single file.
37+
- Write unit tests for core application logic.
38+
- Add code comments and documentation comments as needed.
39+
- If the project requires secrets such as API keys, never include them in the repository.
40+
41+
42+
## Build, Test, and Development Commands
43+
44+
- Preferred workflow: after any code change run `swift build` to rebuild the project, and run `swift test` when you actually need tests.
45+
46+
47+
## PR instructions
48+
49+
- If installed, make sure the `make format` & `make check` commands returns no warnings or errors before committing.
50+
51+
52+
## Coding Style & Naming Conventions
53+
54+
- Enforce formatting with the `make format` command.
55+
- Swift 6.2, prefer strict typing and small files (<500 LOC as a guardrail)
56+
- Naming: types UpperCamelCase; methods/properties lowerCamelCase; tests mirror subject names; avoid abbreviations except common GitHub/API terms.
57+
58+
59+
## Testing Guidelines
60+
61+
- Framework: Swift Testing via `swift test`. Name suites `<Thing>Tests` and functions `behavior()`.
62+
- Cover new logic. Use deterministic fixtures/mocks for data.
63+
- Run `swift test` before pushing; prefer adding tests alongside bug fixes.
64+
65+
66+
## Commit & Pull Request Guidelines
67+
68+
- Commit messages follow the existing short, imperative style; optional scoped prefixes. Keep them concise; present tense; no trailing period.
69+
- PRs: include a brief summary, linked issue ticket if any.
70+
71+
72+
## Security & Configuration Tips
73+
74+
- Keep GitHub App secrets/private key out of the repo;
75+
- Do not log tokens or traffic stats responses; prefer redacted diagnostics.
76+
77+
78+
## Agent-Specific Notes
79+
80+
- Reminder: ignore files you do not recognize (just list them); multiple agents often work here.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MIT License
22

33
Copyright (c) 2018-2022 Tibor Bödecs
4-
Copyright (c) 2022-2024 Binary Birds Ltd.
4+
Copyright (c) 2022-2026 Binary Birds Kft.
55

66
Permission is hereby granted, free of charge, to any person
77
obtaining a copy of this software and associated documentation

Makefile

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,44 @@
1-
build:
2-
swift build
1+
SHELL=/bin/bash
32

4-
release:
5-
swift build -c release
6-
7-
test:
8-
swift test --parallel
3+
baseUrl = https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts
4+
5+
check: symlinks language deps lint headers
6+
7+
symlinks:
8+
curl -s $(baseUrl)/check-broken-symlinks.sh | bash
99

10-
test-with-coverage:
11-
swift test --parallel --enable-code-coverage
10+
language:
11+
curl -s $(baseUrl)/check-unacceptable-language.sh | bash
1212

13-
clean:
14-
rm -rf .build
13+
deps:
14+
curl -s $(baseUrl)/check-local-swift-dependencies.sh | bash
15+
16+
lint:
17+
curl -s $(baseUrl)/run-swift-format.sh | bash
1518

1619
format:
17-
swift-format -i -r ./Sources && swift-format -i -r ./Tests
20+
curl -s $(baseUrl)/run-swift-format.sh | bash -s -- --fix
21+
22+
docc-local:
23+
curl -s $(baseUrl)/generate-docc.sh | bash -s -- --local
24+
25+
run-docc:
26+
curl -s $(baseUrl)/run-docc-docker.sh | bash
27+
28+
docc-warnings:
29+
curl -s $(baseUrl)/check-docc-warnings.sh | bash
30+
31+
headers:
32+
curl -s $(baseUrl)/check-swift-headers.sh | bash
33+
34+
fix-headers:
35+
curl -s $(baseUrl)/check-swift-headers.sh | bash -s -- --fix
36+
37+
test-certs:
38+
rm -rf docker/postgres/certificates && mkdir -p docker/postgres/certificates && cd docker/postgres/certificates && ../scripts/generate-certificates.sh
39+
40+
test:
41+
swift test --parallel
42+
43+
docker-test:
44+
docker build -t feather-postgres-database-tests . -f ./docker/tests/Dockerfile && docker run --rm feather-postgres-database-tests

0 commit comments

Comments
 (0)