diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b215481 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,69 @@ +name: CI + +on: + push: + branches: ["**"] + pull_request: + branches: ["**"] + +permissions: + contents: read + +jobs: + backend: + name: Backend (Python) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: "pip" + cache-dependency-path: backend/requirements.txt + + - name: Install dependencies + working-directory: backend + run: pip install -r requirements.txt + + - name: Compile backend + working-directory: backend + run: python -m py_compile main.py mavlink_adapter.py dji_adapter.py + + - name: Run tests (if present) + working-directory: backend + run: | + if [ -f pytest.ini ] || [ -d tests ]; then + pip install pytest + pytest + else + echo "No tests found, skipping." + fi + + frontend: + name: Frontend (Node) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Node 20 + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Cache node_modules + uses: actions/cache@v4 + with: + path: skydash/frontend/node_modules + key: ${{ runner.os }}-node-${{ hashFiles('skydash/frontend/package-lock.json', 'skydash/frontend/package.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - name: Install dependencies + working-directory: skydash/frontend + run: npm install + + - name: Build + working-directory: skydash/frontend + run: npm run build diff --git a/README.md b/README.md index dfec2d8..443ce0f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A real-time drone telemetry dashboard built with FastAPI and React, featuring a "High-Voltage / Dark Mode" aesthetic with glass morphism design. -   +[](https://github.com/mangod12/skydash/actions/workflows/ci.yml)    ## 📸 Dashboard Preview