From 9f76e75f6716771b1f97f01d869c8d2f6c55c314 Mon Sep 17 00:00:00 2001 From: Han Dai Date: Mon, 18 Dec 2023 13:56:12 -0500 Subject: [PATCH] add formatter and linter to ci --- .github/workflows/{test.yml => ci.yml} | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) rename .github/workflows/{test.yml => ci.yml} (63%) diff --git a/.github/workflows/test.yml b/.github/workflows/ci.yml similarity index 63% rename from .github/workflows/test.yml rename to .github/workflows/ci.yml index 0da4938..0b8c916 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,10 @@ on: pull_request: jobs: - test: + ci: + strategy: + matrix: + task: [test, lint, format] runs-on: ubuntu-22.04 steps: - name: Checkout @@ -25,8 +28,18 @@ jobs: - name: Install Package run: | python3 -m pip install --upgrade pip - python3 -m pip install --upgrade pytest + python3 -m pip install --upgrade pytest ruff black isort python3 -m pip install -e . - name: Run pytest + if: matrix.task == 'test' run: | python3 -m pytest + - name: Run formatter + if: matrix.task == 'format' + run: | + python3 -m isort . --profile black --check-only --diff + python3 -m black . --check + - name: Run linter + if: matrix.task == 'lint' + run: | + python3 -m ruff check .