feat(runtime): lazy-install matching ABI runtime tree for cross-Python roar run #431
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| # Fire on PRs against any base branch — including stacked feature | |
| # branches (cg/foo → cg/bar) — so each PR in a stack runs CI against | |
| # its own base. Without this, only PRs whose base is `main` get CI | |
| # and stacked PRs land blind. | |
| pull_request: | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ruff mypy | |
| - name: Run ruff linting | |
| run: ruff check . | |
| - name: Run ruff format check | |
| run: ruff format --check . | |
| typecheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install maturin | |
| pip install -e .[dev] | |
| - name: Run mypy | |
| run: mypy roar | |
| build-rust-binaries: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Rust (stable) | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Set up Rust (nightly with rust-src) | |
| run: | | |
| rustup install nightly | |
| rustup component add rust-src --toolchain nightly | |
| - name: Install bpf-linker | |
| run: cargo install bpf-linker | |
| - name: Build and stage Rust binaries | |
| uses: ./.github/actions/build-rust-binaries | |
| with: | |
| manifest-path: rust/Cargo.toml | |
| output-dir: rust-bin | |
| - name: Upload Rust binaries artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: roar-rust-binaries-linux-x86_64 | |
| path: rust-bin/* | |
| build-rust-binaries-macos: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: macos-latest | |
| arch: arm64 | |
| - runner: macos-15-intel | |
| arch: x86_64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Rust (stable) | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build and stage Rust binaries | |
| uses: ./.github/actions/build-rust-binaries-macos | |
| with: | |
| manifest-path: rust/Cargo.toml | |
| output-dir: rust-bin | |
| - name: Upload Rust binaries artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: roar-rust-binaries-macos-${{ matrix.arch }} | |
| path: rust-bin/* | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: [build-rust-binaries] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Download Rust binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: roar-rust-binaries-linux-x86_64 | |
| path: rust/target/release/ | |
| - name: Make tracer and proxy executables runnable | |
| run: | | |
| chmod +x \ | |
| rust/target/release/roar-tracer \ | |
| rust/target/release/roar-proxy \ | |
| rust/target/release/roar-tracer-ebpf \ | |
| rust/target/release/roard \ | |
| rust/target/release/roar-tracer-preload | |
| - name: Check ptrace availability | |
| run: | | |
| echo "Testing if ptrace is available on this runner..." | |
| TRACER=rust/target/release/roar-tracer | |
| TEST_LOG=/tmp/ptrace_test.json | |
| if $TRACER $TEST_LOG echo "ptrace test" 2>&1; then | |
| if [ -f "$TEST_LOG" ] && [ -s "$TEST_LOG" ]; then | |
| echo "ptrace is available." | |
| cat $TEST_LOG | |
| else | |
| echo "ptrace may be restricted; tracer produced no output." | |
| fi | |
| else | |
| echo "ptrace appears to be disabled on this runner." | |
| fi | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install maturin | |
| pip install -e .[dev] | |
| - name: Build native hash extension | |
| run: ./scripts/build_hash_native.sh | |
| - name: Verify native hash extension import | |
| run: python -c "import roar._hash_native as m; print(m.__name__)" | |
| - name: Run tests (parallel) | |
| run: > | |
| pytest --tb=short -x -m "not glaas and not live_glaas" | |
| --ignore=tests/backends/osmo | |
| --ignore-glob=tests/backends/test_osmo*.py | |
| --ignore=tests/execution/runtime/test_sitecustomize_perf.py | |
| - name: Run runtime perf guards (serial) | |
| if: matrix.python-version == '3.12' | |
| run: pytest --tb=short -x tests/execution/runtime/test_sitecustomize_perf.py -n 0 | |
| test-macos: | |
| needs: [build-rust-binaries-macos] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: macos-latest | |
| arch: arm64 | |
| - runner: macos-15-intel | |
| arch: x86_64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Set up Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Download Rust binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: roar-rust-binaries-macos-${{ matrix.arch }} | |
| path: rust/target/release/ | |
| - name: Make binaries executable | |
| run: | | |
| chmod +x \ | |
| rust/target/release/roar-proxy \ | |
| rust/target/release/roar-tracer-preload | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install maturin | |
| pip install -e .[dev] | |
| - name: Build native hash extension | |
| run: ./scripts/build_hash_native.sh | |
| - name: Verify native hash extension import | |
| run: python -c "import roar._hash_native as m; print(m.__name__)" | |
| - name: Smoke test preload tracer with Python file I/O | |
| run: | | |
| tmp_dir="$(mktemp -d)" | |
| cd "$tmp_dir" | |
| git init | |
| git config user.email "ci@example.com" | |
| git config user.name "CI" | |
| printf ".roar/\n" > .gitignore | |
| git add .gitignore | |
| git commit -m "init" | |
| python -m roar init -y | |
| cat > smoke.py <<'PY' | |
| from pathlib import Path | |
| Path("smoke.txt").write_text("ok") | |
| _ = Path("smoke.txt").read_text() | |
| PY | |
| git add smoke.py | |
| git commit -m "add smoke script" | |
| python -m roar run "$(python -c 'import sys; print(sys.executable)')" smoke.py | |
| - name: Run tests (parallel) | |
| run: > | |
| pytest --tb=short -x -m "not glaas and not live_glaas and not ebpf and not large_pipeline" | |
| --ignore=tests/backends/osmo | |
| --ignore-glob=tests/backends/test_osmo*.py | |
| --ignore=tests/execution/runtime/test_sitecustomize_perf.py | |
| test-tracer-privileged: | |
| runs-on: ubuntu-latest | |
| needs: [build-rust-binaries] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Download Rust binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: roar-rust-binaries-linux-x86_64 | |
| path: rust/target/release/ | |
| - id: preflight | |
| name: Preflight privileged tracer requirements | |
| run: | | |
| if [ "$(id -u)" -eq 0 ]; then | |
| echo "ready=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "ready=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Install dependencies | |
| if: steps.preflight.outputs.ready == 'true' | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install maturin | |
| pip install -e .[dev] | |
| - name: Run eBPF test lane | |
| if: steps.preflight.outputs.ready == 'true' | |
| run: pytest -m ebpf --tb=short | |
| - name: Skip privileged lane | |
| if: steps.preflight.outputs.ready != 'true' | |
| run: | | |
| echo "Skipping privileged tracer tests: root privileges are required." |