From 336717eb8ffd7d8ee6ca08d1981b7cee2954fc7a Mon Sep 17 00:00:00 2001 From: yuKing123-king Date: Tue, 2 Jun 2026 10:30:21 +0800 Subject: [PATCH] feat: add workflow ci --- .github/workflows/ci.yml | 69 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..230a196 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,69 @@ +name: CI +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: [main] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + # ─── 编译矩阵 (Debug + Release) ─── + build: + runs-on: self-hosted + strategy: + matrix: + build-type: [Debug, Release] + max-parallel: 1 + steps: + - uses: actions/checkout@v6 + with: + submodules: recursive + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential clang llvm libbpf-dev bpftool cmake + - name: Clean build artifacts + run: make clean + - name: Build BPF programs + run: make bpf Release=${{ matrix.build-type == 'Release' && '1' || '0' }} + - name: Build user-space programs + run: make -j$(nproc) observe filter policy so demo \ + Release=${{ matrix.build-type == 'Release' && '1' || '0' }} + - name: Smoke test with lsns + if: matrix.build-type == 'Debug' + timeout-minutes: 1 + run: | + echo "=== Smoke test: running lsns ===" + sudo -E env "PATH=$PATH" ./build/observe/lsns + echo "=== Smoke test passed ===" + - name: Upload test logs on failure + if: failure() + uses: actions/upload-artifact@v4 + with: + name: test-logs-${{ matrix.build-type }} + path: build/test/*.log + # ─── x86 DEB 打包(仅 push main 时触发)─── + package: + needs: [build] + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: self-hosted + env: + MAKEFLAGS: -j4 + steps: + - uses: actions/checkout@v6 + with: + submodules: recursive + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential clang llvm libbpf-dev bpftool cmake dpkg-dev + - name: Build DEB package + run: IN_KERNEL_TREE=1 ./script/build-deb.sh + - name: Upload DEB package + uses: actions/upload-artifact@v4 + with: + name: dkapture-deb + path: ./*.deb