diff options
Diffstat (limited to '.github/workflows/ci.yml')
| -rw-r--r-- | .github/workflows/ci.yml | 350 |
1 files changed, 350 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e4fed5a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,350 @@ +# GSP vGPU-IO CI/CD Pipeline + +name: GSP vGPU-IO CI + +on: + push: + branches: [main, develop] + paths: + - 'open-iov/**' + pull_request: + branches: [main, develop] + paths: + - 'open-iov/**' + +env: + KERNEL_VERSION: ${{ matrix.kernel }} + GCC_VERSION: ${{ matrix.gcc }} + +jobs: + # ============================================================ + # Kernel Build & Test Matrix + # ============================================================ + kernel-test: + name: Kernel ${{ matrix.kernel }} / GCC ${{ matrix.gcc }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + kernel: ['6.1', '6.6', '6.8'] + gcc: ['11', '12', '13'] + include: + - kernel: '6.1' + gcc: '11' + kernel_package: 'linux-headers-6.1.0-18-generic' + - kernel: '6.6' + gcc: '12' + kernel_package: 'linux-headers-6.6.0-14-generic' + - kernel: '6.8' + gcc: '13' + kernel_package: 'linux-headers-6.8.0-48-generic' + timeout-minutes: 30 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: open-iov + + - name: Install kernel headers + run: | + sudo apt-get update + sudo apt-get install -y ${{ matrix.kernel_package }} build-essential gcc-${{ matrix.gcc }} kunit + + - name: Set GCC + run: | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 100 + gcc --version + + - name: Build driver + run: | + cd open-iov/driver + make KDIR=/lib/modules/$(uname -r)/build + + - name: Build kernel tests + run: | + cd open-iov/kernel/tests + make KDIR=/lib/modules/$(uname -r)/build + + - name: Run comprehensive test module + run: | + cd open-iov/kernel/tests + sudo insmod gsp_vgpu_comprehensive_test.ko + sleep 2 + dmesg -T | tail -50 + sudo rmmod gsp_vgpu_comprehensive_test + + - name: Run KUnit tests + if: matrix.kernel == '6.6' && matrix.gcc == '12' + run: | + cd open-iov/kernel/tests + sudo insmod gsp_vgpu_kunit_test.ko + sleep 2 + dmesg -T | grep -E "(kunit|KUNIT|PASS|FAIL)" | tail -50 + sudo rmmod gsp_vgpu_kunit_test + + - name: Run mock tests + run: | + cd open-iov/kernel/tests + sudo insmod gsp_vgpu_mock_test.ko + sleep 2 + dmesg -T | grep -E "(PASS|FAIL|Test Results)" | tail -50 + sudo rmmod gsp_vgpu_mock_test + + # ============================================================ + # Firmware Validation + # ============================================================ + firmware-validation: + name: Firmware Validation + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: open-iov + + - name: Verify firmware exists + run: | + ls -la open-iov/firmware/570-GSP/gsp-570.144.fwimage.bin + + - name: Verify firmware MD5 + run: | + cd open-iov/firmware/570-GSP + expected="13ce12a392a31eeb79a2e6ebd3a4a93a" + actual=$(md5sum gsp-570.144.fwimage.bin | cut -d' ' -f1) + echo "Expected: $expected" + echo "Actual: $actual" + if [ "$expected" != "$actual" ]; then + echo "MD5 mismatch!" + exit 1 + fi + echo "MD5 verified ✓" + + - name: Verify firmware size + run: | + cd open-iov/firmware/570-GSP + size=$(stat -c%s gsp-570.144.fwimage.bin) + expected=29622272 # 28.5 MB + echo "Size: $size bytes" + if [ "$size" -lt 28000000 ] || [ "$size" -gt 31000000 ]; then + echo "Unexpected firmware size!" + exit 1 + fi + echo "Size verified ✓" + + - name: Verify decompiled output + run: | + cd open-iov/firmware/570-GSP/decompiled + count=$(ls *.c | wc -l) + echo "Decompiled files: $count" + if [ "$count" -lt 80 ]; then + echo "Expected at least 80 decompiled files!" + exit 1 + fi + echo "Decompilation verified ✓" + + - name: Verify key addresses in decompiled output + run: | + cd open-iov/firmware/570-GSP/decompiled + # Check critical functions exist + for func in \ + "FUN_ram_057a1ac0" \ + "FUN_ram_04cb8188" \ + "FUN_ram_04f00b0c" \ + "FUN_ram_04f00c78" \ + "FUN_ram_057e94ec" \ + "FUN_ram_051efbf4" \ + "FUN_ram_059be7f4" \ + "entry_ram_04009000"; do + if [ ! -f "${func}_ram_*.c" ]; then + echo "Missing: $func" + exit 1 + fi + done + echo "Key functions verified ✓" + + # ============================================================ + # Documentation Validation + # ============================================================ + docs-validation: + name: Documentation Validation + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: open-iov + + - name: Check wiki files exist + run: | + cd open-iov/wiki + required=( + "GSP-570.144W-Firmware-Analysis.md" + "RPC-Message-Format.md" + "BAR-Emulation-Specification.md" + "WPR-Management.md" + "Migration-Protocol.md" + "vGPU-IO-Integration-Guide.md" + "Address-Reference.md" + "Error-Codes.md" + "Glossary.md" + "README.md" + ) + for f in "${required[@]}"; do + if [ ! -f "$f" ]; then + echo "Missing: $f" + exit 1 + fi + echo "Found: $f" + done + + - name: Validate markdown syntax + run: | + cd open-iov/wiki + # Check for basic markdown structure + for f in *.md; do + if ! head -1 "$f" | grep -q "^#"; then + echo "Warning: $f missing H1 header" + fi + done + + - name: Check cross-references + run: | + cd open-iov/wiki + # Verify internal links resolve + for f in *.md; do + grep -o '\[.*\](.*\.md)' "$f" | while read link; do + target=$(echo "$link" | sed -n 's/.*(\(.*\))/\1/p') + if [ ! -f "$target" ]; then + echo "Broken link in $f: $target" + exit 1 + fi + done + done + + # ============================================================ + # Static Analysis + # ============================================================ + static-analysis: + name: Static Analysis + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: open-iov + + - name: Install checkpatch.pl + run: | + sudo apt-get update + sudo apt-get install -y linux-headers-$(uname -r) + # checkpatch.pl comes with kernel headers + + - name: Run checkpatch on driver + run: | + cd open-iov/driver + find . -name "*.c" -o -name "*.h" | xargs /usr/src/linux-headers-$(uname -r)/scripts/checkpatch.pl --no-tree --strict || true + + - name: Run sparse + run: | + cd open-iov/driver + make C=1 CHECK="/usr/bin/sparse" 2>&1 | head -100 || true + + - name: Run cppcheck + run: | + sudo apt-get install -y cppcheck + cd open-iov/driver + cppcheck --enable=all --std=c11 --force -I include . 2>&1 | head -100 || true + + # ============================================================ + # Userspace Test Build + # ============================================================ + userspace-build: + name: Userspace Build Test + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: open-iov + + - name: Build userspace tests + run: | + cd open-iov/userspace/tests + make + + - name: Verify binary + run: | + cd open-iov/userspace/tests + ./test_vgpu_userspace 2>&1 | head -20 || true + # Expected to fail without driver, but should run + + # ============================================================ + # Integration Test (requires hardware - manual trigger) + # ============================================================ + integration-test: + name: Integration Test (Manual) + runs-on: [self-hosted, gpu, nvidia] + if: github.event_name == 'workflow_dispatch' + timeout-minutes: 60 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: open-iov + + - name: Run full integration test + run: | + cd open-iov + sudo ./tools/test/run_integration_tests.sh all + + # ============================================================ + # Release Artifacts + # ============================================================ + release: + name: Create Release + needs: [kernel-test, firmware-validation, docs-validation, static-analysis, userspace-build] + if: github.event_name == 'release' && github.event.action == 'published' + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + path: open-iov + + - name: Build release artifacts + run: | + cd open-iov + # Create release package + mkdir -p release + cp firmware/570-GSP/gsp-570.144.fwimage.bin release/ + cp -r wiki release/ + cp -r driver release/ + cp -r kernel/tests release/ + cp -r userspace/tests release/ + cp README.md release/ + tar -czf gsp-vgpu-io-${{ github.event.release.tag_name }}.tar.gz release/ + + - name: Upload release assets + uses: softprops/action-gh-release@v1 + with: + files: open-iov/gsp-vgpu-io-${{ github.event.release.tag_name }}.tar.gz + +# ============================================================ +# Workflow Permissions +# ============================================================ +permissions: + contents: read + checks: write + pull-requests: write
\ No newline at end of file |
