Release v1.3.5: Fix critical status override bug #34
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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master ] | |
| release: | |
| types: [ published ] | |
| jobs: | |
| test-backend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| cd backend | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov | |
| - name: Run backend tests | |
| run: | | |
| cd backend | |
| python -m pytest tests/ -v --cov=. --cov-report=xml || echo "Tests not yet implemented" | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./backend/coverage.xml | |
| flags: backend | |
| name: backend-coverage | |
| continue-on-error: true | |
| test-frontend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Cache node modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: frontend/node_modules | |
| key: ${{ runner.os }}-node-${{ hashFiles('frontend/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install dependencies | |
| run: | | |
| cd frontend | |
| npm ci | |
| - name: Run frontend tests | |
| run: | | |
| cd frontend | |
| npm test -- --coverage --watchAll=false || echo "Tests not yet implemented" | |
| - name: Build frontend | |
| run: | | |
| cd frontend | |
| npm run build | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| needs: [test-backend, test-frontend] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build backend image | |
| run: | | |
| docker build -f Dockerfile.backend -t pcap-replaya-backend . | |
| - name: Build frontend image | |
| run: | | |
| docker build -f Dockerfile.frontend -t pcap-replaya-frontend . | |
| - name: Test Docker Compose | |
| run: | | |
| # Test that docker-compose file is valid | |
| docker compose config | |
| security-scan: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@master | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'sarif' | |
| output: 'trivy-results.sarif' | |
| continue-on-error: true | |
| - name: Upload Trivy scan results to GitHub Security tab | |
| uses: github/codeql-action/upload-sarif@v3 | |
| with: | |
| sarif_file: 'trivy-results.sarif' | |
| continue-on-error: true | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Python linting tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black flake8 isort | |
| - name: Run Python linting | |
| run: | | |
| cd backend | |
| black --check . || echo "Black formatting needed" | |
| flake8 . --max-line-length=88 --extend-ignore=E203,W503 || echo "Flake8 issues found" | |
| isort --check-only . || echo "Import sorting needed" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| - name: Install frontend dependencies | |
| run: | | |
| cd frontend | |
| npm ci | |
| - name: Run frontend linting | |
| run: | | |
| cd frontend | |
| npm run lint || echo "ESLint issues found" | |
| continue-on-error: true |