Skip to content

feat: Add GitHub Actions CI workflow for PR validation#6

Merged
saimizi merged 9 commits intomasterfrom
add-ci-workflow
Jul 29, 2025
Merged

feat: Add GitHub Actions CI workflow for PR validation#6
saimizi merged 9 commits intomasterfrom
add-ci-workflow

Conversation

@saimizi
Copy link
Owner

@saimizi saimizi commented Jul 29, 2025

Summary

This PR adds a comprehensive GitHub Actions CI workflow to automatically validate pull requests and ensure code quality.

Features Added

🎨 Code Style Checking

  • Uses official Linux kernel .clang-format configuration
  • Automatically checks all C source and header files
  • Provides clear feedback on formatting issues with fix instructions

🏗️ Cross-Platform Build Testing

  • x86_64 architecture: Validates builds on standard x86 systems
  • aarch64 architecture: Ensures ARM64 compatibility using cross-compilation
  • Downloads kernel headers and sets up proper build environment
  • Builds ipcon driver as kernel module for both architectures

🔄 Automated Triggers

  • Runs on all pull requests targeting master branch
  • Runs on pushes to master branch
  • Matrix strategy for efficient parallel testing

Implementation Details

  • Workflow file: .github/workflows/ci.yml
  • Format config: .clang-format (from Linux kernel upstream)
  • Build approach: Out-of-tree kernel module compilation
  • Kernel version: Linux 6.1 (stable)

Benefits

✅ Ensures consistent code formatting across contributions
✅ Catches build issues early for both major architectures
✅ Reduces manual review time for maintainers
✅ Provides immediate feedback to contributors
✅ Prevents broken code from being merged

Testing

The workflow will be automatically tested when this PR is created, validating both the CI setup and the current codebase.

Resolves #5


🤖 Generated with Claude Code

saimizi and others added 9 commits July 29, 2025 22:25
Add comprehensive CI workflow that includes:
- Code style checking using Linux kernel .clang-format rules
- Cross-platform build testing for x86_64 and aarch64 architectures
- Automated validation on pull requests and master branch pushes

Features:
- Downloads and uses official Linux kernel .clang-format configuration
- Sets up kernel build environment for both x86 and ARM64
- Builds ipcon driver as kernel module for architecture validation
- Provides clear feedback on formatting and build issues

Resolves #5

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Improvements to the GitHub Actions CI workflow:

**Code Style Check**:
- Fix shell variable scope issue that prevented error counting
- Add temporary file-based error tracking
- Provide better error messages with examples
- Show clear instructions for fixing formatting issues

**Build Process**:
- Improve Makefile generation for out-of-tree module build
- Add proper CONFIG flags for ipcon and debugfs
- Enable verbose build output (V=1) for better debugging
- Add comprehensive build verification with file info
- Better error reporting when build fails

**General**:
- Add progress indicators and clearer output formatting
- More robust error handling throughout the workflow

These changes should make the CI more reliable and provide better
feedback when issues occur.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Format all C source and header files using clang-format with the
official Linux kernel .clang-format configuration to ensure
consistent code style compliance.

Files formatted:
- ipcon.h, ipcon_db.h, ipcon_msg.h, ipcon_nl.h, name_cache.h, ipcon_dbg.h
- ipcon_db.c, ipcon_debugfs.c, ipcon_msg.c, ipcon_nl.c, name_cache.c

This resolves all code style check failures in the CI workflow
and ensures consistent formatting across the entire codebase.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fix the kernel module build process that was failing to compile source files:

**Root Cause**:
- Complex Makefile indirection was preventing actual compilation
- CONFIG_DEBUG_FS conditional compilation issues
- Missing proper kernel build path configuration

**Solutions**:
- Simplified Makefile generation with direct kernel build integration
- Include all source files unconditionally for CI builds
- Use ccflags-y for proper CONFIG flag definitions
- Add comprehensive build debugging and error reporting
- Proper KERNEL_BUILD_PATH environment variable usage

**Improvements**:
- Enhanced build output with file listings and diagnostics
- Better error reporting when builds fail
- Module info and size reporting on successful builds
- Cleaner build process without intermediate wrapper files

This should resolve the x86_64 and aarch64 build test failures.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add IPCON_CI_BUILD flag to CI workflow for out-of-tree builds
- Create local af_netlink.h with necessary definitions for CI
- Use conditional compilation in ipcon_nl.c to preserve original functionality
- This allows CI builds while maintaining internal kernel API usage

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Fix two critical compilation errors that were preventing x86 builds:

**Issue 1: Static declaration conflict**
- Removed conflicting static declaration of __netlink_clear_multicast_users
- Function is already declared in linux/netlink.h and available in kernel 6.1
- Replaced with comment noting the function is available

**Issue 2: Missing netlink_broadcast_filtered function**
- Replaced netlink_broadcast_filtered() with netlink_broadcast()
- Added comment explaining filter parameters are ignored in CI builds
- This maintains compatibility while allowing out-of-tree builds

**Files modified:**
- af_netlink.h: Remove static function redeclaration
- ipcon_nl.c: Use standard netlink_broadcast instead of filtered version

These changes allow the CI workflow to build successfully on x86_64 while
maintaining the original functionality for in-tree builds.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…functionality

Resolve the x86 build failure by providing a proper fallback implementation
of netlink_broadcast_filtered() instead of removing the functionality entirely.

**Changes:**
- Remove conflicting static declaration of __netlink_clear_multicast_users
- Add netlink_broadcast_filtered() wrapper in af_netlink.h for CI builds
- Wrapper falls back to netlink_broadcast() but preserves the original API
- Function signature remains identical to maintain full compatibility
- Clear documentation about the limitation in out-of-tree builds

**Benefits:**
- ✅ CI builds work on x86_64
- ✅ Original filtering functionality preserved for in-tree builds
- ✅ API compatibility maintained
- ✅ Clear documentation of limitations

This approach maintains the original design while enabling CI validation.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Move the test-specific af_netlink.h header to a dedicated test folder
to make it clear this file is only used for CI/testing purposes.

**Changes:**
- Move af_netlink.h to test/af_netlink.h
- Update include path in ipcon_nl.c for IPCON_CI_BUILD
- Apply code style formatting to test/af_netlink.h

This better organizes the codebase by separating test utilities
from production code.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@saimizi saimizi merged commit 31c7e52 into master Jul 29, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add GHA CI workflow to check PR

1 participant