Skip to content

Commit af96e00

Browse files
authored
merge black job into testing workflow (#3539)
1 parent 794fe5f commit af96e00

File tree

2 files changed

+54
-75
lines changed

2 files changed

+54
-75
lines changed

.github/workflows/black.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,52 @@ env:
2929

3030
jobs:
3131

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+
3278
mypy:
3379
runs-on: ubuntu-latest
3480
steps:
@@ -93,9 +139,7 @@ jobs:
93139

94140
unit-tests:
95141
name: Unit / ${{ matrix.topic }} / ${{ matrix.os }}
96-
needs:
97-
- mypy
98-
- pylint
142+
needs: [mypy, pylint, black]
99143
strategy:
100144
fail-fast: false
101145
matrix:
@@ -256,9 +300,7 @@ jobs:
256300
#
257301

258302
unit-tests-linux:
259-
needs:
260-
- mypy
261-
- pylint
303+
needs: [mypy, pylint, black]
262304
strategy:
263305
fail-fast: false # Avoid cancelling the others if one of these fails
264306
matrix:
@@ -305,9 +347,7 @@ jobs:
305347
if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main'
306348

307349
unit-tests-windows:
308-
needs:
309-
- mypy
310-
- pylint
350+
needs: [mypy, pylint, black]
311351
strategy:
312352
fail-fast: false # Avoid cancelling the others if one of these fails
313353
matrix:
@@ -420,9 +460,7 @@ jobs:
420460
if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main'
421461

422462
milvus-tests-linux:
423-
needs:
424-
- mypy
425-
- pylint
463+
needs: [mypy, pylint, black]
426464
runs-on: ubuntu-latest
427465
if: contains(github.event.pull_request.labels.*.name, 'topic:milvus') || !github.event.pull_request.draft
428466

@@ -501,9 +539,7 @@ jobs:
501539

502540

503541
weaviate-tests-linux:
504-
needs:
505-
- mypy
506-
- pylint
542+
needs: [mypy, pylint, black]
507543
runs-on: ubuntu-latest
508544
if: contains(github.event.pull_request.labels.*.name, 'topic:weaviate') || !github.event.pull_request.draft
509545

@@ -575,9 +611,7 @@ jobs:
575611

576612

577613
pinecone-tests-linux:
578-
needs:
579-
- mypy
580-
- pylint
614+
needs: [mypy, pylint, black]
581615
runs-on: ubuntu-latest
582616
if: contains(github.event.pull_request.labels.*.name, 'topic:pinecone') || !github.event.pull_request.draft
583617

@@ -608,9 +642,7 @@ jobs:
608642
if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main'
609643

610644
pinecone-tests-windows:
611-
needs:
612-
- mypy
613-
- pylint
645+
needs: [mypy, pylint, black]
614646
runs-on: windows-latest
615647
if: contains(github.event.pull_request.labels.*.name, 'topic:pinecone') && contains(github.event.pull_request.labels.*.name, 'topic:windows') || !github.event.pull_request.draft
616648

@@ -645,9 +677,7 @@ jobs:
645677
if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main'
646678

647679
rest-and-ui:
648-
needs:
649-
- mypy
650-
- pylint
680+
needs: [mypy, pylint, black]
651681

652682
strategy:
653683
matrix:

0 commit comments

Comments
 (0)