|
29 | 29 |
|
30 | 30 | jobs: |
31 | 31 |
|
| 32 | + black: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + |
| 36 | + - uses: actions/checkout@v3 |
| 37 | + |
| 38 | + - name: Setup Python |
| 39 | + uses: ./.github/actions/python_cache/ |
| 40 | + |
| 41 | + - name: Install Haystack |
| 42 | + run: | |
| 43 | + pip install --upgrade pip |
| 44 | + pip install .[dev] |
| 45 | +
|
| 46 | + - name: Check status |
| 47 | + run: | |
| 48 | + if ! black . --check; then |
| 49 | + git status |
| 50 | + echo "###################################################################################################" |
| 51 | + echo "# " |
| 52 | + echo "# CHECK FAILED! Black found issues with your code formatting." |
| 53 | + echo "# " |
| 54 | + echo "# Either:" |
| 55 | + echo "# 1. Run Black locally before committing:" |
| 56 | + echo "# " |
| 57 | + echo "# pip install black==22.6.0" |
| 58 | + echo "# black ." |
| 59 | + echo "# " |
| 60 | + echo "# 2. Install the pre-commit hook:" |
| 61 | + echo "# " |
| 62 | + echo "# pre-commit install --hook-type pre-push" |
| 63 | + echo "# " |
| 64 | + echo "# 3. See https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md for help." |
| 65 | + echo "# " |
| 66 | + echo "# If you have further problems, please open an issue: https://github.com/deepset-ai/haystack/issues" |
| 67 | + echo "# " |
| 68 | + echo "##################################################################################################" |
| 69 | + exit 1 |
| 70 | + fi |
| 71 | +
|
| 72 | + - uses: act10ns/slack@v1 |
| 73 | + with: |
| 74 | + status: ${{ job.status }} |
| 75 | + channel: '#haystack' |
| 76 | + if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main' |
| 77 | + |
32 | 78 | mypy: |
33 | 79 | runs-on: ubuntu-latest |
34 | 80 | steps: |
|
93 | 139 |
|
94 | 140 | unit-tests: |
95 | 141 | name: Unit / ${{ matrix.topic }} / ${{ matrix.os }} |
96 | | - needs: |
97 | | - - mypy |
98 | | - - pylint |
| 142 | + needs: [mypy, pylint, black] |
99 | 143 | strategy: |
100 | 144 | fail-fast: false |
101 | 145 | matrix: |
@@ -256,9 +300,7 @@ jobs: |
256 | 300 | # |
257 | 301 |
|
258 | 302 | unit-tests-linux: |
259 | | - needs: |
260 | | - - mypy |
261 | | - - pylint |
| 303 | + needs: [mypy, pylint, black] |
262 | 304 | strategy: |
263 | 305 | fail-fast: false # Avoid cancelling the others if one of these fails |
264 | 306 | matrix: |
@@ -305,9 +347,7 @@ jobs: |
305 | 347 | if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main' |
306 | 348 |
|
307 | 349 | unit-tests-windows: |
308 | | - needs: |
309 | | - - mypy |
310 | | - - pylint |
| 350 | + needs: [mypy, pylint, black] |
311 | 351 | strategy: |
312 | 352 | fail-fast: false # Avoid cancelling the others if one of these fails |
313 | 353 | matrix: |
@@ -420,9 +460,7 @@ jobs: |
420 | 460 | if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main' |
421 | 461 |
|
422 | 462 | milvus-tests-linux: |
423 | | - needs: |
424 | | - - mypy |
425 | | - - pylint |
| 463 | + needs: [mypy, pylint, black] |
426 | 464 | runs-on: ubuntu-latest |
427 | 465 | if: contains(github.event.pull_request.labels.*.name, 'topic:milvus') || !github.event.pull_request.draft |
428 | 466 |
|
@@ -501,9 +539,7 @@ jobs: |
501 | 539 |
|
502 | 540 |
|
503 | 541 | weaviate-tests-linux: |
504 | | - needs: |
505 | | - - mypy |
506 | | - - pylint |
| 542 | + needs: [mypy, pylint, black] |
507 | 543 | runs-on: ubuntu-latest |
508 | 544 | if: contains(github.event.pull_request.labels.*.name, 'topic:weaviate') || !github.event.pull_request.draft |
509 | 545 |
|
@@ -575,9 +611,7 @@ jobs: |
575 | 611 |
|
576 | 612 |
|
577 | 613 | pinecone-tests-linux: |
578 | | - needs: |
579 | | - - mypy |
580 | | - - pylint |
| 614 | + needs: [mypy, pylint, black] |
581 | 615 | runs-on: ubuntu-latest |
582 | 616 | if: contains(github.event.pull_request.labels.*.name, 'topic:pinecone') || !github.event.pull_request.draft |
583 | 617 |
|
@@ -608,9 +642,7 @@ jobs: |
608 | 642 | if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main' |
609 | 643 |
|
610 | 644 | pinecone-tests-windows: |
611 | | - needs: |
612 | | - - mypy |
613 | | - - pylint |
| 645 | + needs: [mypy, pylint, black] |
614 | 646 | runs-on: windows-latest |
615 | 647 | if: contains(github.event.pull_request.labels.*.name, 'topic:pinecone') && contains(github.event.pull_request.labels.*.name, 'topic:windows') || !github.event.pull_request.draft |
616 | 648 |
|
@@ -645,9 +677,7 @@ jobs: |
645 | 677 | if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main' |
646 | 678 |
|
647 | 679 | rest-and-ui: |
648 | | - needs: |
649 | | - - mypy |
650 | | - - pylint |
| 680 | + needs: [mypy, pylint, black] |
651 | 681 |
|
652 | 682 | strategy: |
653 | 683 | matrix: |
|
0 commit comments