From def350411a20884b3500d9a08ab8393bde596daf Mon Sep 17 00:00:00 2001 From: Daniel Abraham Date: Tue, 9 Jul 2024 20:08:10 +0300 Subject: [PATCH] ENG-1075: Ruff CI (#17) --- .github/workflows/ci.yml | 32 ++++++++++++++++++++++++++++++++ Makefile | 16 ++++++++++++++++ requirements.txt | 2 ++ 3 files changed, 50 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 Makefile create mode 100644 requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..67b801a6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +# Continuous Integration workflow. For more information see: +# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python +# https://docs.astral.sh/ruff/integrations/#github-actions + +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + lint-format-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: pip + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Lint & format with ruff + run: | + ruff check --output-format github . + ruff format --check . + # (Enable this step once we have unit tests) + # - name: Test with pytest + # run: pytest -v diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..c17e293c --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +# Add "test" once we have unit tests +all: deps format lint # test + +deps: + python -m pip install -r requirements.txt + +format: deps + ruff format . + +lint: deps + ruff check --fix --output-format full . + +test: deps + pytest -v + +.PHONY: all deps format lint test diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..e8e76619 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +pytest ~= 8.2 +ruff ~= 0.5