1+ name : Swift CI
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ test :
11+ runs-on : ${{ matrix.os }}
12+ strategy :
13+ matrix :
14+ os : [ubuntu-latest, macos-latest]
15+ swift-version : ['5.9', '5.10']
16+
17+ steps :
18+ - uses : actions/checkout@v4
19+
20+ - name : Setup Swift (Linux)
21+ if : runner.os == 'Linux'
22+ uses : swift-actions/setup-swift@v1
23+ with :
24+ swift-version : ${{ matrix.swift-version }}
25+
26+ - name : Setup Swift (macOS)
27+ if : runner.os == 'macOS'
28+ run : |
29+ # macOS runners come with Swift pre-installed
30+ swift --version
31+
32+ - name : Cache Swift Package Manager
33+ uses : actions/cache@v3
34+ with :
35+ path : .build
36+ key : ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
37+ restore-keys : |
38+ ${{ runner.os }}-spm-
39+
40+ - name : Build
41+ run : swift build -v
42+
43+ - name : Run tests
44+ run : swift test -v
45+
46+ - name : Build release
47+ run : swift build -c release
48+
49+ - name : Test Makefile targets
50+ run : |
51+ make help
52+ make build
53+ make clean
54+
55+ lint :
56+ runs-on : ubuntu-latest
57+ steps :
58+ - uses : actions/checkout@v4
59+
60+ - name : Setup Swift
61+ uses : swift-actions/setup-swift@v1
62+ with :
63+ swift-version : ' 5.10'
64+
65+ - name : SwiftFormat Check
66+ run : |
67+ # Install SwiftFormat if available
68+ if command -v swiftformat &> /dev/null; then
69+ swiftformat --lint .
70+ else
71+ echo "SwiftFormat not available, skipping formatting check"
72+ fi
73+
74+ - name : SwiftLint Check
75+ run : |
76+ # Install SwiftLint if available
77+ if command -v swiftlint &> /dev/null; then
78+ swiftlint
79+ else
80+ echo "SwiftLint not available, skipping linting check"
81+ fi
82+
83+ security :
84+ runs-on : ubuntu-latest
85+ steps :
86+ - uses : actions/checkout@v4
87+
88+ - name : Run security audit
89+ run : |
90+ # Check for known security vulnerabilities in dependencies
91+ echo "Checking for security vulnerabilities..."
92+ # This would typically use tools like swift-package-audit when available
93+ echo "No security audit tools configured yet"
94+
95+ release :
96+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
97+ needs : [test, lint]
98+ runs-on : ubuntu-latest
99+ steps :
100+ - uses : actions/checkout@v4
101+
102+ - name : Setup Swift
103+ uses : swift-actions/setup-swift@v1
104+ with :
105+ swift-version : ' 5.10'
106+
107+ - name : Build release artifacts
108+ run : |
109+ # Build for multiple platforms
110+ swift build -c release
111+
112+ # Create release directory
113+ mkdir -p release
114+
115+ # Copy binary and documentation
116+ cp .build/release/SwiftDeveloperMCPServer release/
117+ cp README.md release/
118+ cp Makefile release/
119+
120+ - name : Upload release artifacts
121+ uses : actions/upload-artifact@v3
122+ with :
123+ name : swift-developer-mcp-server-${{ github.sha }}
124+ path : release/
0 commit comments