Skip to content

Commit 2478eef

Browse files
committed
ci: keep the real-engine JVM tests out of the sandbox job
The P12 JVM tests on a real engine take the docker suite to about 20 minutes, over the 15-minute cap on the sandbox job. They carry a docker_jvm marker, which the job deselects; a local pytest -m docker still runs them.
1 parent e6a56bc commit 2478eef

6 files changed

Lines changed: 28 additions & 9 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,9 @@ jobs:
337337

338338
# A real engine, for what no fake can show: compose's behavior, the network that has no way out and
339339
# the leftovers a killed owner leaves. One job, no matrix and no schedule, on a free account's
340-
# minutes: it takes a few minutes and runs only when the sandbox can have changed. It is also the
341-
# only Linux evidence: file ownership, the firewall and the bridge address differ from Docker
340+
# minutes: it takes a few minutes and runs only when the sandbox can have changed. The real-engine
341+
# JVM tests (marked docker_jvm, about ten minutes under load) stay a local gate to keep it under
342+
# 15 minutes. It is also the only Linux evidence: file ownership, the firewall and the bridge address differ from Docker
342343
# Desktop's. Images come from the registry here: the mock server's and the fixture's Redis before
343344
# the tests that pull nothing, and the others through `cstudy start`. Installs are small and go through a volume on
344345
# the engine, so nothing is worth caching. Nothing waits for this job.
@@ -377,4 +378,4 @@ jobs:
377378
run: docker pull "$(uv run python -c 'from tests.adapters.test_service_steps_real import REDIS; print(REDIS["image"])')"
378379

