From 278c6571f4b7689783d280fa0dda541c1fab7076 Mon Sep 17 00:00:00 2001 From: Artur Shiriev Date: Mon, 29 Apr 2024 21:58:12 +0300 Subject: [PATCH] add ci (#22) * add ci --- .github/workflows/main.yml | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..7e442e7 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,61 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.12" + - run: | + pip install -U pip poetry + poetry install --sync --no-root + poetry run ruff format . --check + poetry run ruff check . --no-fix + poetry run mypy . + + pytest: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:latest + env: + POSTGRES_DB: postgres + POSTGRES_PASSWORD: password + POSTGRES_USER: postgres + ports: + - 5432:5432 + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: "3.12" + - run: | + pip install -U pip poetry + poetry install --sync --no-root + poetry run alembic upgrade head + poetry run pytest + env: + ENVIRONMENT: dev + PYTHONDONTWRITEBYTECODE: 1 + PYTHONUNBUFFERED: 1 + DB_HOST: 127.0.0.1