Skip to content

Commit f161790

Browse files
authored
chore: switch to ruff (baserow#4387)
* Switch to ruff * Fix flaky test * Remove frontend-lint changes * Fix all-in-one image creation in CI * Update saas target * Add changelog entry * Fix PYTHONPATH for lint-migrations * Run check-migrations in the CI
1 parent 376604e commit f161790

362 files changed

Lines changed: 1705 additions & 2162 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -200,22 +200,21 @@ jobs:
200200
name: Backend Lint
201201
runs-on: ubuntu-latest
202202
needs:
203-
- build-backend
204203
- detect-changes
205204
if: needs.detect-changes.outputs.backend == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
206-
permissions:
207-
contents: read
208-
packages: read
209205
steps:
210-
- name: Log in to GitHub Container Registry
211-
uses: docker/login-action@v3
206+
- uses: actions/checkout@v4
207+
208+
- name: Install uv
209+
uses: astral-sh/setup-uv@v4
212210
with:
213-
registry: ${{ env.REGISTRY }}
214-
username: ${{ github.actor }}
215-
password: ${{ secrets.GITHUB_TOKEN }}
211+
version: "0.5.6"
216212

217-
- name: Run backend lint
218-
run: docker run --rm ${{ needs.build-backend.outputs.image }} lint
213+
- name: Run ruff
214+
working-directory: backend
215+
run: |
216+
uvx ruff check src/ ../premium/backend/src/ ../enterprise/backend/src/ tests/ ../premium/backend/tests/ ../enterprise/backend/tests/
217+
uvx ruff format --check src/ ../premium/backend/src/ ../enterprise/backend/src/ tests/ ../premium/backend/tests/ ../enterprise/backend/tests/
219218
220219
frontend-lint:
221220
name: Web-Frontend Lint
@@ -361,12 +360,22 @@ jobs:
361360
-e DATABASE_USER=baserow \
362361
-e DATABASE_PASSWORD=baserow \
363362
${{ needs.build-backend.outputs.image }} ci-check-startup-oss-only
363+
- name: Check backend migrations
364+
run: |
365+
docker run --rm --network="${{ job.services.db.network }}" \
366+
-e DATABASE_HOST=db \
367+
-e DATABASE_PORT=5432 \
368+
-e DATABASE_NAME=baserow \
369+
-e DATABASE_USER=baserow \
370+
-e DATABASE_PASSWORD=baserow \
371+
${{ needs.build-backend.outputs.image }} ci-check-migrations
364372
365373
test-backend:
366374
name: Backend Tests (Group ${{ matrix.group }})
367375
runs-on: ubuntu-latest
368376
needs:
369377
- build-backend
378+
- backend-lint
370379
- detect-changes
371380
if: needs.detect-changes.outputs.backend == 'true' || github.ref_name == 'develop' || github.ref_name == 'master'
372381
permissions:
@@ -975,8 +984,8 @@ jobs:
975984
file: deploy/all-in-one/Dockerfile
976985
push: true
977986
build-args: |
978-
FROM_BACKEND_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/backend:ci-tested-${{ env.REAL_GITHUB_SHA }}
979-
FROM_WEBFRONTEND_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/web-frontend:ci-tested-${{ env.REAL_GITHUB_SHA }}
987+
BACKEND_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/backend:ci-tested-${{ env.REAL_GITHUB_SHA }}
988+
WEBFRONTEND_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/web-frontend:ci-tested-${{ env.REAL_GITHUB_SHA }}
980989
tags: |
981990
${{ env.REGISTRY }}/${{ env.IMAGE_REPO }}/baserow:ci-tested-${{ env.REAL_GITHUB_SHA }}
982991
cache-from: type=gha,scope=all-in-one

.gitlab/ci_includes/jobs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ============== "Abstract" ci stages used by real stages =======================
22

3-
# Builds a dev version of a specific Dockerfile (--target dev) using a previous CI
3+
# Builds a dev version of a specific Dockerfile (--target ci) using a previous CI
44
# image or the latest develop image as a cache to speed up the build. Tags and pushes
55
# the resulting dev image for later stages in the pipeline to use.
66
#
@@ -149,7 +149,7 @@
149149
$EXTRA_BUILD_ARGS \
150150
$IMAGE_LABELS \
151151
--push \
152-
--target dev \
152+
--target ci \
153153
--tag $CI_IMAGE_PATH \
154154
-f $DOCKERFILE_PATH .;
155155

backend/.flake8

Lines changed: 0 additions & 22 deletions
This file was deleted.

backend/.isort.cfg

Lines changed: 0 additions & 6 deletions
This file was deleted.

backend/docker/docker-entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,9 @@ case "$1" in
363363
ci-check-startup-oss-only)
364364
exec just ci-check-startup-oss-only
365365
;;
366+
ci-check-migrations)
367+
exec just check-migrations
368+
;;
366369
celery-worker)
367370
if [[ -n "${BASEROW_RUN_MINIMAL}" && $BASEROW_AMOUNT_OF_WORKERS == "1" ]]; then
368371
export OTEL_SERVICE_NAME="celery-worker-combined"

backend/flake8_plugins/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

backend/flake8_plugins/flake8_baserow/__init__.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

backend/flake8_plugins/flake8_baserow/docstring.py

Lines changed: 0 additions & 173 deletions
This file was deleted.

backend/flake8_plugins/flake8_baserow/psycopg.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)