Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple uv and ruff setup #1216

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
13 changes: 7 additions & 6 deletions .github/workflows/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
uses: docker/setup-buildx-action@v2
-
name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
Expand Down Expand Up @@ -85,7 +85,8 @@ jobs:
name: Build and push
uses: docker/build-push-action@v3
with:
context: ./backend
context: .
file: ./backend/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.backendMeta.outputs.tags }}
Expand All @@ -95,20 +96,20 @@ jobs:
name: Build and push
uses: docker/build-push-action@v3
with:
context: ./backend
context: .
file: ./backend/heartbeat.Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.heartbeatMeta.outputs.tags }}
file: ./backend/heartbeat.Dockerfile
labels: ${{ steps.heartbeatMeta.outputs.labels }}

-
name: Build and push
uses: docker/build-push-action@v3
with:
context: ./backend
context: .
file: ./backend/messages.Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.messagesMeta.outputs.tags }}
file: ./backend/messages.Dockerfile
labels: ${{ steps.messagesMeta.outputs.labels }}
24 changes: 6 additions & 18 deletions .github/workflows/codegen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,26 @@ jobs:
timeout-minutes: 10
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node:
- "14"

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build Backend no push
uses: docker/build-push-action@v3
with:
context: ./backend
context: .
file: ./backend/Dockerfile
platforms: linux/amd64
push: false
tags: github-action

- name: Start containers
run: docker compose -f "docker-compose.test.yml" up -d --build
run: docker compose -f "docker-compose.yml" up -d --build

# setup node
- name: Install node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
node-version: 16

- name: Install dependencies
working-directory: frontend
Expand All @@ -73,4 +61,4 @@ jobs:

- name: Stop containers
if: always()
run: docker compose -f "docker-compose.test.yml" down
run: docker compose -f "docker-compose.yml" down
35 changes: 10 additions & 25 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
name: Pytest

on: push

defaults:
run:
working-directory: backend

jobs:
test:
uv-example:
name: python
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Check out repository code
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- uses: actions/checkout@v4

- id: cache-pipenv
uses: actions/cache@v3
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install --deploy --dev
- name: Install the project
run: uv sync --all-extras --dev

- name: Start env
run: docker compose -f ../docker-compose.dev.yml up -d
Expand All @@ -42,6 +28,5 @@ jobs:
run: sleep 60s
shell: bash

- name: Run test suite
run: |
pipenv run pytest -v
- name: Run tests
run: uv run pytest app/tests/
30 changes: 11 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
hooks:
- id: extract-openapi
name: extract-openapi
entry: pipenv run extract-openapi
entry: python backend/extract-openapi.py app.main:app
language: system
pass_filenames: false
- repo: local
Expand All @@ -25,29 +25,21 @@ repos:
name: prettier
entry: bash -c "cd frontend && npx prettier src --write"
language: system
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: [ "--profile=black" ]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: check-yaml
exclude: deployments/kubernetes/charts
- id: end-of-file-fixer
exclude: 'openapi.json|frontend/src/openapi/v2/'
- id: trailing-whitespace
exclude: 'openapi.json|frontend/src/openapi/v2/'
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.9.4
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
46 changes: 0 additions & 46 deletions Pipfile

This file was deleted.

Loading