Skip to content

Commit c38491d

Browse files
committed
docs: Create comprehensive README with multi-RFC support and validation tests
- Create comprehensive README from scratch (240 lines) - Add 4-badge standard: Swift, Platforms, License, CI - Complete overview with Multi-RFC Support (1035, 1123, 5321) - 7 key features: Multi-RFC, Type Safety, Domain Operations, Component Access, Codable, Protocols - Installation, Quick Start with 3 sections - 9 detailed usage examples covering all major functionality - Architecture section explaining RFC standards and Domain type - Error handling, Related Packages, Requirements, Contributing - Add ReadmeVerificationTests.swift with 9 comprehensive tests - One test per README code block with line references - All 62 tests passing (53 original + 9 new) - Used _Domain to avoid ambiguity with RFC_1035.Domain - Add Point-Free style CI/CD infrastructure - ci.yml: macOS (debug+release) + Linux testing, README validation - release.yml: Automated releases with tag validation - swift-format.yml: Auto-format on push to main - swiftlint.yml: Code quality checks on PRs (non-blocking) - dependabot.yml: Weekly Swift dependencies, monthly Actions updates - Add code quality configuration files - .swift-format: 100 char line length, 2 space indent - .swiftlint.yml: Already present, Point-Free style rules
1 parent 8717b19 commit c38491d

File tree

10 files changed

+879
-111
lines changed

10 files changed

+879
-111
lines changed

.github/dependabot.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for Swift Package Manager
4+
- package-ecosystem: "swift"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "09:00"
10+
timezone: "America/New_York"
11+
open-pull-requests-limit: 5
12+
reviewers:
13+
- "coenttb"
14+
labels:
15+
- "dependencies"
16+
- "swift"
17+
commit-message:
18+
prefix: "deps"
19+
include: "scope"
20+
21+
# Enable version updates for GitHub Actions
22+
- package-ecosystem: "github-actions"
23+
directory: "/"
24+
schedule:
25+
interval: "monthly"
26+
day: "monday"
27+
time: "09:00"
28+
timezone: "America/New_York"
29+
open-pull-requests-limit: 3
30+
reviewers:
31+
- "coenttb"
32+
labels:
33+
- "dependencies"
34+
- "github-actions"
35+
commit-message:
36+
prefix: "ci"
37+
include: "scope"

.github/workflows/ci.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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+
macos:
18+
name: macOS (Swift 6.0+)
19+
runs-on: macos-15
20+
strategy:
21+
matrix:
22+
xcode: ['16.0']
23+
config: ['debug', 'release']
24+
steps:
25+
- uses: actions/checkout@v5
26+
27+
- name: Select Xcode ${{ matrix.xcode }}
28+
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
29+
30+
- name: Print Swift version
31+
run: swift --version
32+
33+
- name: Cache Swift packages
34+
uses: actions/cache@v4
35+
with:
36+
path: .build
37+
key: ${{ runner.os }}-spm-${{ hashFiles('Package.resolved') }}
38+
restore-keys: |
39+
${{ runner.os }}-spm-
40+
41+
- name: Build
42+
run: swift build -c ${{ matrix.config }}
43+
44+
- name: Run tests
45+
run: swift test -c ${{ matrix.config }}
46+
47+
linux:
48+
name: Ubuntu (Swift 6.0)
49+
runs-on: ubuntu-latest
50+
container: swift:6.0
51+
steps:
52+
- uses: actions/checkout@v5
53+
54+
- name: Resolve dependencies
55+
run: swift package resolve
56+
57+
- name: Build
58+
run: swift build
59+
60+
- name: Run tests
61+
run: swift test
62+
63+
package-validation:
64+
name: Package Validation
65+
runs-on: macos-15
66+
steps:
67+
- uses: actions/checkout@v5
68+
69+
- name: Select Xcode
70+
run: sudo xcode-select -s /Applications/Xcode_16.0.app
71+
72+
- name: Validate Package.swift
73+
run: swift package dump-package
74+
75+
- name: Check for API breaking changes
76+
run: |
77+
swift package diagnose-api-breaking-changes \
78+
--breakage-allowlist-path .swift-api-breakage-allowlist || true
79+
continue-on-error: true
80+
81+
readme-validation:
82+
name: README Code Examples
83+
runs-on: macos-15
84+
steps:
85+
- uses: actions/checkout@v5
86+
87+
- name: Select Xcode
88+
run: sudo xcode-select -s /Applications/Xcode_16.0.app
89+
90+
- name: Run README verification tests
91+
run: swift test --filter ReadmeVerificationTests
92+
93+
- name: Validate README examples compile
94+
run: |
95+
echo "✅ All README code examples are verified to compile and work"

