Skip to content

Simplify Step 2 coin-prep: extract helpers, fix correctness bugs, add missing tests #130

Simplify Step 2 coin-prep: extract helpers, fix correctness bugs, add missing tests

Simplify Step 2 coin-prep: extract helpers, fix correctness bugs, add missing tests #130

Workflow file for this run

---
name: CI
"on":
pull_request:
push:
branches:
- main
jobs:
lint-type-test:
name: Lint, Type, Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-14]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.11"
# Node is required to install and run the explicit Prettier check in CI.
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Create venv and install dev dependencies
run: |
python -m venv .venv
echo "$GITHUB_WORKSPACE/.venv/bin" >> "$GITHUB_PATH"
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -e ".[dev]"
- name: Install formatting tools
run: |
npm install --global prettier@4.0.0-alpha.8
.venv/bin/python -m pip install yamllint==1.35.1
- name: Install Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
"$HOME/.cargo/bin/rustc" --version
"$HOME/.cargo/bin/cargo" --version
- name: Restore greenfloor-native wheel cache
id: cache-native-wheel
uses: actions/cache/restore@v4
with:
path: ./.cache/wheelhouse/greenfloor-native
key: native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('greenfloor-native/**') }}
- name: Build greenfloor-native wheel (cache miss)
if: steps.cache-native-wheel.outputs.cache-hit != 'true'
run: |
mkdir -p ./.cache/wheelhouse/greenfloor-native
.venv/bin/python -m pip install maturin
.venv/bin/python -m maturin build \
--manifest-path greenfloor-native/Cargo.toml \
--out ./.cache/wheelhouse/greenfloor-native
- name: Save greenfloor-native wheel cache
if: steps.cache-native-wheel.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ./.cache/wheelhouse/greenfloor-native
key: native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('greenfloor-native/**') }}
- name: Install greenfloor-native wheel
run: |
.venv/bin/python -m pip install ./.cache/wheelhouse/greenfloor-native/*.whl
- name: Ruff lint
run: ruff check .
- name: Ruff format check
run: ruff format --check .
- name: Prettier check
run: prettier --check "**/*.{md,json,yml,yaml}" --ignore-path .prettierignore
- name: Yamllint
run: yamllint .
- name: Pyright
run: pyright
- name: Pytest
run: pytest --ignore=tests/test_chia_wallet_sdk_simulator_harness.py
- name: Resolve chia-wallet-sdk pinned commit
if: matrix.os == 'ubuntu-latest'
id: sdk
run: |
echo "sha=$(git rev-parse HEAD:chia-wallet-sdk)" >> "$GITHUB_OUTPUT"
- name: Restore chia-wallet-sdk wheelhouse cache
if: matrix.os == 'ubuntu-latest'
id: cache-sdk-wheelhouse
uses: actions/cache/restore@v4
with:
path: ./.cache/wheelhouse/chia-wallet-sdk
key: sdk-wheelhouse-${{ runner.os }}-${{ runner.arch }}-${{ steps.sdk.outputs.sha }}
- name: Build chia-wallet-sdk wheel (cache miss)
if: matrix.os == 'ubuntu-latest' && steps.cache-sdk-wheelhouse.outputs.cache-hit != 'true'
run: |
mkdir -p ./.cache/wheelhouse/chia-wallet-sdk
.venv/bin/python -m pip wheel \
--wheel-dir ./.cache/wheelhouse/chia-wallet-sdk \
./chia-wallet-sdk/pyo3
- name: Save chia-wallet-sdk wheelhouse cache
if: matrix.os == 'ubuntu-latest' && steps.cache-sdk-wheelhouse.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ./.cache/wheelhouse/chia-wallet-sdk
key: sdk-wheelhouse-${{ runner.os }}-${{ runner.arch }}-${{ steps.sdk.outputs.sha }}
- name: Install chia-wallet-sdk for native integration tests
if: matrix.os == 'ubuntu-latest'
run: .venv/bin/python -m pip install ./.cache/wheelhouse/chia-wallet-sdk/*.whl
- name: Pytest (greenfloor-native integration on Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: GREENFLOOR_RUN_NATIVE_INTEGRATION_TESTS=1 pytest -vv -s tests/test_greenfloor_native_integration.py
- name: Pytest (chia-wallet-sdk simulator harness on Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: GREENFLOOR_RUN_SDK_SIM_TESTS_FULL=1 pytest -vv -s tests/test_chia_wallet_sdk_simulator_harness.py