Run pytest from RUNNER_TEMP so installed wheel is resolved #4
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
| # Fast CI for the Python SDK: builds + runs pytest on a single host | |
| # triple per OS on every push/PR. The full cross-build matrix only | |
| # runs on tag push (see publish-python.yml). | |
| name: ci-python | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'crates/reflow_rt/**' | |
| - 'crates/reflow_components/**' | |
| - 'crates/reflow_network/**' | |
| - 'crates/reflow_graph/**' | |
| - 'crates/reflow_actor/**' | |
| - 'crates/reflow_actor_macro/**' | |
| - 'sdk/python/**' | |
| - '.github/workflows/ci-python.yml' | |
| pull_request: | |
| paths: | |
| - 'sdk/python/**' | |
| - '.github/workflows/ci-python.yml' | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-14] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - uses: dtolnay/rust-toolchain@stable | |
| # The macos-14 runner image presets RUSTC_WRAPPER=sccache but | |
| # doesn't always put sccache on the PATH. Install it so the | |
| # wrapper works; on linux the action is a cheap no-op install. | |
| - uses: mozilla-actions/sccache-action@v0.0.5 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: | | |
| . | |
| sdk/python | |
| - name: Install build tools | |
| run: python -m pip install --upgrade pip maturin pytest | |
| - name: Build wheel | |
| working-directory: sdk/python | |
| run: maturin build --release --out dist --find-interpreter | |
| - name: Install wheel | |
| shell: bash | |
| run: | | |
| # Install whatever wheel was produced for the active interpreter. | |
| python -m pip install --force-reinstall sdk/python/dist/*.whl | |
| - name: Run tests | |
| shell: bash | |
| # Run from a tmpdir so the source `sdk/python/offbit_reflow` | |
| # directory isn't picked up by pytest's sys.path insertion — | |
| # we want imports to resolve to the wheel installed above. | |
| run: | | |
| cd "$RUNNER_TEMP" | |
| python -m pytest -q "$GITHUB_WORKSPACE/sdk/python/tests" |