fix: remove MAP_JIT for macOS compat, v2.0.2 #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============================================================================= | |
| # Shellcode Executor - CI/CD 构建与测试流水线 | |
| # Shellcode Executor - CI/CD Build & Test Pipeline | |
| # ============================================================================= | |
| name: Build & Test | |
| on: | |
| push: | |
| branches: [main, master] | |
| paths-ignore: | |
| - "docs/**" | |
| - "**.md" | |
| - "**.txt" | |
| pull_request: | |
| branches: [main, master] | |
| # 取消重复的正在运行的构建 / Cancel duplicate in-progress builds | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| BUILD_TYPE: Release | |
| jobs: | |
| # ───────────────────────────────────────────────────────── | |
| # 代码质量检查 / Code Quality | |
| # ───────────────────────────────────────────────────────── | |
| code-quality: | |
| name: Code Quality | |
| runs-on: ubuntu-latest | |
| continue-on-error: true # 不阻塞 PR / Don't block PR | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Tools | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq cppcheck clang-format 2>/dev/null || true | |
| - name: Static Analysis (cppcheck) | |
| continue-on-error: true | |
| run: | | |
| if command -v cppcheck &>/dev/null; then | |
| cppcheck --version | |
| cppcheck --enable=warning,style,performance,portability \ | |
| --suppress=missingIncludeSystem \ | |
| --suppress=unmatchedSuppression \ | |
| --error-exitcode=0 \ | |
| src/ tests/ examples/ 2>&1 || true | |
| fi | |
| echo "cppcheck check completed (non-fatal)" | |
| - name: Formatting Check (clang-format) | |
| continue-on-error: true | |
| run: | | |
| if command -v clang-format &>/dev/null; then | |
| find src/ tests/ examples/ -name "*.c" -o -name "*.h" | \ | |
| xargs clang-format --dry-run -Werror 2>&1 || \ | |
| echo "clang-format: formatting suggestions available (non-fatal)" | |
| else | |
| echo "clang-format not available, skipping" | |
| fi | |
| # ───────────────────────────────────────────────────────── | |
| # 多平台编译矩阵 / Multi-platform Build Matrix | |
| # ───────────────────────────────────────────────────────── | |
| build: | |
| name: ${{ matrix.os }} (${{ matrix.cc }}, ${{ matrix.build_type }}) | |
| needs: [code-quality] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false # 一个失败不取消其他 / Don't cancel other jobs | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| cc: [gcc, clang] | |
| build_type: [Debug, Release] | |
| exclude: | |
| # macOS 默认是 clang,跳过 gcc 以节省资源 | |
| - os: macos-latest | |
| cc: gcc | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Dependencies (Linux) | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y -qq cmake build-essential clang 2>/dev/null || true | |
| - name: Install Dependencies (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| echo "macOS tools pre-installed" | |
| cmake --version | |
| which make | |
| - name: Configure CMake | |
| run: | | |
| cmake -B build -G "Unix Makefiles" \ | |
| -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
| -DCMAKE_C_COMPILER=${{ matrix.cc }} \ | |
| -DENABLE_TESTS=ON \ | |
| -DENABLE_EXAMPLES=ON \ | |
| -DENABLE_ASAN=OFF \ | |
| -Wno-dev | |
| echo "--- CMake Cache: ENABLE_TESTS ---" | |
| grep -E "ENABLE_TESTS|WITH_REMOTE" build/CMakeCache.txt || true | |
| - name: Build All (verbose on failure) | |
| run: | | |
| JOBS=$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2) | |
| cmake --build build -j${JOBS} 2>&1 || { | |
| echo "=== First build attempt failed, retrying with VERBOSE ===" | |
| cmake --build build -j1 --verbose 2>&1 | |
| exit 1 | |
| } | |
| - name: List Built Artifacts | |
| run: | | |
| echo "=== Build directory structure ===" | |
| find build -name "test_*" -o -name "scloader*" 2>/dev/null | sort | |
| echo "=== tests/ directory ===" | |
| ls -la build/tests/ 2>/dev/null || echo "(no tests dir)" | |
| echo "=== bin/ directory ===" | |
| ls -la build/bin/ 2>/dev/null || echo "(no bin dir)" | |
| - name: Run Tests | |
| run: | | |
| cd build | |
| ctest --output-on-failure --timeout 30 -V 2>&1 |