1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main, develop ]
6+ pull_request :
7+ branches : [ main, develop ]
8+ workflow_dispatch :
9+
10+ jobs :
11+ swift-test :
12+ name : Swift Tests
13+ runs-on : macos-latest
14+ strategy :
15+ matrix :
16+ xcode : ['15.1', '15.0']
17+
18+ steps :
19+ - name : Checkout
20+ uses : actions/checkout@v4
21+
22+ - name : Select Xcode
23+ run : sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer
24+
25+ - name : Show Xcode and Swift versions
26+ run : |
27+ xcodebuild -version
28+ swift --version
29+
30+ - name : Cache Swift Package Manager
31+ uses : actions/cache@v3
32+ with :
33+ path : .build
34+ key : ${{ runner.os }}-spm-${{ matrix.xcode }}-${{ hashFiles('**/Package.resolved') }}
35+ restore-keys : |
36+ ${{ runner.os }}-spm-${{ matrix.xcode }}-
37+ ${{ runner.os }}-spm-
38+
39+ - name : Build Package
40+ run : swift build
41+
42+ - name : Run Tests
43+ run : swift test --enable-code-coverage
44+
45+ - name : Generate Code Coverage
46+ run : |
47+ xcrun llvm-cov export -format="lcov" \
48+ .build/debug/TintedThemingSwiftPackageTests.xctest/Contents/MacOS/TintedThemingSwiftPackageTests \
49+ -instr-profile .build/debug/codecov/default.profdata > coverage.lcov
50+ continue-on-error : true
51+
52+ - name : Upload Coverage to Codecov
53+ uses : codecov/codecov-action@v3
54+ with :
55+ file : ./coverage.lcov
56+ flags : swift
57+ name : codecov-swift-${{ matrix.xcode }}
58+ continue-on-error : true
59+
60+ platform-compatibility :
61+ name : Platform Compatibility
62+ runs-on : macos-latest
63+ strategy :
64+ matrix :
65+ destination :
66+ - ' platform=macOS'
67+ - ' platform=iOS Simulator,name=iPhone 15'
68+ - ' platform=iOS Simulator,name=iPhone 14'
69+ - ' platform=watchOS Simulator,name=Apple Watch Series 9 (45mm)'
70+ - ' platform=tvOS Simulator,name=Apple TV'
71+
72+ steps :
73+ - name : Checkout
74+ uses : actions/checkout@v4
75+
76+ - name : Select Xcode
77+ run : sudo xcode-select -s /Applications/Xcode_15.1.app/Contents/Developer
78+
79+ - name : Cache Swift Package Manager
80+ uses : actions/cache@v3
81+ with :
82+ path : .build
83+ key : ${{ runner.os }}-spm-platform-${{ hashFiles('**/Package.resolved') }}
84+ restore-keys : |
85+ ${{ runner.os }}-spm-platform-
86+ ${{ runner.os }}-spm-
87+
88+ - name : Build for Platform
89+ run : |
90+ if [[ "${{ matrix.destination }}" == "platform=macOS" ]]; then
91+ swift build
92+ else
93+ xcodebuild build \
94+ -scheme TintedThemingSwift \
95+ -destination '${{ matrix.destination }}'
96+ fi
97+
98+ - name : Test for Platform
99+ run : |
100+ if [[ "${{ matrix.destination }}" == "platform=macOS" ]]; then
101+ swift test
102+ else
103+ xcodebuild test \
104+ -scheme TintedThemingSwift \
105+ -destination '${{ matrix.destination }}'
106+ fi
107+
108+ package-validation :
109+ name : Package Validation
110+ runs-on : macos-latest
111+
112+ steps :
113+ - name : Checkout
114+ uses : actions/checkout@v4
115+
116+ - name : Validate Package Structure
117+ run : |
118+ swift package dump-package
119+ swift package show-dependencies
120+ swift package resolve
121+
122+ - name : Check Package Manifest
123+ run : |
124+ # Verify Package.swift is valid
125+ swift package describe --type json > package_info.json
126+ cat package_info.json
127+
128+ # Check for required fields
129+ if ! grep -q '"name"' package_info.json; then
130+ echo "Error: Package name not found"
131+ exit 1
132+ fi
133+
134+ if ! grep -q '"TintedThemingSwift"' package_info.json; then
135+ echo "Error: Expected package name 'TintedThemingSwift' not found"
136+ exit 1
137+ fi
138+
139+ - name : Lint Swift Code
140+ run : |
141+ # Basic Swift syntax check
142+ find Sources -name "*.swift" -exec swift -frontend -parse {} \;
143+ echo "Swift syntax check passed"
144+
145+ documentation :
146+ name : Documentation Check
147+ runs-on : macos-latest
148+
149+ steps :
150+ - name : Checkout
151+ uses : actions/checkout@v4
152+
153+ - name : Check Documentation
154+ run : |
155+ # Check if README exists and has content
156+ if [[ ! -f README.md ]]; then
157+ echo "Warning: README.md not found"
158+ else
159+ echo "README.md found ($(wc -l < README.md) lines)"
160+ fi
161+
162+ # Check if wiki documentation exists
163+ if [[ -f wiki.adoc ]]; then
164+ echo "Wiki documentation found ($(wc -l < wiki.adoc) lines)"
165+ fi
166+
167+ # Check for inline documentation in Swift files
168+ doc_count=$(find Sources -name "*.swift" -exec grep -l "///" {} \; | wc -l)
169+ echo "Swift files with documentation comments: $doc_count"
170+
171+ - name : Generate Documentation (if available)
172+ run : |
173+ if command -v swift-docc &> /dev/null; then
174+ echo "Generating documentation with Swift-DocC..."
175+ swift package generate-documentation --target TintedThemingSwift
176+ echo "Documentation generated successfully"
177+ else
178+ echo "Swift-DocC not available, skipping documentation generation"
179+ fi
180+ continue-on-error : true
0 commit comments