Skip to content

Commit 257d247

Browse files
committed
refactor: simplify CI workflow and reorganize source files into modular structure
1 parent 76f7814 commit 257d247

2 files changed

Lines changed: 37 additions & 85 deletions

File tree

.github/workflows/swift.yml

Lines changed: 23 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,30 @@
1-
name: Swift CI
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
25

3-
on:
4-
push:
5-
branches: [ main ]
6-
pull_request:
7-
branches: [ main ]
6+
# GitHub recommends pinning actions to a commit SHA.
7+
# To get a newer version, you will need to update the SHA.
8+
# You can also reference a tag or branch, but the action may change without warning.
9+
10+
name: Swift
11+
12+
on: [push]
813

914
jobs:
10-
test:
11-
runs-on: ${{ matrix.os }}
15+
build:
16+
name: Swift ${{ matrix.swift }} on ${{ matrix.os }}
1217
strategy:
1318
matrix:
1419
os: [ubuntu-latest, macos-latest]
15-
16-
steps:
17-
- uses: actions/checkout@v4
18-
19-
- name: Setup Swift
20-
uses: vapor/swiftly-action@v0.2
21-
with:
22-
toolchain: '6.1'
23-
24-
- name: Cache Swift Package Manager
25-
uses: actions/cache@v3
26-
with:
27-
path: .build
28-
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
29-
restore-keys: |
30-
${{ runner.os }}-spm-
31-
32-
- name: Build
33-
run: swift build -v
34-
35-
- name: Run tests
36-
run: swift test -v
37-
38-
- name: Build release
39-
run: swift build -c release
40-
41-
- name: Test Makefile targets
42-
run: |
43-
make help
44-
make build
45-
make clean
46-
47-
48-
security:
49-
runs-on: ubuntu-latest
50-
steps:
51-
- uses: actions/checkout@v4
52-
53-
- name: Run security audit
54-
run: |
55-
# Check for known security vulnerabilities in dependencies
56-
echo "Checking for security vulnerabilities..."
57-
# This would typically use tools like swift-package-audit when available
58-
echo "No security audit tools configured yet"
59-
60-
release:
61-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
62-
needs: [test]
63-
runs-on: ubuntu-latest
20+
swift: ["6.1"]
21+
runs-on: ${{ matrix.os }}
6422
steps:
65-
- uses: actions/checkout@v4
66-
67-
- name: Setup Swift
68-
uses: vapor/swiftly-action@v0.2
69-
with:
70-
toolchain: '6.1'
71-
72-
- name: Build release artifacts
73-
run: |
74-
# Build for multiple platforms
75-
swift build -c release
76-
77-
# Create release directory
78-
mkdir -p release
79-
80-
# Copy binary and documentation
81-
cp .build/release/SwiftDeveloperMCPServer release/
82-
cp README.md release/
83-
cp Makefile release/
84-
85-
- name: Upload release artifacts
86-
uses: actions/upload-artifact@v3
87-
with:
88-
name: swift-developer-mcp-server-${{ github.sha }}
89-
path: release/
23+
- uses: vapor/swiftly-action@65540b95f51493d65f5e59e97dcef9629ddf11bf
24+
with:
25+
toolchain: ${{ matrix.swift }}
26+
- uses: actions/checkout@v4
27+
- name: Build
28+
run: swift build
29+
- name: Run tests
30+
run: swift test

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,24 @@ swift-developer-mcp-server/
193193
├── Makefile # Build automation and convenience targets
194194
├── Sources/
195195
│ ├── main.swift # Server entry point and MCP handler setup
196-
│ └── SwiftDeveloperTools.swift # Tool implementations
196+
│ ├── Utilities.swift # Common types and helper functions
197+
│ ├── BuildTestTools.swift # Swift build and test tools
198+
│ ├── DebugTools.swift # Debug session management and tools
199+
│ ├── PackageInfoTools.swift # Swift package information tools
200+
│ ├── SwiftlyTools.swift # Swiftly toolchain management
201+
│ ├── Resources.swift # MCP resources (project info, build status, etc.)
202+
│ └── Prompts.swift # MCP prompts (debug session, build analysis)
197203
└── README.md # This file
198204
```
199205

200206
### Adding New Tools
201207

202-
1. Define the tool struct in `SwiftDeveloperTools.swift`
208+
1. Define the tool struct in the appropriate module file:
209+
- `BuildTestTools.swift` for build and test functionality
210+
- `DebugTools.swift` for debugging features
211+
- `PackageInfoTools.swift` for package management
212+
- `SwiftlyTools.swift` for toolchain management
213+
- Create a new module if needed for other categories
203214
2. Add the tool to the `ListTools` handler in `main.swift`
204215
3. Add the tool's handle method to the `CallTool` switch statement
205216
4. Rebuild the server
@@ -231,7 +242,7 @@ Then send initialization and tool call messages via stdin.
231242

232243
## License
233244

234-
This project is licensed under the MIT License. See the LICENSE file for details.
245+
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
235246

236247
## Troubleshooting
237248

0 commit comments

Comments
 (0)