merge black job into testing workflow (#3539)

This commit is contained in:
Massimiliano Pippi 2022-11-07 15:31:02 +01:00 committed by GitHub
parent 794fe5ffa4
commit af96e002a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 75 deletions

View File

@ -1,51 +0,0 @@
name: Black
on:
workflow_dispatch: # Activate this workflow manually
pull_request:
push:
branches:
# release branches have the form v1.9.x
- 'v[0-9].*[0-9].x'
jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: ./.github/actions/python_cache/
- name: Install Haystack
run: |
pip install --upgrade pip
pip install .[dev]
- name: Check status
run: |
if ! black . --check; then
git status
echo "###################################################################################################"
echo "# "
echo "# CHECK FAILED! Black found issues with your code formatting."
echo "# "
echo "# Either:"
echo "# 1. Run Black locally before committing:"
echo "# "
echo "# pip install black==22.6.0"
echo "# black ."
echo "# "
echo "# 2. Install the pre-commit hook:"
echo "# "
echo "# pre-commit install --hook-type pre-push"
echo "# "
echo "# 3. See https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md for help."
echo "# "
echo "# If you have further problems, please open an issue: https://github.com/deepset-ai/haystack/issues"
echo "# "
echo "##################################################################################################"
exit 1
fi

View File

@ -29,6 +29,52 @@ env:
jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: ./.github/actions/python_cache/
- name: Install Haystack
run: |
pip install --upgrade pip
pip install .[dev]
- name: Check status
run: |
if ! black . --check; then
git status
echo "###################################################################################################"
echo "# "
echo "# CHECK FAILED! Black found issues with your code formatting."
echo "# "
echo "# Either:"
echo "# 1. Run Black locally before committing:"
echo "# "
echo "# pip install black==22.6.0"
echo "# black ."
echo "# "
echo "# 2. Install the pre-commit hook:"
echo "# "
echo "# pre-commit install --hook-type pre-push"
echo "# "
echo "# 3. See https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md for help."
echo "# "
echo "# If you have further problems, please open an issue: https://github.com/deepset-ai/haystack/issues"
echo "# "
echo "##################################################################################################"
exit 1
fi
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
channel: '#haystack'
if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main'
mypy:
runs-on: ubuntu-latest
steps:
@ -93,9 +139,7 @@ jobs:
unit-tests:
name: Unit / ${{ matrix.topic }} / ${{ matrix.os }}
needs:
- mypy
- pylint
needs: [mypy, pylint, black]
strategy:
fail-fast: false
matrix:
@ -256,9 +300,7 @@ jobs:
#
unit-tests-linux:
needs:
- mypy
- pylint
needs: [mypy, pylint, black]
strategy:
fail-fast: false # Avoid cancelling the others if one of these fails
matrix:
@ -305,9 +347,7 @@ jobs:
if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main'
unit-tests-windows:
needs:
- mypy
- pylint
needs: [mypy, pylint, black]
strategy:
fail-fast: false # Avoid cancelling the others if one of these fails
matrix:
@ -420,9 +460,7 @@ jobs:
if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main'
milvus-tests-linux:
needs:
- mypy
- pylint
needs: [mypy, pylint, black]
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'topic:milvus') || !github.event.pull_request.draft
@ -501,9 +539,7 @@ jobs:
weaviate-tests-linux:
needs:
- mypy
- pylint
needs: [mypy, pylint, black]
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'topic:weaviate') || !github.event.pull_request.draft
@ -575,9 +611,7 @@ jobs:
pinecone-tests-linux:
needs:
- mypy
- pylint
needs: [mypy, pylint, black]
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'topic:pinecone') || !github.event.pull_request.draft
@ -608,9 +642,7 @@ jobs:
if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main'
pinecone-tests-windows:
needs:
- mypy
- pylint
needs: [mypy, pylint, black]
runs-on: windows-latest
if: contains(github.event.pull_request.labels.*.name, 'topic:pinecone') && contains(github.event.pull_request.labels.*.name, 'topic:windows') || !github.event.pull_request.draft
@ -645,9 +677,7 @@ jobs:
if: failure() && github.repository_owner == 'deepset-ai' && github.ref == 'refs/heads/main'
rest-and-ui:
needs:
- mypy
- pylint
needs: [mypy, pylint, black]
strategy:
matrix: