--- /dev/null
+name: CI (Python)
+
+on:
+ push:
+ branches: [ "main" ]
+ pull_request:
+ branches: [ "main" ]
+
+permissions:
+ contents: read
+
+jobs:
+ build-test:
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ python-version: [ "3.12" ] # aggiungi "3.11" se vuoi test multi-versione
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v5
+ with:
+ python-version: ${{ matrix.python-version }}
+ cache: 'pip'
+ cache-dependency-path: |
+ requirements.txt
+ requirements-dev.txt
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+ if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
+
+ # Lint (opzionale: richiede flake8 o ruff in requirements-dev.txt)
+ - name: Lint (flake8 se presente)
+ run: |
+ if python -c "import flake8" 2>/dev/null; then \
+ flake8 backend || exit 1; \
+ else \
+ echo "flake8 non installato, skip"; \
+ fi
+
+ # Test (opzionale: richiede pytest)
+ - name: Test (pytest se presente)
+ env:
+ CI: "true"
+ # Esempio: DB temporaneo se serve
+ # DB_PATH: tmp/test.db
+ run: |
+ if python -c "import pytest" 2>/dev/null; then \
+ mkdir -p tmp; \
+ pytest -q || exit 1; \
+ else \
+ echo "pytest non installato, skip"; \
+ fi
+
+ # Build “immagine” applicativa (se hai uno script di build o raccolta asset)
+ - name: Build (se hai uno script)
+ run: |
+ if [ -f Makefile ] && grep -q "^build:" Makefile; then \
+ make build; \
+ elif [ -f package.json ]; then \
+ npm ci || true; npm run build --if-present; \
+ else \
+ echo "Nessuna build da eseguire"; \
+ fi
+
+ # Artifact della build (opzionale)
+ - name: Upload artifact (dist/build)
+ uses: actions/upload-artifact@v4
+ with:
+ name: build-${{ github.sha }}
+ path: |
+ dist
+ build
+ out
+ if-no-files-found: ignore
--- /dev/null
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ "main" ]
+ pull_request:
+ branches: [ "main" ]
+ schedule:
+ - cron: '0 3 * * 1' # every monday at 03:00
+
+permissions:
+ contents: read
+ security-events: write
+
+jobs:
+ analyze:
+ name: Analyze (Python + JavaScript)
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v3
+ with:
+ languages: 'python,javascript'
+ # queries: security-and-quality
+
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@v3
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v3
+ with:
+ category: "/language:multi"
# Network Manager
[![Last Commit][last-commit-img]][last-commit-url]
[![License Status][license-img]][license-url]
+[![Check Status][check-status-img]][check-status-url]
[![BuyMeCoffee][buymecoffee-img]][buymecoffee-url]
## 🌐 Network management web app
[releases-url]: https://github.com/xraver/network-manager/releases
[last-commit-img]: https://img.shields.io/github/last-commit/xraver/network-manager
[last-commit-url]: https://github.com/xraver/network-manager/commits/master
+[check-status-img]: https://github.com/xraver/network-manager/actions/workflows/ci.yaml/badge.svg
+[check-status-img]: https://github.com/xraver/network-manager/actions/workflows/ci.yaml
[buymecoffee-img]: https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg
[buymecoffee-button]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg
[buymecoffee-url]: https://www.buymeacoffee.com/raverag
\ No newline at end of file