Merge pull request #8 from Dread1ess/dependabot/pip/redis-8.1.0 #24
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 & Security Pipeline | |
| on: | |
| push: | |
| branches: [ main, dev, "feat/*" ] | |
| pull_request: | |
| branches: [ main, dev ] | |
| jobs: | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository (full history for secret scanning) | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Scan for leaked secrets (Gitleaks) | |
| uses: gitleaks/gitleaks-action@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Python for Security Audits | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Audit Python dependencies for CVEs | |
| run: | | |
| python -m pip install pip-audit | |
| if [ -f requirements.txt ]; then pip-audit -r requirements.txt; fi | |
| - name: Run Static Code Analysis (Bandit) | |
| run: | | |
| python -m pip install bandit | |
| bandit -r . -x ./.venv,./tests | |
| test: | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Run tests with Pytest | |
| env: | |
| REDIS_URL: redis://localhost:6379 | |
| run: | | |
| pytest | |
| build: | |
| needs: [test, security] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: false | |
| tags: tmp-vault:latest |