Skip to content

0.137.0: schema-dist serial 139; carry_of, the map-space profile's fr… #339

0.137.0: schema-dist serial 139; carry_of, the map-space profile's fr…

0.137.0: schema-dist serial 139; carry_of, the map-space profile's fr… #339

Workflow file for this run

name: ci
on:
push:
branches: [main]
pull_request:
jobs:
commits:
# A commit message is published text too: the commits this push or pull request adds name no one
# inside the team and point at no internal room or tracker, like the tree.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- run: python3 scripts/public_words.py --commits "$RANGE"
env:
RANGE: ${{ github.event_name == 'pull_request' && format('{0}..{1}', github.event.pull_request.base.sha, github.event.pull_request.head.sha) || (github.event.before && !startsWith(github.event.before, '0000000') && format('{0}..{1}', github.event.before, github.sha)) || github.sha }}
gates:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
# 3.12 is the oldest Python pyproject.toml admits; each newer minor is tested too.
python: ['3.12', '3.13', '3.14']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python }}
- run: uv sync --locked
- run: uv run python --version
- run: uv run pytest -q
- run: uv run ruff check .
- run: uv run ruff format --check .
- run: uv run mypy --strict src tests
- run: uv run python codegen/generate_schema.py --check
- run: uv run python codegen/generate_tools.py --check
- run: uv run python codegen/generate_anchors.py --check
- run: uv run python codegen/generate_directions.py --check
# Published text names no one inside the team and points at no internal room or tracker.
- run: uv run python scripts/public_words.py
okf-reference:
# OKF's own parser and viewer, at the commit onlyworlds.okf pins, read this package's export.
# tests/test_okf.py skips that check when OKF's code is not importable, so the gates above
# never run it. Here the code is fetched at the pinned commit and a skip is a failure.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
- run: uv sync --locked
- name: OKF's reference code at the pinned commit
run: |
REPO=$(uv run python -c "from onlyworlds import okf; print(okf.OKF_REPO)")
COMMIT=$(uv run python -c "from onlyworlds import okf; print(okf.OKF_COMMIT)")
echo "$REPO at $COMMIT"
git init -q "$RUNNER_TEMP/okf"
git -C "$RUNNER_TEMP/okf" fetch -q --depth 1 "$REPO" "$COMMIT"
git -C "$RUNNER_TEMP/okf" checkout -q FETCH_HEAD
test "$(git -C "$RUNNER_TEMP/okf" rev-parse HEAD)" = "$COMMIT"
- name: The reference check, where a skip fails
env:
OKF_REFERENCE_SRC: ${{ runner.temp }}/okf/src
run: |
uv run pytest -q -rs tests/test_okf.py::test_reference_parser_and_viewer | tee "$RUNNER_TEMP/okf.txt"
grep -q -E '^1 passed' "$RUNNER_TEMP/okf.txt"
folder-conformance:
# The folder format's conformance fixture lives in Atlas, the reference implementation.
# tests/test_reader.py skips its conformance group unless it is handed a copy, so the gates
# above never run it. Here the fixture is read from Atlas's default branch as it stands and a
# skip is a failure. When Atlas moves the fixture, this job goes red on the version the test
# names, until the reader has been read against what moved.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
- run: uv sync --locked
- name: Atlas's conformance fixture, as its default branch has it
run: |
git clone -q --depth 1 --filter=blob:none --sparse https://github.com/OnlyWorlds/atlas "$RUNNER_TEMP/atlas"
git -C "$RUNNER_TEMP/atlas" sparse-checkout set tests/fixtures/folder-conformance
git -C "$RUNNER_TEMP/atlas" log -1 --format='atlas %h %ad' --date=short
test -f "$RUNNER_TEMP/atlas/tests/fixtures/folder-conformance/expected.json"
- name: The reader's tests with the fixture, where a skip fails
env:
OW_CONFORMANCE_FIXTURE: ${{ runner.temp }}/atlas/tests/fixtures/folder-conformance
run: |
uv run pytest -q -rs tests/test_reader.py | tee "$RUNNER_TEMP/reader.txt"
grep -q -E '^[0-9]+ passed in ' "$RUNNER_TEMP/reader.txt"
wheel:
# The gates job runs the suite on the source tree, installed editable; PyPI gets the wheel. A file the
# build leaves out (hatchling skips what .gitignore names, and anything outside the package path) passes
# there and fails for every user, on a version PyPI keeps forever. Here the suite runs against the wheel
# itself: the locked dev environment without the project, and the built wheel installed in its place.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
with:
python-version: '3.12'
- run: uv build --wheel
- name: The wheel holds every tracked file of the package, and nothing else
run: |
python3 - <<'PY'
import glob, subprocess, sys, zipfile
(wheel,) = glob.glob("dist/*.whl")
inside = {n for n in zipfile.ZipFile(wheel).namelist() if n.startswith("onlyworlds/")}
listed = subprocess.run(["git", "ls-files", "-z", "src/onlyworlds"], capture_output=True, text=True, check=True).stdout
tracked = {p[len("src/"):] for p in listed.split("\0") if p}
missing, extra = sorted(tracked - inside), sorted(inside - tracked)
if not tracked or missing or extra:
print(f"tracked {len(tracked)}, in the wheel {len(inside)}; left out: {missing}; not tracked: {extra}")
sys.exit(1)
print(f"the wheel holds the package's {len(tracked)} tracked files, and nothing else")
PY
- run: uv sync --locked --no-install-project
- run: uv pip install --no-deps dist/*.whl
- name: The suite imports the installed wheel, not the source tree
run: uv run --no-sync python -I -c "import onlyworlds; f = onlyworlds.__file__; assert '/site-packages/' in f, f; print(f)"
- run: uv run --no-sync pytest -q
wire:
# keel's own OpenAPI document and the public demo world, read only, and a few writes to the
# practice world (its published key, reset every night), each deleted again. Red here with
# the gates above green means the server moved under the client, not that a change broke it.
runs-on: ubuntu-latest
env:
OW_OPENAPI: https://www.onlyworlds.com/api/v2/openapi.json
OW_LIVE: "1"
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
- run: uv sync --locked
- run: uv run pytest -q tests/test_wire.py tests/test_live.py tests/test_live_practice.py