fix: resolve npm peer dependency conflict and remove unused import #45
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
| name: PyVizAST CI/CD | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master ] | |
| release: | |
| types: [ published ] | |
| env: | |
| PYTHON_VERSION: '3.10' | |
| NODE_VERSION: '18' | |
| jobs: | |
| # Backend Tests | |
| backend-test: | |
| name: Backend Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov mypy ruff | |
| - name: Lint with ruff | |
| run: | | |
| ruff check backend/ --output-format=github | |
| - name: Type check with mypy | |
| run: | | |
| mypy backend/ --ignore-missing-imports --no-error-summary || true | |
| - name: Run tests | |
| run: | | |
| pytest backend/ -v --cov=backend --cov-report=xml --cov-report=html || true | |
| continue-on-error: true | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v4 | |
| if: always() | |
| with: | |
| files: ./coverage.xml | |
| fail_ci_if_error: false | |
| # Frontend Tests | |
| frontend-test: | |
| name: Frontend Tests | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run linter | |
| run: npm run lint || true | |
| continue-on-error: true | |
| - name: Run tests | |
| run: npm test -- --watchAll=false --passWithNoTests || true | |
| continue-on-error: true | |
| - name: Build | |
| run: npm run build | |
| # Code Quality Analysis | |
| code-quality: | |
| name: Code Quality Analysis | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Analyze with PyVizAST | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| console.log('PyVizAST Code Quality Analysis'); | |
| // This would integrate with the PyVizAST API for analysis | |
| // In a real implementation, this would analyze the codebase | |
| # Build and Deploy | |
| build: | |
| name: Build | |
| needs: [backend-test, frontend-test] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' || github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: 'pip' | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install backend dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Install frontend dependencies and build | |
| run: | | |
| cd frontend | |
| npm install | |
| npm run build | |
| - name: Create artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pyvizast-build | |
| path: | | |
| backend/ | |
| frontend/build/ | |
| requirements.txt | |
| run.py | |
| start.sh | |
| start.bat | |
| retention-days: 30 | |
| # Security Scan | |
| security-scan: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'table' | |
| exit-code: '0' | |
| ignore-unfixed: true | |
| severity: 'CRITICAL,HIGH' |