fix(net): fix port check arg order, add detailed GDB conflict messages #576
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
| # FPBInject CI/CD Pipeline | |
| # | |
| # This workflow runs comprehensive tests for both lower machine (embedded firmware) | |
| # and upper machine (WebServer) components. | |
| name: FPBInject CI | |
| on: | |
| push: | |
| branches: [main, master, develop] | |
| paths: | |
| - "Source/**" | |
| - "App/**" | |
| - "Tools/**" | |
| - "cmake/**" | |
| - "CMakeLists.txt" | |
| - ".github/workflows/ci.yml" | |
| pull_request: | |
| branches: [main, master, develop] | |
| paths: | |
| - "Source/**" | |
| - "App/**" | |
| - "Tools/**" | |
| - "cmake/**" | |
| - "CMakeLists.txt" | |
| - ".github/workflows/ci.yml" | |
| jobs: | |
| # ============================================================ | |
| # Lower Machine Tests (Embedded Firmware) | |
| # ============================================================ | |
| lower-machine: | |
| name: Lower Machine Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| Tools/install-prerequisites.sh | |
| sudo apt-get install -y clang-format-14 shfmt | |
| sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-14 100 | |
| pip install cmake-format kconfiglib | |
| - name: CMake format check | |
| working-directory: . | |
| run: | | |
| echo "🔍 Checking CMake file format..." | |
| chmod +x Tools/cmake_format.sh | |
| Tools/cmake_format.sh --check | |
| echo "✅ CMake format check completed!" | |
| - name: Kconfig lint check | |
| working-directory: . | |
| run: | | |
| echo "🔍 Checking Kconfig syntax..." | |
| python3 Tools/kconfig_lint.py $(find . -name 'Kconfig*') | |
| echo "✅ Kconfig lint check completed!" | |
| - name: Check C/C++ code format | |
| working-directory: . | |
| run: | | |
| echo "🔍 Checking C/C++ code format..." | |
| chmod +x Tools/code_format.sh | |
| Tools/code_format.sh --check | |
| # Check if there are any formatting differences | |
| if ! git diff --quiet; then | |
| echo "❌ Code formatting check failed!" | |
| echo "The following files need formatting:" | |
| git diff --name-only | |
| echo "" | |
| echo "Please run 'Tools/code_format.sh' locally and commit the changes." | |
| exit 1 | |
| fi | |
| echo "✅ Code format check passed!" | |
| - name: Build test (all configurations) | |
| working-directory: . | |
| run: | | |
| echo "🔨 Running build tests..." | |
| chmod +x Tools/build_test.sh | |
| Tools/build_test.sh | |
| echo "✅ Build tests passed!" | |
| - name: Run firmware unit tests with coverage | |
| working-directory: App/tests | |
| run: | | |
| echo "🧪 Running firmware unit tests..." | |
| sudo apt-get install -y lcov bc | |
| chmod +x run_tests.sh | |
| ./run_tests.sh coverage --threshold 80 | |
| echo "✅ Firmware unit tests passed with 80%+ coverage!" | |
| - name: Upload firmware coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: firmware-coverage-report | |
| path: App/tests/build/coverage/ | |
| retention-days: 7 | |
| # ============================================================ | |
| # Upper Machine Tests (WebServer) | |
| # ============================================================ | |
| upper-machine: | |
| name: Upper Machine Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| cache-dependency-path: "Tools/requirements.txt" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install ARM toolchain (for ELF symbol tests) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-arm-none-eabi gdb-multiarch | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r Tools/requirements.txt | |
| pip install -r Tools/WebServer/tests/requirements.txt | |
| # mcp is optional (only needed by fpb_mcp_server.py), not in requirements.txt | |
| pip install mcp | |
| # Install additional tools for formatting and linting | |
| pip install black flake8 | |
| - name: Check Python/JS code format and lint | |
| working-directory: Tools/WebServer | |
| run: | | |
| echo "🔍 Checking Python/JavaScript code format and lint..." | |
| chmod +x format.sh | |
| ./format.sh --check --lint | |
| # Check if there are any formatting differences | |
| if ! git diff --quiet; then | |
| echo "❌ Code formatting check failed!" | |
| echo "The following files need formatting:" | |
| git diff --name-only | |
| echo "" | |
| echo "Please run 'Tools/WebServer/format.sh' locally and commit the changes." | |
| exit 1 | |
| fi | |
| echo "✅ Code format check passed!" | |
| - name: Run backend tests | |
| working-directory: Tools/WebServer | |
| run: | | |
| echo "🧪 Running backend Python tests..." | |
| python tests/run_tests.py --coverage --html --target 85 | |
| echo "✅ Backend tests passed!" | |
| - name: Install Node.js dependencies | |
| working-directory: Tools/WebServer | |
| run: | | |
| echo "📦 Installing Node.js dependencies..." | |
| npm install | |
| echo "✅ Node.js dependencies installed!" | |
| - name: Run frontend tests | |
| working-directory: Tools/WebServer | |
| run: | | |
| echo "🧪 Running frontend JavaScript tests with coverage..." | |
| node tests/test_frontend.js --coverage --ci --threshold 80 | |
| echo "✅ Frontend tests passed!" | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: coverage-report | |
| path: | | |
| Tools/WebServer/tests/htmlcov/ | |
| Tools/WebServer/tests/coverage/ | |
| retention-days: 7 | |
| # ============================================================ | |
| # Summary Job | |
| # ============================================================ | |
| ci-summary: | |
| name: CI Summary | |
| runs-on: ubuntu-latest | |
| needs: [lower-machine, upper-machine] | |
| if: always() | |
| steps: | |
| - name: Check job results | |
| run: | | |
| echo "=========================================" | |
| echo " FPBInject CI Summary" | |
| echo "=========================================" | |
| echo "" | |
| if [ "${{ needs.lower-machine.result }}" == "success" ]; then | |
| echo "✅ Lower Machine Tests: PASSED" | |
| else | |
| echo "❌ Lower Machine Tests: FAILED" | |
| fi | |
| if [ "${{ needs.upper-machine.result }}" == "success" ]; then | |
| echo "✅ Upper Machine Tests: PASSED" | |
| else | |
| echo "❌ Upper Machine Tests: FAILED" | |
| fi | |
| echo "" | |
| if [ "${{ needs.lower-machine.result }}" == "success" ] && [ "${{ needs.upper-machine.result }}" == "success" ]; then | |
| echo "🎉 All CI checks passed!" | |
| exit 0 | |
| else | |
| echo "💥 Some CI checks failed!" | |
| exit 1 | |
| fi |