Skip to content

Commit f856128

Browse files
RahulHereRahulHere
authored andcommitted
Update BUILD_INSTRUCTIONS.md with comprehensive GitHub Actions workflow
- Add complete GitHub Actions CI/CD documentation - Include workflow configuration details and build matrix - Add platform-specific runner information (macos-15-intel, macos-15) - Document manual trigger parameters and GitHub CLI usage - Add build artifacts structure and release creation process - Include performance metrics for local and CI builds - Add monitoring, troubleshooting, and best practices sections - Remove deprecated cross-compilation script references - Update for current workflow capabilities and runners
1 parent ee2f684 commit f856128

File tree

1 file changed

+266
-33
lines changed

1 file changed

+266
-33
lines changed

BUILD_INSTRUCTIONS.md

Lines changed: 266 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Build Instructions for libgopher_mcp_auth
1+
# Build Instructions for MCP C++ SDK
22

33
## Overview
4-
This document describes how to build the MCP Authentication Library for multiple platforms and architectures using Docker-based cross-compilation.
4+
This document describes how to build the MCP C++ SDK and Authentication Library (`libgopher_mcp_auth`) for multiple platforms and architectures using Docker-based cross-compilation and GitHub Actions CI/CD.
55

66
## Platform & Architecture Support Matrix
77

@@ -15,7 +15,7 @@ This document describes how to build the MCP Authentication Library for multiple
1515

1616
### Build All Platforms and Architectures
1717
```bash
18-
# macOS - builds x64, ARM64, and Universal
18+
# macOS - builds x64 and ARM64
1919
./docker/build-mac-all.sh
2020

2121
# Linux - builds x64 and ARM64
@@ -25,6 +25,18 @@ This document describes how to build the MCP Authentication Library for multiple
2525
./docker/build-windows-all.sh
2626
```
2727

28+
### GitHub Actions - Automated Builds
29+
```bash
30+
# Trigger workflow manually from GitHub UI
31+
# Go to Actions → Build All Libraries → Run workflow
32+
33+
# Or trigger via GitHub CLI
34+
gh workflow run build-all.yml \
35+
--field build_type=Release \
36+
--field version=0.1.0 \
37+
--field create_release=true
38+
```
39+
2840
---
2941

3042
## macOS Builds
@@ -41,22 +53,12 @@ This document describes how to build the MCP Authentication Library for multiple
4153
```bash
4254
# Native build on Apple Silicon
4355
./docker/build-mac-arm64.sh
44-
45-
# Cross-compilation on Intel Mac
46-
./docker/build-mac-arm64-cross.sh
4756
```
4857
**Output:** `build-output/mac-arm64/`
4958

50-
### 3. Universal Binary (Intel + Apple Silicon)
51-
```bash
52-
./docker/build-mac-universal.sh
53-
```
54-
**Output:** `build-output/mac-universal/`
55-
- Single binary supporting both architectures
56-
5759
### Build All macOS Targets
5860
```bash
59-
./docker/build-mac-all.sh [x64|arm64|universal|all|clean]
61+
./docker/build-mac-all.sh [x64|arm64|all|clean]
6062
```
6163

6264
---
@@ -212,9 +214,9 @@ file build-output/windows-*/gopher_mcp_auth.dll
212214
- ARM64: LLVM-MinGW toolchain
213215

214216
### macOS ARM64 on Intel
215-
- Uses `build-mac-arm64-cross.sh`
216-
- Downloads and builds OpenSSL for ARM64
217-
- Static linking to avoid dependency issues
217+
- Note: Cross-compilation from Intel to ARM64 requires proper toolchain setup
218+
- Recommended: Use GitHub Actions for ARM64 builds (uses native runners)
219+
- Alternative: Build on actual Apple Silicon hardware
218220

219221
---
220222

@@ -282,26 +284,167 @@ rm -rf build-output/windows-* # Windows
282284

283285
---
284286

285-
## CI/CD Recommendations
287+
## GitHub Actions CI/CD
288+
289+
### Workflow Configuration
290+
The project includes a comprehensive GitHub Actions workflow at `.github/workflows/build-all.yml` that automatically builds for all platforms and architectures.
286291

