Skip to content

Commit

Permalink
yaml: fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jelmer committed Nov 26, 2024
1 parent 0bbd425 commit 4b42ea5
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 76 deletions.
115 changes: 58 additions & 57 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
name: Python package

"on":
push:
branches:
- main
- main
pull_request:
schedule:
- cron: '0 6 * * *' # Daily 6AM UTC build
- cron: '0 6 * * *' # Daily 6AM UTC build

jobs:
build:
Expand All @@ -19,58 +20,58 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt -y update
sudo apt -y install devscripts bzr protobuf-compiler libapt-pkg-dev \
libgpg-error-dev libgpgme-dev subunit yamllint python3-wheel \
libjs-jquery-datatables postgresql-14 \
postgresql-14-debversion libssl-dev pkg-config codespell libtdb-dev
python -m pip install --upgrade pip setuptools setuptools-protobuf \
setuptools-rust wheel mypy-protobuf \
python_apt@git+https://salsa.debian.org/apt-team/[email protected]
pip install -U -e .[dev,debian]
python setup.py develop
python setup.py build_ext -i
make
- name: Style checks (ruff)
run: |
make ruff PYTHON=python
- name: Style checks (djlint)
if: always()
run: |
make djlint PYTHON=python
- name: Style checks (yamllint)
if: always()
run: |
make yamllint PYTHON=python
- name: Typing checks
if: always()
run: |
make typing PYTHON=python
- name: Build
if: always()
run: |
make all PYTHON=python
- name: Test suite run
run: |
make test PYTHON=python
env:
PYTHONHASHSEED: random
- name: codespell
run: |
codespell
- name: Config compat test
if: always()
run: |
git clone https://salsa.debian.org/janitor-team/janitor.debian.net/ \
janitor.debian.net
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python PYTHONPATH=py \
python3 -m janitor.config janitor.debian.net/k8s/janitor.conf
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt -y update
sudo apt -y install devscripts bzr protobuf-compiler libapt-pkg-dev \
libgpg-error-dev libgpgme-dev subunit yamllint python3-wheel \
libjs-jquery-datatables postgresql-14 \
postgresql-14-debversion libssl-dev pkg-config codespell libtdb-dev
python -m pip install --upgrade pip setuptools setuptools-protobuf \
setuptools-rust wheel mypy-protobuf \
python_apt@git+https://salsa.debian.org/apt-team/[email protected]
pip install -U -e .[dev,debian]
python setup.py develop
python setup.py build_ext -i
make
- name: Style checks (ruff)
run: |
make ruff PYTHON=python
- name: Style checks (djlint)
if: always()
run: |
make djlint PYTHON=python
- name: Style checks (yamllint)
if: always()
run: |
make yamllint PYTHON=python
- name: Typing checks
if: always()
run: |
make typing PYTHON=python
- name: Build
if: always()
run: |
make all PYTHON=python
- name: Test suite run
run: |
make test PYTHON=python
env:
PYTHONHASHSEED: random
- name: codespell
run: |
codespell
- name: Config compat test
if: always()
run: |
git clone https://salsa.debian.org/janitor-team/janitor.debian.net/ \
janitor.debian.net
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python PYTHONPATH=py \
python3 -m janitor.config janitor.debian.net/k8s/janitor.conf
15 changes: 6 additions & 9 deletions py/janitor/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from contextlib import AsyncExitStack
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Any, Optional
from typing import Any, Optional, cast

import aioredlock
import aiozipkin
Expand Down Expand Up @@ -459,7 +459,7 @@ async def publish_one(
role: str,
revision: bytes,
log_id: str,
unchanged_id: str,
unchanged_id: str | None,
derived_branch_name: str,
rate_limit_bucket: Optional[str],
vcs_manager: VcsManager,
Expand Down Expand Up @@ -1190,7 +1190,7 @@ async def publish_from_policy(
role=role,
revision=revision,
log_id=run.id,
unchanged_id=(unchanged_run["id"] if unchanged_run else None),
unchanged_id=(cast(str, unchanged_run["id"]) if unchanged_run else None),
derived_branch_name=await derived_branch_name(
conn, campaign_config, run, role
),
Expand Down Expand Up @@ -1789,10 +1789,7 @@ async def handle_publish_id(request):
)
if row:
raise web.HTTPNotFound(text=f"no such publish: {publish_id}")
return web.json_response(
{
}
)
return web.json_response({})


@routes.post("/{campaign}/{codebase}/publish", name="publish")
Expand Down Expand Up @@ -2389,7 +2386,7 @@ async def get_merge_proposal_run(
class ProposalInfo:
can_be_merged: Optional[bool]
status: str
revision: bytes
revision: Optional[bytes]
target_branch_url: Optional[str]
rate_limit_bucket: Optional[str] = None
codebase: Optional[str] = None
Expand Down Expand Up @@ -2519,7 +2516,7 @@ async def get_proposal_info(self, url) -> Optional[ProposalInfo]:
return None
return ProposalInfo(
rate_limit_bucket=row["rate_limit_bucket"],
revision=row["revision"].encode("utf-8") if row[1] else None,
revision=cast(bytes, row["revision"].encode("utf-8")) if row[1] else None,
status=row["status"],
target_branch_url=row["target_branch_url"],
can_be_merged=row["can_be_merged"],
Expand Down
2 changes: 1 addition & 1 deletion py/janitor/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def __init__(
name,
br.encode("utf-8") if br else None,
r.encode("utf-8") if r else None,
)
) # type: ignore
for (role, name, br, r) in result_branches
]
if result_tags is None:
Expand Down
21 changes: 12 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
from setuptools_rust import Binding, RustBin, RustExtension

setup(
rust_extensions=[
RustExtension('janitor._common', 'common-py/Cargo.toml', binding=Binding.PyO3),
RustExtension('janitor._publish', 'publish-py/Cargo.toml', binding=Binding.PyO3),
RustExtension('janitor._runner', 'runner-py/Cargo.toml', binding=Binding.PyO3),
RustExtension('janitor._site', 'site-py/Cargo.toml', binding=Binding.PyO3),
RustBin('janitor-mail-filter', 'mail-filter/Cargo.toml', features=['cmdline']),
RustBin('janitor-worker', 'worker/Cargo.toml', features=['cli', 'debian']),
RustBin('janitor-dist', 'worker/Cargo.toml', features=['cli', 'debian'])
])
rust_extensions=[
RustExtension("janitor._common", "common-py/Cargo.toml", binding=Binding.PyO3),
RustExtension(
"janitor._publish", "publish-py/Cargo.toml", binding=Binding.PyO3
),
RustExtension("janitor._runner", "runner-py/Cargo.toml", binding=Binding.PyO3),
RustExtension("janitor._site", "site-py/Cargo.toml", binding=Binding.PyO3),
RustBin("janitor-mail-filter", "mail-filter/Cargo.toml", features=["cmdline"]),
RustBin("janitor-worker", "worker/Cargo.toml", features=["cli", "debian"]),
RustBin("janitor-dist", "worker/Cargo.toml", features=["cli", "debian"]),
]
)

0 comments on commit 4b42ea5

Please sign in to comment.