Deploy in production #43
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: Test Coverage | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| Coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.10.13 | |
| - name: Install Poetry | |
| run: curl -sSL https://install.python-poetry.org | python3 - | |
| - name: Add Poetry to PATH | |
| run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Configure Poetry to create virtualenvs in project | |
| run: poetry config virtualenvs.in-project true | |
| - name: Cache Poetry dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| .venv | |
| ~/.cache/pypoetry | |
| key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-poetry- | |
| - name: Install Dependencies | |
| run: | | |
| poetry add pytest-cov --dev | |
| poetry install --no-interaction --no-root | |
| - name: Check Poetry environment | |
| run: poetry show --tree | |
| - name: Run tests with coverage | |
| run: poetry run pytest --cov=app --cov-report=xml --cov-fail-under=75 | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage.xml |