From 4ff528f376f9afd1f130005382e3be199c5ebd4b Mon Sep 17 00:00:00 2001 From: erdem Date: Fri, 16 Aug 2024 15:35:37 +0100 Subject: [PATCH] Add github CI config and project MakeFile --- .github/workflows/ci.yml | 62 ++++++++++++++++++++++++++++++++++++++++ Makefile | 19 ++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 Makefile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5d09b27 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + linter: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + poetry install + + - name: Run isort + run: make isort + env: + POETRY_VIRTUALENVS_IN_PROJECT: true + + - name: Run black + run: make black + env: + POETRY_VIRTUALENVS_IN_PROJECT: true + + tests: + runs-on: ubuntu-latest + needs: linter + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + poetry install + + - name: Run tests + run: make run_tests + env: + POETRY_VIRTUALENVS_IN_PROJECT: true \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3108b37 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +install: + poetry install --no-root + +dev: + poetry run fastapi dev src/main.py + +test: + poetry run python src/tests.py + +black: + poetry run black . + +isort: + poetry run isort . + +run_tests: + poetry run pytest . + +.PHONY: install dev