feat: check formatting, linting and tests in CI
Every push runs ruff, prettier, pytest and svelte-check; a tagged release runs the blocking half again before it publishes an image. eslint and svelte-check report without failing, since 87 and 30 findings predate the workflow.
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
name: ci
|
||||
|
||||
# Formatting, linting, types and tests on every push and pull request.
|
||||
#
|
||||
# Blocking: the checks that are clean today — ruff format, ruff check, prettier, pytest.
|
||||
# Non-blocking: eslint and svelte-check, which still report 87 and 30 pre-existing errors.
|
||||
# Those need real code changes rather than a formatter, so they report without failing the
|
||||
# build; drop the `continue-on-error` line from a step once its count reaches zero.
|
||||
#
|
||||
# The release workflow runs the blocking half again before it publishes anything.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['**']
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
backend:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# astral-sh/setup-uv is not mirrored on gitea.com, unlike the actions used elsewhere
|
||||
# here, so install uv directly rather than depending on DEFAULT_ACTIONS_URL.
|
||||
- name: Install uv
|
||||
run: |
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --locked
|
||||
|
||||
- name: Format
|
||||
run: uv run ruff format --check src/
|
||||
|
||||
- name: Lint
|
||||
run: uv run ruff check src/
|
||||
|
||||
# pytest-databases starts a throwaway PostgreSQL container, so this needs a working
|
||||
# Docker daemon on the runner — the same requirement the release workflow has.
|
||||
- name: Tests
|
||||
run: uv run pytest tests/ -q
|
||||
|
||||
frontend:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
|
||||
- name: Enable pnpm
|
||||
run: corepack enable
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
# Split out of `pnpm lint` (which is prettier && eslint) so formatting can block
|
||||
# while eslint does not.
|
||||
- name: Format
|
||||
run: pnpm exec prettier --check .
|
||||
|
||||
- name: Lint
|
||||
run: pnpm exec eslint .
|
||||
continue-on-error: true
|
||||
|
||||
- name: Types
|
||||
run: pnpm check
|
||||
continue-on-error: true
|
||||
@@ -23,7 +23,42 @@ env:
|
||||
REGISTRY: git.jaroszew.ski
|
||||
|
||||
jobs:
|
||||
# The blocking half of ci.yml, run again on the tagged commit so a release cannot publish
|
||||
# an image whose tests fail. Deliberately duplicated rather than shared: Gitea's support
|
||||
# for reusable workflows is thinner than GitHub's, and this is a dozen lines.
|
||||
# Keep in step with ci.yml.
|
||||
quality:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install uv
|
||||
run: |
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Backend format, lint and tests
|
||||
working-directory: backend
|
||||
run: |
|
||||
uv sync --locked
|
||||
uv run ruff format --check src/
|
||||
uv run ruff check src/
|
||||
uv run pytest tests/ -q
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
|
||||
- name: Frontend format
|
||||
working-directory: frontend
|
||||
run: |
|
||||
corepack enable
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm exec prettier --check .
|
||||
|
||||
build:
|
||||
needs: quality
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
|
||||
Reference in New Issue
Block a user