287-
### Build Matrix
292+
### Supported Build Matrix
288293
```yaml
289-
# Example GitHub Actions matrix
290-
strategy:
291-
matrix:
292-
include:
293-
- os: macos-latest
294-
arch: [x64, arm64, universal]
295-
- os: ubuntu-latest
294+
jobs:
295+
build-linux:
296+
strategy:
297+
matrix:
296298
arch: [x64, arm64]
297-
- os: windows-latest
299+
runs-on: ubuntu-latest
300+
301+
build-windows:
302+
strategy:
303+
matrix:
298304
arch: [x64, arm64]
305+
runs-on: ubuntu-latest # Cross-compilation
306+
307+
build-macos:
308+
strategy:
309+
matrix:
310+
include:
311+
- arch: x64
312+
runner: macos-15-intel
313+
- arch: arm64
314+
runner: macos-15 # Apple Silicon runner
315+
runs-on: ${{ matrix.runner }}
316+
```
317+
318+
### Workflow Features
319+
320+
#### 1. Manual Trigger with Parameters
321+
```yaml
322+
workflow_dispatch:
323+
inputs:
324+
build_type:
325+
description: 'Build type'
326+
default: 'Release'
327+
options: [Release, Debug]
328+
version:
329+
description: 'Library version'
330+
default: '0.1.0'
331+
create_release:
332+
description: 'Create GitHub Release'
333+
default: true
299334
```
300335
336+
#### 2. Automatic Builds
337+
- **Push to branch**: Triggers on push to `feature/gopher-auth-build`
338+
- **Pull requests**: Can be configured for PR validation
339+
- **Scheduled**: Can add cron schedule for nightly builds
340+
341+
#### 3. Build Artifacts
342+
- Each platform/architecture combination produces artifacts
343+
- Artifacts are uploaded and retained for 7 days
344+
- Release builds create downloadable archives
345+
346+
#### 4. GitHub Release Creation
347+
- Automatically creates releases with all platform binaries
348+
- Tagged with version and timestamp
349+
- Includes build report with platform details
350+
351+
### Running GitHub Actions
352+
353+
#### Via GitHub UI
354+
1. Go to the repository on GitHub
355+
2. Click on "Actions" tab
356+
3. Select "Build All Libraries" workflow
357+
4. Click "Run workflow"
358+
5. Fill in parameters:
359+
- Build type: Release or Debug
360+
- Version: e.g., 0.1.0
361+
- Create release: true/false
362+
6. Click "Run workflow"
363+
364+
#### Via GitHub CLI
365+
```bash
366+
# Install GitHub CLI if needed
367+
brew install gh # macOS
368+
# or see https://cli.github.com/
369+
370+
# Authenticate
371+
gh auth login
372+
373+
# Run workflow with default parameters
374+
gh workflow run build-all.yml
375+
376+
# Run with custom parameters
377+
gh workflow run build-all.yml \
378+
--field build_type=Release \
379+
--field version=0.2.0 \
380+
--field create_release=true
381+
382+
# View workflow runs
383+
gh run list --workflow=build-all.yml
384+
385+
# Watch a specific run
386+
gh run watch
387+
```
388+
389+
### Workflow Jobs Detail
390+
391+
#### Linux Builds (x64 & ARM64)
392+
- Uses Ubuntu latest runner
393+
- Docker with QEMU for ARM64 emulation
394+
- Produces `.so` shared libraries
395+
- Includes verification tools
396+
397+
#### Windows Builds (x64 & ARM64)
398+
- Cross-compilation from Linux
399+
- MinGW-w64 for x64
400+
- LLVM-MinGW for ARM64
401+
- Produces `.dll` and `.lib` files
402+
- No external dependencies (uses Windows APIs)
403+
404+
#### macOS Builds (x64 & ARM64)
405+
- **x64**: Runs on `macos-15-intel` runner
406+
- **ARM64**: Runs on `macos-15` (Apple Silicon) runner
407+
- Native compilation for best performance
408+
- Produces `.dylib` libraries
409+
- Includes code signing preparation
410+
411+
### Build Output from GitHub Actions
412+
413+
#### Artifacts Structure
414+
```
415+
artifacts/
416+
├── linux-x64-libs/
417+
│ ├── libgopher_mcp_auth.so.0.1.0
418+
│ └── verify_auth
419+
├── linux-arm64-libs/
420+
│ └── ...
421+
├── windows-x64-libs/
422+
│ ├── gopher_mcp_auth.dll
423+
│ └── gopher_mcp_auth.lib
424+
├── windows-arm64-libs/
425+
│ └── ...
426+
├── macos-x64-libs/
427+
│ ├── libgopher_mcp_auth.0.1.0.dylib
428+
│ └── verify_auth
429+
└── macos-arm64-libs/
430+
└── ...
431+
```
432+
433+
#### Release Archives
434+
- `libgopher_mcp_auth-linux-x64.tar.gz`
435+
- `libgopher_mcp_auth-linux-arm64.tar.gz`
436+
- `libgopher_mcp_auth-windows-x64.zip`
437+
- `libgopher_mcp_auth-windows-arm64.zip`
438+
- `libgopher_mcp_auth-macos-x64.tar.gz`
439+
- `libgopher_mcp_auth-macos-arm64.tar.gz`
440+
301441
### Parallel Builds
302-
- Use `build-mac-all.sh` for macOS
303-
- Use `build-windows-all.sh` for Windows
304-
- Run Linux builds in parallel
442+
- All platform builds run in parallel
443+
- Typical total workflow time: 10-15 minutes
444+
- Individual job times:
445+
- Linux: ~3-5 minutes
446+
- Windows: ~3-5 minutes
447+
- macOS: ~5-7 minutes
305448
306449
---
307450
@@ -324,21 +467,111 @@ strategy:
324467
325468
## Performance Notes
326469
470+
### Local Build Times
327471
| Platform | Architecture | Build Time | Notes |
328472
|----------|-------------|------------|-------|
329473
| macOS | x64 | ~1 min | Native compilation |
330-
| macOS | ARM64 | ~2-3 min | Cross-compile on Intel |
331-
| macOS | Universal | ~3-4 min | Builds both architectures |
474+
| macOS | ARM64 | ~1-2 min | Native on Apple Silicon |
332475
| Linux | x64 | ~1 min | Docker native |
333476
| Linux | ARM64 | ~2 min | Docker cross-platform |
334477
| Windows | x64 | ~1 min | MinGW cross-compile |
335478
| Windows | ARM64 | ~3-5 min | LLVM-MinGW download + build |
336479
480+
### GitHub Actions Build Times
481+
| Platform | Architecture | Build Time | Notes |
482+
|----------|-------------|------------|-------|
483+
| Linux | x64 | ~2-3 min | Ubuntu runner |
484+
| Linux | ARM64 | ~3-4 min | QEMU emulation |
485+
| Windows | x64 | ~2-3 min | Cross-compilation |
486+
| Windows | ARM64 | ~4-5 min | LLVM toolchain |
487+
| macOS | x64 | ~3-4 min | Intel runner |
488+
| macOS | ARM64 | ~3-4 min | Apple Silicon runner |
489+
| **Total Workflow** | **All** | **~10-15 min** | **Parallel execution** |
490+
337491
---
338492
339493
## Security Notes
340494
341495
- All builds use official Docker base images
342496
- Windows builds use native Windows APIs (no OpenSSL dependency)
343497
- Static linking available for deployment scenarios
344-
- No runtime dependencies on Windows
498+
- No runtime dependencies on Windows
499+
- GitHub Actions uses secure runners with isolated environments
500+
- Artifacts are scanned by GitHub's security features
501+
- Release binaries should be signed before distribution
502+
503+
## Monitoring Builds
504+
505+
### GitHub Actions Dashboard
506+
- View all runs: `https://github.com/[owner]/mcp-cpp-sdk/actions`
507+
- Specific workflow: Click on "Build All Libraries"
508+
- Real-time logs: Click on any running job
509+
510+
### Status Badges
511+
Add to README.md:
512+
```markdown
513+
[![Build All Libraries](https://github.com/[owner]/mcp-cpp-sdk/actions/workflows/build-all.yml/badge.svg)](https://github.com/[owner]/mcp-cpp-sdk/actions/workflows/build-all.yml)
514+
```
515+
516+
### Notifications
517+
- Email: Configure in GitHub Settings → Notifications
518+
- Slack/Discord: Use GitHub Actions webhooks
519+
- GitHub Mobile: Get push notifications
520+
521+
## Troubleshooting GitHub Actions
522+
523+
### Common Issues
524+
525+
1. **Runner not available**
526+
- `macos-15-intel` may have limited availability
527+
- Fallback: Use `macos-13` or `macos-latest`
528+
529+
2. **Build failures**
530+
- Check the job logs for specific errors
531+
- Verify dependencies are correctly specified
532+
- Ensure scripts have execute permissions
533+
534+
3. **Artifact upload failures**
535+
- Check artifact size limits (500MB default)
536+
- Verify file paths are correct
537+
- Ensure retention days are within limits
538+
539+
4. **Release creation failures**
540+
- Verify GITHUB_TOKEN has write permissions
541+
- Check tag naming doesn't conflict
542+
- Ensure all artifacts exist before release
543+
544+
### Re-running Failed Jobs
545+
```bash
546+
# Re-run all jobs
547+
gh run rerun [run-id]
548+
549+
# Re-run only failed jobs
550+
gh run rerun [run-id] --failed
551+
552+
# View specific job logs
553+
gh run view [run-id] --log
554+
```
555+
556+
## Best Practices
557+
558+
### For Contributors
559+
1. Test locally before pushing
560+
2. Use draft PRs for work in progress
561+
3. Include platform info in commit messages
562+
4. Run linting and formatting locally
563+
564+
### For Maintainers
565+
1. Tag releases semantically (v0.1.0, v0.2.0)
566+
2. Update version in CMakeLists.txt
567+
3. Document breaking changes
568+
4. Sign release binaries when possible
569+
5. Test artifacts before announcing releases
570+
571+
### For CI/CD
572+
1. Use matrix builds for efficiency
573+
2. Cache dependencies where possible
574+
3. Parallelize independent jobs
575+
4. Set appropriate timeout values
576+
5. Use secrets for sensitive data
577+
6. Regular cleanup of old artifacts

0 commit comments

Comments
 (0)