From af96e002a4f2fbf6c844252c238684c441eedeef Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Mon, 7 Nov 2022 15:31:02 +0100 Subject: [PATCH] merge black job into testing workflow (#3539) --- .github/workflows/black.yml | 51 ------------------------ .github/workflows/tests.yml | 78 +++++++++++++++++++++++++------------ 2 files changed, 54 insertions(+), 75 deletions(-) delete mode 100644 .github/workflows/black.yml diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index c83869459..000000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0e1a2fe85..ce3ab7df3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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: