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