379380
- name: Sandbox tests
380-
run: uv run pytest -q -rs -m docker
381+
run: uv run pytest -q -rs -m "docker and not docker_jvm"

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Run the CLI checks from `cli/`; its tool settings live there (`ruff.toml`, `pyri
4646
| JVM tests | `uv run pytest -q -m jvm` (the `slow` tests that drive Gradle, javac, kotlinc or a JVM runner on the JDK your shell selects) |
4747
| All tests | `uv run pytest -q` (the `slow` tests drive real Gradle, Node, tsc and a workspace venv in a temporary workspace) |
4848

49-
CI runs on Linux for every push to a branch and every pull request ([versioning](docs/specs/versioning.md#what-the-workflow-does)). The fast checks are the first six rows, plus `cstudy verify --static`. The JVM job runs the JVM tests and `cstudy verify --conformance` for `--lang java` and for `--lang kotlin`, on JDK 21 and on JDK 26, the two ends of the supported range. Two more jobs run only when the `changes` job finds that the diff can affect them: the browser tests on Chromium, and the `sandbox` job, `pytest -m docker` on a real Docker engine. The other `slow` tests, and `cstudy verify` of a catalog service project over real stacks, stay a local gate. A test belongs to the JVM job when it carries the `jvm` marker, together with `slow`: mark a new test that drives the JVM the same way, and a row of a test over every language with `jvm_marked` from `cli/tests/toolchains.py`.
49+
CI runs on Linux for every push to a branch and every pull request ([versioning](docs/specs/versioning.md#what-the-workflow-does)). The fast checks are the first six rows, plus `cstudy verify --static`. The JVM job runs the JVM tests and `cstudy verify --conformance` for `--lang java` and for `--lang kotlin`, on JDK 21 and on JDK 26, the two ends of the supported range. Two more jobs run only when the `changes` job finds that the diff can affect them: the browser tests on Chromium, and the `sandbox` job, `pytest -m "docker and not docker_jvm"` on a real Docker engine. The real-engine JVM tests carry the `docker_jvm` marker, together with `docker`, and stay a local gate so that the job fits its 15 minutes: `uv run pytest -q -m docker` is the full local run and includes them (about 20 minutes under load), and a new test that builds a JVM project on a real engine takes the marker too. The other `slow` tests, and `cstudy verify` of a catalog service project over real stacks, stay a local gate. A test belongs to the JVM job when it carries the `jvm` marker, together with `slow`: mark a new test that drives the JVM the same way, and a row of a test over every language with `jvm_marked` from `cli/tests/toolchains.py`.
5050

5151
Changes to content, runners or code generation also need `cstudy verify` (with `CSTUDY_WORKSPACE` set):
5252

‎cli/tests/conftest.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ def pytest_configure(config: pytest.Config) -> None:
2323
config.addinivalue_line(
2424
"markers",
2525
"docker: drives a real Docker engine, and is also slow; CI runs these in a job of its own "
26-
"(-m docker)",
26+
"(-m 'docker and not docker_jvm')",
27+
)
28+
config.addinivalue_line(
29+
"markers",
30+
"docker_jvm: a docker test that builds a JVM project on a real engine, about ten minutes "
31+
"under load; also marked docker, and run locally only: CI deselects it to keep its sandbox "
32+
"job under 15 minutes",
2733
)
2834

2935

‎cli/tests/test_ci_workflow.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,12 @@ def test_the_sandbox_job_runs_only_when_the_sandbox_changed(sandbox: Job):
147147
)
148148

149149

150-
def test_the_sandbox_job_runs_every_test_marked_docker_and_says_why_one_skipped(sandbox: Job):
151-
assert any("pytest -q -rs -m docker" in command for command in _commands(sandbox))
150+
def test_the_sandbox_job_runs_every_test_marked_docker_but_the_jvm_ones_and_says_why_one_skipped(
151+
sandbox: Job,
152+
):
153+
assert any(
154+
'pytest -q -rs -m "docker and not docker_jvm"' in command for command in _commands(sandbox)
155+
)
152156

153157

154158
def test_the_sandbox_job_pulls_the_image_the_tests_will_not(sandbox: Job):

‎cli/tests/test_service_projects_real.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,14 @@ def require_engine() -> None:
5353
pytest.skip("no docker on PATH")
5454

5555

56-
@pytest.fixture(params=[TYPESCRIPT, PYTHON, JAVA], ids=["typescript", "python", "java"])
56+
@pytest.fixture(
57+
params=[
58+
TYPESCRIPT,
59+
PYTHON,
60+
pytest.param(JAVA, marks=pytest.mark.docker_jvm),
61+
],
62+
ids=["typescript", "python", "java"],
63+
)
5764
def project(request: pytest.FixtureRequest, tmp_path: Path) -> Generator[FixtureProject]:
5865
found = fixture_project(request.param, tmp_path)
5966
try:
@@ -214,6 +221,7 @@ def java(tmp_path: Path) -> Generator[FixtureProject]:
214221
found.remove_all_it_left()
215222

216223

224+
@pytest.mark.docker_jvm
217225
def test_a_jvm_project_builds_from_its_install_cache_with_no_volume_of_the_images_own(
218226
java: FixtureProject,
219227
):

‎docs/specs/versioning.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ It uses `GITHUB_TOKEN`; the bot commit and tag do not start further workflow run
3636

3737
`cstudy --version` prints the installed version, read from package metadata. The first run on a repository without tags tags the current version, `v0.1.0`, without changing it.
3838

39-
`.github/workflows/ci.yml` is separate: on every push to a branch and every pull request, it runs on `ubuntu-latest`. The fast [checks](../../CONTRIBUTING.md#checks) job runs lint, format, types, layer contracts, `pytest -m "not slow"`, and `cstudy verify --static` against a workspace it creates. The JVM job runs on JDK 21 and on JDK 26, the two ends of the [supported range](../decisions/0016-jdk-range.md#the-supported-range) (Temurin builds, one run per JDK): `pytest -m jvm`, which is the slow tests that drive Gradle, javac, kotlinc or a JVM runner, and then `cstudy verify --conformance --lang java` and `--lang kotlin` in a workspace it creates and sets up with `cstudy doctor --fix`. Two more jobs run only when a job named `changes` finds that the run's diff can affect them, so a change of problems or docs alone runs neither: the browser job, on Chromium, for the web UI's page, and the `sandbox` job, `pytest -m docker` on a real Docker engine, for the code a [service project's](service-projects.md#resources-and-ci) stack runs on, within 15 minutes, with no matrix and no schedule. `cstudy verify` of a catalog service project over real stacks stays a local gate, and so do the other slow tests (Node, Go, Cargo, the debuggers). Every job only reads the repository, holds no secret and publishes nothing. The workflow does not gate `version.yml`, and the release commit's `[skip ci]` skips it.
39+
`.github/workflows/ci.yml` is separate: on every push to a branch and every pull request, it runs on `ubuntu-latest`. The fast [checks](../../CONTRIBUTING.md#checks) job runs lint, format, types, layer contracts, `pytest -m "not slow"`, and `cstudy verify --static` against a workspace it creates. The JVM job runs on JDK 21 and on JDK 26, the two ends of the [supported range](../decisions/0016-jdk-range.md#the-supported-range) (Temurin builds, one run per JDK): `pytest -m jvm`, which is the slow tests that drive Gradle, javac, kotlinc or a JVM runner, and then `cstudy verify --conformance --lang java` and `--lang kotlin` in a workspace it creates and sets up with `cstudy doctor --fix`. Two more jobs run only when a job named `changes` finds that the run's diff can affect them, so a change of problems or docs alone runs neither: the browser job, on Chromium, for the web UI's page, and the `sandbox` job, `pytest -m "docker and not docker_jvm"` on a real Docker engine (the real-engine JVM tests, marked `docker_jvm`, stay a local gate to keep the job within its limit), for the code a [service project's](service-projects.md#resources-and-ci) stack runs on, within 15 minutes, with no matrix and no schedule. `cstudy verify` of a catalog service project over real stacks stays a local gate, and so do the other slow tests (Node, Go, Cargo, the debuggers). Every job only reads the repository, holds no secret and publishes nothing. The workflow does not gate `version.yml`, and the release commit's `[skip ci]` skips it.
4040

4141
## GitHub release
4242

0 commit comments

Comments
 (0)