Port daemon and offers lifecycle to native Rust engine (#96) #394
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": | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| PYTHON_VERSION: "3.11" | |
| jobs: | |
| lint-type-test: | |
| name: Lint, Type, Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| run_rust_tests: true | |
| run_sdk_integration: true | |
| - os: ubuntu-24.04-arm | |
| run_rust_tests: false | |
| run_sdk_integration: false | |
| - os: macos-14 | |
| run_rust_tests: false | |
| run_sdk_integration: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| # Node is required to install and run the explicit Prettier check in CI. | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "lts/*" | |
| - name: Restore Python venv cache | |
| id: cache-venv | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: .venv | |
| key: venv-v2-${{ runner.os }}-${{ runner.arch }}-py311-${{ hashFiles('pyproject.toml') }} | |
| - name: Create venv and install dev dependencies | |
| run: | | |
| if [ ! -d .venv/bin ]; then | |
| python -m venv .venv | |
| fi | |
| # GITHUB_PATH only affects later steps; export PATH is required here. | |
| export PATH="$GITHUB_WORKSPACE/.venv/bin:$PATH" | |
| echo "$GITHUB_WORKSPACE/.venv/bin" >> "$GITHUB_PATH" | |
| python -m pip install --upgrade pip | |
| python -m pip install -e ".[dev]" | |
| - name: Save Python venv cache | |
| if: steps.cache-venv.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: .venv | |
| key: venv-v2-${{ runner.os }}-${{ runner.arch }}-py311-${{ hashFiles('pyproject.toml') }} | |
| - uses: ./.github/actions/rust-cache-greenfloor | |
| if: matrix.run_rust_tests | |
| - name: Build and test greenfloor-engine | |
| if: matrix.run_rust_tests | |
| run: | | |
| cargo build --manifest-path greenfloor-engine/Cargo.toml --bin greenfloor-engine | |
| cargo test --manifest-path greenfloor-engine/Cargo.toml | |
| - name: Install greenfloor-engine CLI on PATH | |
| if: matrix.run_rust_tests | |
| run: | | |
| install -m 755 \ | |
| target/debug/greenfloor-engine \ | |
| "$GITHUB_WORKSPACE/.venv/bin/greenfloor-engine" | |
| - uses: ./.github/actions/greenfloor-maturin-wheels | |
| with: | |
| operation: ensure-and-install | |
| rust-already-configured: ${{ matrix.run_rust_tests }} | |
| - name: Cache pre-commit environment | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./.cache/pre-commit | |
| key: pre-commit-${{ runner.os }}-${{ runner.arch }}-py311-${{ hashFiles('.pre-commit-config.yaml') }} | |
| restore-keys: | | |
| pre-commit-${{ runner.os }}-${{ runner.arch }}-py311- | |
| - name: "Lint + Type-check (pre-commit)" | |
| env: | |
| PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit | |
| SKIP: pytest | |
| run: pre-commit run --all-files | |
| - name: "Test suite (pytest)" | |
| run: pytest -v --tb=short -m "not engine" | |
| - name: Pytest (engine marker) | |
| if: matrix.run_rust_tests | |
| run: pytest -v --tb=short -m engine | |
| - uses: ./.github/actions/wheel-cache | |
| if: matrix.run_sdk_integration | |
| with: | |
| operation: ensure-and-install | |
| builder: pip | |
| tree-path: chia-wallet-sdk | |
| source-path: ./chia-wallet-sdk/pyo3 | |
| cache-key-prefix: sdk-wheelhouse | |
| wheelhouse-subdir: chia-wallet-sdk | |
| rust-already-configured: ${{ matrix.run_rust_tests }} | |
| - name: Pytest (greenfloor_engine + chia-wallet-sdk offer round-trip on Ubuntu) | |
| if: matrix.run_sdk_integration | |
| run: GREENFLOOR_RUN_ENGINE_INTEGRATION_TESTS=1 pytest -vv -s tests/test_greenfloor_engine_integration.py |