Please the prettier

This commit is contained in:
Catalan Lover committed 2026-09-09 18:43:07 +02:00
1 parent b8941e05f7
commit b30347658f
5 files changed
+154 -65

No files matched your search

+97 -30
View File
@@ -32,7 +32,9 @@ env:
jobs:
build:
name: Build & Lint / Node ${{ matrix.node }} / ${{ matrix.variant }} / ${{ matrix.arch }}
name:
Build & Lint / Node ${{ matrix.node }} / ${{ matrix.variant }} / ${{
matrix.arch }}
runs-on: ${{ matrix.runner }}
continue-on-error: ${{ matrix.node == '26' }}
strategy:
@@ -47,23 +49,39 @@ jobs:
- arch: arm64
runner: ubuntu-24.04-arm
env:
CI_BOX_PROJECT: ci-in-a-box-node${{ matrix.node }}-${{ matrix.variant }}-${{ matrix.arch }}
CI_BOX_VARIANT_FILE: ci-in-a-box/compose.node${{ matrix.node }}-${{ matrix.variant }}.yaml
CI_BOX_PROJECT:
ci-in-a-box-node${{ matrix.node }}-${{ matrix.variant }}-${{ matrix.arch
}}
CI_BOX_VARIANT_FILE:
ci-in-a-box/compose.node${{ matrix.node }}-${{ matrix.variant }}.yaml
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Validate Compose configuration
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' config --quiet
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' config --quiet
- name: Build and lint
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile build-lint up --build draupnir-build-lint
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile build-lint up --build
draupnir-build-lint
- name: Collect diagnostics
if: failure()
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' ps && docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' logs --no-color
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' ps && docker compose -p
"$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE"
--profile '*' logs --no-color
- name: Cleanup
if: always()
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' down --volumes --remove-orphans
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' down --volumes --remove-orphans
unit:
name: Unit tests / Node ${{ matrix.node }} / ${{ matrix.variant }} / ${{ matrix.arch }}
name:
Unit tests / Node ${{ matrix.node }} / ${{ matrix.variant }} / ${{
matrix.arch }}
runs-on: ${{ matrix.runner }}
continue-on-error: ${{ matrix.node == '26' }}
strategy:
@@ -78,23 +96,38 @@ jobs:
- arch: arm64
runner: ubuntu-24.04-arm
env:
CI_BOX_PROJECT: ci-in-a-box-node${{ matrix.node }}-${{ matrix.variant }}-${{ matrix.arch }}
CI_BOX_VARIANT_FILE: ci-in-a-box/compose.node${{ matrix.node }}-${{ matrix.variant }}.yaml
CI_BOX_PROJECT:
ci-in-a-box-node${{ matrix.node }}-${{ matrix.variant }}-${{ matrix.arch
}}
CI_BOX_VARIANT_FILE:
ci-in-a-box/compose.node${{ matrix.node }}-${{ matrix.variant }}.yaml
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Validate Compose configuration
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' config --quiet
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' config --quiet
- name: Run unit tests
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile unit up --build draupnir-unit
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile unit up --build draupnir-unit
- name: Collect diagnostics
if: failure()
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' ps && docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' logs --no-color
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' ps && docker compose -p
"$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE"
--profile '*' logs --no-color
- name: Cleanup
if: always()
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' down --volumes --remove-orphans
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' down --volumes --remove-orphans
integration:
name: Ci Box Integration tests / Node ${{ matrix.node }} / ${{ matrix.variant }} / ${{ matrix.arch }}
name:
Ci Box Integration tests / Node ${{ matrix.node }} / ${{ matrix.variant }}
/ ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
continue-on-error: ${{ matrix.node == '26' }}
strategy:
@@ -109,8 +142,11 @@ jobs:
- arch: arm64
runner: ubuntu-24.04-arm
env:
CI_BOX_PROJECT: ci-in-a-box-node${{ matrix.node }}-${{ matrix.variant }}-${{ matrix.arch }}
CI_BOX_VARIANT_FILE: ci-in-a-box/compose.node${{ matrix.node }}-${{ matrix.variant }}.yaml
CI_BOX_PROJECT:
ci-in-a-box-node${{ matrix.node }}-${{ matrix.variant }}-${{ matrix.arch
}}
CI_BOX_VARIANT_FILE:
ci-in-a-box/compose.node${{ matrix.node }}-${{ matrix.variant }}.yaml
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Check out external antispam module
@@ -120,20 +156,35 @@ jobs:
path: synapse-http-antispam
ref: main
- name: Validate Compose configuration
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' config --quiet
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' config --quiet
- name: Start support stack
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" up -d
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" up -d
- name: Run integration tests
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile integration up --build draupnir-integration
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile integration up --build
draupnir-integration
- name: Collect diagnostics
if: failure()
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' ps && docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' logs --no-color
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' ps && docker compose -p
"$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE"
--profile '*' logs --no-color
- name: Cleanup
if: always()
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' down --volumes --remove-orphans
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' down --volumes --remove-orphans
appservice-integration:
name: Application Service Integration tests / Node ${{ matrix.node }} / ${{ matrix.variant }} / ${{ matrix.arch }}
name:
Application Service Integration tests / Node ${{ matrix.node }} / ${{
matrix.variant }} / ${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
continue-on-error: ${{ matrix.node == '26' }}
strategy:
@@ -148,8 +199,11 @@ jobs:
- arch: arm64
runner: ubuntu-24.04-arm
env:
CI_BOX_PROJECT: ci-in-a-box-node${{ matrix.node }}-${{ matrix.variant }}-${{ matrix.arch }}
CI_BOX_VARIANT_FILE: ci-in-a-box/compose.node${{ matrix.node }}-${{ matrix.variant }}.yaml
CI_BOX_PROJECT:
ci-in-a-box-node${{ matrix.node }}-${{ matrix.variant }}-${{ matrix.arch
}}
CI_BOX_VARIANT_FILE:
ci-in-a-box/compose.node${{ matrix.node }}-${{ matrix.variant }}.yaml
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Check out external antispam module
@@ -161,14 +215,27 @@ jobs:
# This is for the same reason why Ci is rerun periodically.
ref: main
- name: Validate Compose configuration
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' config --quiet
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' config --quiet
- name: Start support stack
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" up -d
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" up -d
- name: Run appservice integration tests
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile appservice-integration up --build draupnir-appservice-integration
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile appservice-integration up --build
draupnir-appservice-integration
- name: Collect diagnostics
if: failure()
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' ps && docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' logs --no-color
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' ps && docker compose -p
"$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE"
--profile '*' logs --no-color
- name: Cleanup
if: always()
run: docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f "$CI_BOX_VARIANT_FILE" --profile '*' down --volumes --remove-orphans
run:
docker compose -p "$CI_BOX_PROJECT" -f "$CI_BOX_COMPOSE_FILE" -f
"$CI_BOX_VARIANT_FILE" --profile '*' down --volumes --remove-orphans
+30 -12
View File
@@ -6,8 +6,10 @@ SPDX-License-Identifier: Apache-2.0
# Draupnir CI in a Box
This directory contains the so called CI in a Box. Aka Ci-Box. This provides the ability to run the same validation that the CI will run but locally
and do so without needing to worry about if your in a linux or windows based environment as long as you have the ability to run docker.
This directory contains the so called CI in a Box. Aka Ci-Box. This provides the
ability to run the same validation that the CI will run but locally and do so
without needing to worry about if your in a linux or windows based environment
as long as you have the ability to run docker.
Ci in a box provides the following capabilities:
@@ -16,13 +18,18 @@ Ci in a box provides the following capabilities:
- bot integration tests
- appservice integration tests
The local commands intentionally mirror the CI workflow so the same setup is easier to troubleshoot and less prone to the black-box problems we had with the previous CI.
The local commands intentionally mirror the CI workflow so the same setup is
easier to troubleshoot and less prone to the black-box problems we had with the
previous CI.
## Prerequisites
- Docker with Compose
- A local Draupnir checkout
- A local checkout of [`maunium/synapse-http-antispam`](https://github.com/maunium/synapse-http-antispam) for integration runs. (Synapse can potentially be a bit cranky even if AS doesnt need this. Thats why its a requirment for both.)
- A local checkout of
[`maunium/synapse-http-antispam`](https://github.com/maunium/synapse-http-antispam)
for integration runs. (Synapse can potentially be a bit cranky even if AS
doesnt need this. Thats why its a requirment for both.)
The local layout is expected to be:
@@ -43,7 +50,8 @@ parent/
cp .env.example .env
```
2. Review the contents of `.env` to see if your local checkouts are aligned correctly or if you need to use non defaults.
2. Review the contents of `.env` to see if your local checkouts are aligned
correctly or if you need to use non defaults.
3. Run the validation command you want to exercise, for example:
@@ -51,7 +59,8 @@ cp .env.example .env
docker compose -f compose.yaml -f compose.node24-slim.yaml --profile build-lint up --build draupnir-build-lint
```
If you need to inspect the resolved Compose configuration while debugging, you can still run:
If you need to inspect the resolved Compose configuration while debugging, you
can still run:
```bash
docker compose config
@@ -69,7 +78,8 @@ compose.node26-slim.yaml
compose.node26-alpine.yaml
```
Use the base Compose file together with one of the variant files when running a check:
Use the base Compose file together with one of the variant files when running a
check:
```bash
docker compose -f compose.yaml -f compose.node24-slim.yaml --profile build-lint up --build draupnir-build-lint
@@ -117,15 +127,23 @@ Use the variant file to switch between the Debian and Alpine validation paths:
docker compose -f compose.yaml -f compose.node24-alpine.yaml --profile unit up --build draupnir-unit
```
This keeps the glibc and musl validation paths in the same matrix, so you can compare the baseline Debian run against the Alpine target and diagnose distro-specific regressions. This layout avoids environment variables where possible, which makes it easier to work consistently across Windows and Linux hosts.
This keeps the glibc and musl validation paths in the same matrix, so you can
compare the baseline Debian run against the Alpine target and diagnose
distro-specific regressions. This layout avoids environment variables where
possible, which makes it easier to work consistently across Windows and Linux
hosts.
## CI parity
When changing this workflow, keep the local commands aligned with the GitHub Actions matrix. In practice, that means:
When changing this workflow, keep the local commands aligned with the GitHub
Actions matrix. In practice, that means:
1. Use the repo-local `ci-in-a-box/` files.
2. Check out the latest `maunium/synapse-http-antispam` revision for the integration job so compatibility regressions are caught early.
2. Check out the latest `maunium/synapse-http-antispam` revision for the
integration job so compatibility regressions are caught early.
3. Run the same Compose commands locally that the workflow runs in CI.
4. Keep the cleanup step consistent with `down --volumes` after failures or successful runs.
4. Keep the cleanup step consistent with `down --volumes` after failures or
successful runs.
This keeps the contributor workflow reproducible and makes CI failures easier to diagnose from the same commands.
This keeps the contributor workflow reproducible and makes CI failures easier to
diagnose from the same commands.
+11 -7
View File
@@ -32,7 +32,11 @@ services:
- synapse-data:/data
- ${SYNAPSE_HTTP_ANTISPAM_SOURCE:-../synapse-http-antispam/synapse_http_antispam.py}:/data/synapse_http_antispam.py:ro
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:8008/_matrix/client/versions >/dev/null"]
test:
[
"CMD-SHELL",
"curl -fsS http://localhost:8008/_matrix/client/versions >/dev/null",
]
interval: 5s
timeout: 5s
retries: 30
@@ -146,7 +150,8 @@ services:
- draupnir-config:/workspace/config
- ./scripts/appservice/draupnir-registration.yaml:/workspace/apps/draupnir/draupnir-registration.yaml:ro
- ${DRAUPNIR_CONTEXT:-../Draupnir}/apps/draupnir/src/appservice/config/config.harness.yaml:/workspace/apps/draupnir/src/appservice/config/config.harness.yaml:ro
command: ["npm", "run", "-w", "apps/draupnir", "test:appservice:integration"]
command:
["npm", "run", "-w", "apps/draupnir", "test:appservice:integration"]
profiles: [appservice-integration]
draupnir-config-init:
@@ -158,11 +163,10 @@ services:
- sh
- -lc
- >-
cp -a /source-config/. /config/;
sed -i
-e "s|http://localhost:8081|http://nginx:8081|g"
-e "s|127.0.0.1:8081|nginx:8081|g"
/config/harness.yaml /config/default.yaml
cp -a /source-config/. /config/; sed -i -e
"s|http://localhost:8081|http://nginx:8081|g" -e
"s|127.0.0.1:8081|nginx:8081|g" /config/harness.yaml
/config/default.yaml
restart: "no"
profiles: [integration, appservice-integration, development]
@@ -1,15 +1,15 @@
# SPDX-FileCopyrightText: 2026 Catalan Lover <catalanlover@protonmail.com>
#
# SPDX-License-Identifier: Apache-2.0
id: "draupnir-for-all"
as_token: "as_token"
hs_token: "hs_token"
url: "http://draupnir-appservice-integration:9000"
sender_localpart: draupnir-moderation
namespaces:
users:
- exclusive: true
regex: '@mjolnir_.*'
- exclusive: true
regex: '@draupnir_.*'
rate_limited: false
id: "draupnir-for-all"
as_token: "as_token"
hs_token: "hs_token"
url: "http://draupnir-appservice-integration:9000"
sender_localpart: draupnir-moderation
namespaces:
users:
- exclusive: true
regex: "@mjolnir_.*"
- exclusive: true
regex: "@draupnir_.*"
rate_limited: false
@@ -6,10 +6,10 @@ pid_file: /data/homeserver.pid
listeners:
- port: 8008
resources:
- compress: false
names:
- client
- federation
- compress: false
names:
- client
- federation
tls: false
type: http
x_forwarded: true