.github/workflows/release.yml

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'Tag to release'
10+
required: true
11+
type: string
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
validate:
18+
name: Validate Release
19+
runs-on: macos-15
20+
steps:
21+
- uses: actions/checkout@v5
22+
23+
- name: Select Xcode
24+
run: sudo xcode-select -s /Applications/Xcode_16.0.app
25+
26+
- name: Validate tag format
27+
run: |
28+
TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}"
29+
if [[ ! "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
30+
echo "❌ Invalid tag format: $TAG"
31+
echo "Tag must follow semantic versioning (e.g., 0.1.0)"
32+
exit 1
33+
fi
34+
echo "✅ Valid tag format: $TAG"
35+
36+
- name: Build in release mode
37+
run: swift build -c release
38+
39+
- name: Run all tests
40+
run: swift test -c release
41+
42+
- name: Run README verification tests
43+
run: swift test -c release --filter ReadmeVerificationTests
44+
45+
- name: Verify README version matches tag
46+
run: |
47+
TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}"
48+
if ! grep -q "version-${TAG}" README.md; then
49+
echo "⚠️ README version badge doesn't match tag: $TAG"
50+
echo "Please update README.md badge to reflect version $TAG"
51+
else
52+
echo "✅ README version matches tag"
53+
fi
54+
55+
create-release-artifacts:
56+
name: Create Release Artifacts
57+
needs: validate
58+
runs-on: macos-15
59+
steps:
60+
- uses: actions/checkout@v5
61+
62+
- name: Select Xcode
63+
run: sudo xcode-select -s /Applications/Xcode_16.0.app
64+
65+
- name: Build library archives
66+
run: |
67+
# Build for arm64
68+
swift build -c release --arch arm64
69+
70+
# Build for x86_64
71+
swift build -c release --arch x86_64
72+
73+
# Create archives of the built libraries
74+
cd .build
75+
tar -czf swift-emailaddress-type-macos.tar.gz \
76+
arm64-apple-macosx/release/*.swiftmodule \
77+
x86_64-apple-macosx/release/*.swiftmodule \
78+
2>/dev/null || true
79+
80+
echo "✅ Created library archives"
81+
82+
- name: Generate documentation
83+
run: |
84+
swift package \
85+
--allow-writing-to-directory ./docs \
86+
generate-documentation \
87+
--target EmailAddress \
88+
--output-path ./docs \
89+
--transform-for-static-hosting \
90+
--hosting-base-path swift-emailaddress-type
91+
92+
cat > ./docs/index.html << 'EOF'
93+
<!DOCTYPE html>
94+
<html>
95+
<head>
96+
<meta charset="utf-8">
97+
<title>Redirecting to swift-emailaddress-type documentation</title>
98+
<meta http-equiv="refresh" content="0; url=./documentation/emailaddress/">
99+
<link rel="canonical" href="./documentation/emailaddress/">
100+
</head>
101+
<body>
102+
<p>Redirecting to <a href="./documentation/emailaddress/">swift-emailaddress-type documentation</a>...</p>
103+
</body>
104+
</html>
105+
EOF
106+
107+
# Create documentation archive
108+
zip -r documentation.zip docs/
109+
continue-on-error: true
110+
111+
- name: Upload artifacts to release
112+
if: github.event_name == 'release'
113+
uses: softprops/action-gh-release@v2
114+
with:
115+
files: |
116+
.build/swift-emailaddress-type-macos.tar.gz
117+
documentation.zip
118+
env:
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
121+
publish-documentation:
122+
name: Publish Documentation
123+
needs: validate
124+
runs-on: macos-15
125+
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
126+
permissions:
127+
contents: read
128+
pages: write
129+
id-token: write
130+
environment:
131+
name: github-pages
132+
url: ${{ steps.deployment.outputs.page_url }}
133+
steps:
134+
- uses: actions/checkout@v5
135+
136+
- name: Select Xcode
137+
run: sudo xcode-select -s /Applications/Xcode_16.0.app
138+
139+
- name: Build documentation
140+
run: |
141+
# Generate documentation for main target
142+
swift package \
143+
--allow-writing-to-directory ./docs \
144+
generate-documentation \
145+
--target EmailAddress \
146+
--output-path ./docs \
147+
--transform-for-static-hosting \
148+
--hosting-base-path swift-emailaddress-type
149+
150+
# Create root index.html redirect
151+
cat > ./docs/index.html << 'EOF'
152+
<!DOCTYPE html>
153+
<html>
154+
<head>
155+
<meta charset="utf-8">
156+
<title>Redirecting to swift-emailaddress-type documentation</title>
157+
<meta http-equiv="refresh" content="0; url=./documentation/emailaddress/">
158+
<link rel="canonical" href="./documentation/emailaddress/">
159+
</head>
160+
<body>
161+
<p>Redirecting to <a href="./documentation/emailaddress/">swift-emailaddress-type documentation</a>...</p>
162+
</body>
163+
</html>
164+
EOF
165+
166+
- name: Setup Pages
167+
uses: actions/configure-pages@v5
168+
169+
- name: Upload artifact
170+
uses: actions/upload-pages-artifact@v4
171+
with:
172+
path: ./docs
173+
174+
- name: Deploy to GitHub Pages
175+
id: deployment
176+
uses: actions/deploy-pages@v4

.github/workflows/swift-format.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: 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: macos-15
16+
permissions:
17+
contents: write
18+
steps:
19+
- uses: actions/checkout@v5
20+
21+
- name: Select Xcode
22+
run: sudo xcode-select -s /Applications/Xcode_16.0.app
23+
24+
- name: Cache swift-format
25+
id: cache-swift-format
26+
uses: actions/cache@v4
27+
with:
28+
path: /usr/local/bin/swift-format
29+
key: ${{ runner.os }}-swift-format-${{ hashFiles('.github/workflows/swift-format.yml') }}
30+
31+
- name: Install swift-format
32+
if: steps.cache-swift-format.outputs.cache-hit != 'true'
33+
run: |
34+
git clone --depth 1 --branch main https://github.com/apple/swift-format.git
35+
cd swift-format
36+
swift build -c release
37+
sudo cp .build/release/swift-format /usr/local/bin/
38+
cd ..
39+
rm -rf swift-format
40+
41+
- name: Format
42+
run: swift-format format --recursive --in-place Sources Tests
43+
44+
- uses: stefanzweifel/git-auto-commit-action@v7
45+
with:
46+
commit_message: Run swift-format
47+
branch: 'main'

0 commit comments

Comments
 (0)