From 2e0ff367d9344e6aa80152d60587cb6071a3fef7 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Tue, 25 Apr 2023 00:46:02 +0300 Subject: [PATCH] CI: only run client lint once --- .github/workflows/backend.yml | 19 ++++++++++++++++++- client/python/scripts/{ci.sh => lint.sh} | 6 ++---- client/python/scripts/test.sh | 7 +++++++ 3 files changed, 27 insertions(+), 5 deletions(-) rename client/python/scripts/{ci.sh => lint.sh} (72%) create mode 100644 client/python/scripts/test.sh diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 43a27e65f647d..a0cba4ae05146 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -56,7 +56,24 @@ jobs: - name: Tests shell: bash run: | - bash scripts/ci.sh + bash scripts/test.sh + client-lint: + runs-on: ubuntu-latest + defaults: + run: + working-directory: client/python + steps: + - uses: actions/checkout@v3 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: "3.9" + cache: pip + cache-dependency-path: | + requirements.txt + test/requirements.txt + - name: Lint + run: bash scripts/lint.sh test: strategy: matrix: diff --git a/client/python/scripts/ci.sh b/client/python/scripts/lint.sh similarity index 72% rename from client/python/scripts/ci.sh rename to client/python/scripts/lint.sh index b1a1bed536fe6..44cd4b66ee69a 100644 --- a/client/python/scripts/ci.sh +++ b/client/python/scripts/lint.sh @@ -1,12 +1,10 @@ #!/bin/bash -set -e cd "$(dirname ${0})/.." echo "Linting..." ruff test gradio_client black --check test gradio_client -pyright gradio_client/*.py -echo "Testing..." -python -m pytest test +echo "Type checking the client library with pyright" +pyright gradio_client/*.py diff --git a/client/python/scripts/test.sh b/client/python/scripts/test.sh new file mode 100644 index 0000000000000..73c27ba7efc51 --- /dev/null +++ b/client/python/scripts/test.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e + +cd "$(dirname ${0})/.." + +echo "Testing..." +python -m pytest test