fix(ci): add missing pyotp runtime dependency #27
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, 'feature/*' ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.10 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Cache dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Run tests | |
| run: | | |
| python -m pytest tests/ -v --tb=short | |
| build: | |
| name: Build Docker Image | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| run: | | |
| docker build -t credify:${{ github.sha }} . | |
| - name: Test Docker image starts correctly | |
| run: | | |
| docker run -d -p 5000:5000 --name test-app \ | |
| -e DATABASE_URL=sqlite:////tmp/credify.db \ | |
| -e INITIAL_ADMIN_PASSWORD=testadmin123 \ | |
| credify:${{ github.sha }} | |
| sleep 15 | |
| curl -f http://localhost:5000/ || exit 1 | |
| docker stop test-app | |
| docker rm test-app | |
| lint: | |
| name: Code Quality Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install linting tools | |
| run: | | |
| pip install flake8 black | |
| - name: Run flake8 | |
| run: | | |
| flake8 app/ core/ --count --select=E9,F63,F7,F82 --show-source --statistics | |
| continue-on-error: true | |
| - name: Check code formatting | |
| run: | | |
| black --check --target-version py310 app/ core/ | |
| continue-on-error: true |