-
Notifications
You must be signed in to change notification settings - Fork 0
193 lines (185 loc) · 7.35 KB
/
Copy pathci.yml
File metadata and controls
193 lines (185 loc) · 7.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: CI
on:
push:
branches: [main, master, "001-*", "002-*", "003-*"]
pull_request:
branches: [main, master]
jobs:
python-unit:
name: Python unit + replay tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dev deps
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio pytest-benchmark ruff
- name: Lint (ruff)
# Strict on the framework + tests, informational on tooling
# scripts (which mix old codegen scaffolding and ad-hoc
# helpers).
run: |
ruff check python/minecraft_bot tests
ruff check tools || true
- name: Run unit + replay tests
run: |
PYTHONPATH=python pytest -q --no-header tests/python/unit tests/python/replay
- name: Performance benchmarks (skipped on this matrix; thresholds enforced)
run: |
PYTHONPATH=python pytest -q --no-header --benchmark-only tests/python/perf
- name: Cross-language byte parity (Python primitives)
run: |
PYTHONPATH=python python tools/cross_check.py --python-only
rust-build:
name: Rust build + format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: cargo fmt --check
working-directory: rust
run: cargo fmt -- --check
- name: cargo clippy
working-directory: rust
# The 176 auto-generated packet modules trip a few hundred
# missing_docs / identity_op warnings on intermediate types
# that the generator inserts as scaffolding. Treat clippy as
# informational here; the build step below is the hard gate.
run: cargo clippy --all-targets --no-deps || true
- name: cargo build
working-directory: rust
run: cargo build --verbose
# T072 — accel-backend parity gate: rebuild the PyO3 façade and run
# the parity test suite. Both this job AND the python-unit job above
# must pass for a PR to merge.
accel-parity:
name: Accel backend parity (Linux x86_64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: dtolnay/rust-toolchain@stable
- name: Install maturin + pytest
run: |
python -m pip install --upgrade pip
pip install maturin pytest pytest-asyncio pytest-benchmark
- name: Install python reference (editable)
run: pip install -e python/
- name: Build minecraft_bot_accel wheel
# `maturin develop` needs an active virtualenv; CI runs in
# the system Python, so build a wheel and pip-install it.
run: |
maturin build --release --strip --manifest-path python-ext/Cargo.toml --interpreter python3.11
- name: Install minecraft_bot_accel wheel
run: |
# Cargo workspace puts target/ at the repo root.
pip install target/wheels/*.whl
- name: Run parity tests (non-live)
run: pytest -q -m "not live" tests/python/parity
- name: Run heavy-op perf benchmark
run: pytest -q -s tests/python/perf/test_speedup_codecs.py::test_chunk_decode_speedup
- name: Run accel rust tests
working-directory: rust
run: cargo test --no-fail-fast
# T074 — cross-check all encoders. Required on any PR touching
# codec / packet / framer code.
cross-check-all:
name: Cross-check 3-way (Python ↔ Rust ↔ accel)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: dtolnay/rust-toolchain@stable
- run: |
python -m pip install --upgrade pip
pip install maturin pytest
pip install -e python/
- name: Build accel wheel
run: |
maturin build --release --strip --manifest-path python-ext/Cargo.toml --interpreter python3.11
pip install target/wheels/*.whl
- name: Build rust encode_one example
working-directory: rust
run: cargo build --release --example encode_one
- name: Three-way cross-check
# T095 — compress output to a single summary line for PR readability.
run: |
python tools/cross_check.py --accel | tee /tmp/cross-check.log
# The script exits non-zero if any encoder mismatches. The
# tee preserves the full output as a CI artefact while the
# summary line below shows in PR conversation.
tail -3 /tmp/cross-check.log
# T081 + T086 — perf-gate: heavy-op speedup gate. Hard-fails on a
# > 10% regression from the chunk_decode 2× target.
perf-gate:
name: Performance gate
runs-on: ubuntu-latest
needs: accel-parity
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: dtolnay/rust-toolchain@stable
- run: |
python -m pip install --upgrade pip
pip install maturin pytest pytest-benchmark pytest-asyncio
pip install -e python/
maturin build --release --strip --manifest-path python-ext/Cargo.toml --interpreter python3.11
pip install target/wheels/*.whl
- name: Perf — heavy ops (informational + gated)
run: pytest -q -s tests/python/perf -m "not live"
# T073 — live-parity gate on a labelled PR. Disabled until a
# self-hosted runner with Paper 1.20.1 is reachable.
live-parity:
name: Live parity (Paper 1.20.1)
runs-on: [self-hosted, paper-1.20.1]
if: ${{ contains(github.event.pull_request.labels.*.name, 'live-tests') }}
needs: [accel-parity, cross-check-all]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: dtolnay/rust-toolchain@stable
- run: |
python -m pip install --upgrade pip
pip install maturin pytest pytest-asyncio
pip install -e python/
maturin build --release --strip --manifest-path python-ext/Cargo.toml --interpreter python3.11
pip install target/wheels/*.whl
- name: pytest --backend accel -m live
run: pytest -q -m live tests/python/parity
# Live-server tests run only on a self-hosted runner that has the
# configured Paper 1.20.1 server reachable. Skipped on hosted runners
# since they can't reach the test environment.
live-smoke:
name: Live integration tests
runs-on: [self-hosted, paper-1.20.1]
if: ${{ false }} # enable on a self-hosted runner with the test server
needs: python-unit
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: |
python -m pip install pytest pytest-asyncio pytest-benchmark
PYTHONPATH=python pytest -m live --no-header tests/python/integration
- name: Slow live tests (uptime smoke)
run: |
PYTHONPATH=python pytest -m "live and slow" --no-header tests/python/integration