Skip to content

Commit

Permalink
Action fail
Browse files Browse the repository at this point in the history
  • Loading branch information
dyakovri committed Aug 26, 2023
1 parent 9f3b6f8 commit 6db74e0
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Python package
on:
pull_request:


jobs:
test:
name: Unit tests
Expand All @@ -19,7 +18,7 @@ jobs:
docker run -d -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust --name db-test postgres:15-alpine
- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: "3.11"
- name: Install dependencies
run: |
python -m ensurepip
Expand All @@ -29,8 +28,15 @@ jobs:
run: |
DB_DSN=postgresql://postgres@localhost:5432/postgres alembic upgrade head
- name: Build coverage file
id: pytest
run: |
DB_DSN=postgresql://postgres@localhost:5432/postgres pytest --junitxml=pytest.xml --cov-report=term-missing:skip-covered tests/ | tee pytest-coverage.txt
DB_DSN=postgresql://postgres@localhost:5432/postgres \
pytest \
--junitxml=pytest.xml \
--cov-report=term-missing:skip-covered \
tests/ \
| tee pytest-coverage.txt
exit ${PIPESTATUS[0]}
- name: Print report
if: always()
run: |
Expand All @@ -49,6 +55,9 @@ jobs:
remove-link-from-badge: false
junitxml-path: ./pytest.xml
junitxml-title: Summary
- name: Fail
if: always() && steps.pytest.outcome == 'failure'
run: exit 1
linting:
runs-on: ubuntu-latest
steps:
Expand All @@ -61,8 +70,12 @@ jobs:
requirementsFiles: "requirements.txt requirements.dev.txt"
- uses: psf/black@stable
- name: Comment if linting failed
if: ${{ failure() }}
if: failure()
id: comment
uses: thollander/actions-comment-pull-request@v2
with:
message: |
:poop: Code linting failed, use `black` and `isort` to fix it.
:poop: Code linting failed, use `black` and `isort` to fix it.
- name: Fail
if: steps.comment.conclusion != 'failure' && steps.comment.conclusion != 'skipped'
run: exit 1

0 comments on commit 6db74e0

Please sign in to comment.