From 538c093b9ccd453fe9037d1a36b00524fd7fca16 Mon Sep 17 00:00:00 2001 From: Xuan Wang Date: Fri, 17 Nov 2023 11:09:48 -0800 Subject: [PATCH] Add black-check to workflow (#3) * Test workflow * Try add balck action * Enable for pull request * Change triger back --- .github/workflows/psm-interop.yaml | 13 +++++++++++++ black.toml | 16 ++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 black.toml diff --git a/.github/workflows/psm-interop.yaml b/.github/workflows/psm-interop.yaml index 6a925c66..eee81fb7 100644 --- a/.github/workflows/psm-interop.yaml +++ b/.github/workflows/psm-interop.yaml @@ -1,5 +1,9 @@ name: PSM Interop +env: + # Force the stdout and stderr streams to be unbuffered + PYTHONUNBUFFERED: 1 + on: pull_request: push: @@ -72,3 +76,12 @@ jobs: - name: "Run unit tests" if: ${{ steps.paths_filter.outputs.psm_interop_src == 'true' }} run: python -m tests.unit + + black-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: psf/black@stable + with: + options: "--check --config black.toml" + version: "23.3.0" diff --git a/black.toml b/black.toml new file mode 100644 index 00000000..2c6f5325 --- /dev/null +++ b/black.toml @@ -0,0 +1,16 @@ +[tool.black] +line-length = 80 +target-version = [ + "py37", + "py38", + "py39", + "py310", + "py311", +] + +[tool.isort] +profile = "black" +line_length = 80 +single_line_exclusions = ["typing"] +force_single_line = true +force_sort_within_sections = true