Документация #64
Workflow file for this run
This file contains 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: Python package | |
on: | |
pull_request: | |
jobs: | |
test: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up docker | |
uses: docker-practice/actions-setup-docker@master | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m ensurepip | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt -r requirements.dev.txt | |
- name: Run postgres | |
run: | | |
make db | |
- name: Migrate DB | |
run: | | |
make migrate | |
- name: Run redis | |
run: | | |
make redis | |
- name: Build coverage file | |
run: | | |
DB_DSN=postgresql://postgres@localhost:5432/postgres pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered --cov=print_service tests/ | tee pytest-coverage.txt | |
- name: Print report | |
if: always() | |
run: | | |
cat pytest-coverage.txt | |
- name: Pytest coverage comment | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
pytest-coverage-path: ./pytest-coverage.txt | |
title: Coverage Report | |
badge-title: Code Coverage | |
hide-badge: false | |
hide-report: false | |
create-new-comment: false | |
hide-comment: false | |
report-only-changed-files: false | |
remove-link-from-badge: false | |
junitxml-path: ./pytest.xml | |
junitxml-title: Summary | |
linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11 | |
- uses: isort/isort-action@master | |
with: | |
requirementsFiles: "requirements.txt requirements.dev.txt" | |
- uses: psf/black@stable | |
- name: Comment if linting failed | |
if: ${{ failure() }} | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
message: | | |
:poop: Code linting failed, use `black` and `isort` to fix it. |