V0.6.2 #228
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: Python (jacs) | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| workflow_dispatch: # Allows manual triggering | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # Job to run tests on every push/PR (jacspy = local dir name; package on PyPI is jacs) | |
| test-jacs: | |
| name: Test jacs (x86_64) | |
| runs-on: ubuntu-latest # Docker is available on ubuntu-latest runners (x86_64) | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image for testing (x86_64) | |
| working-directory: jacspy # Directory containing DockerfileBuilder | |
| run: docker buildx build --tag "jacs-build-x86_64" -f DockerfileBuilder . --load # --load makes image available | |
| - name: Run jacs tests in Docker (x86_64) | |
| working-directory: jacspy # To match PWD context if needed by scripts | |
| env: | |
| RUST_BACKTRACE: "1" | |
| run: | | |
| docker run --rm \ | |
| -v "$(pwd)/..:/workspace" \ | |
| jacs-build-x86_64 \ | |
| bash -c "\ | |
| cd /workspace/jacspy && \ | |
| /opt/python/cp311-cp311/bin/python3.11 -m venv .venv && \ | |
| source .venv/bin/activate && \ | |
| pip install maturin pytest pytest-asyncio && \ | |
| pip install fastmcp mcp starlette && \ | |
| make test-python" | |
| - name: Verify sdist build on PR/push | |
| working-directory: jacspy | |
| env: | |
| RUST_BACKTRACE: "1" | |
| run: | | |
| docker run --rm \ | |
| -v "$(pwd)/..:/workspace" \ | |
| jacs-build-x86_64 \ | |
| bash -c "\ | |
| cd /workspace/jacspy && \ | |
| /opt/python/cp311-cp311/bin/python3.11 -m pip install maturin && \ | |
| /opt/python/cp311-cp311/bin/python3.11 -m maturin sdist --out dist-sdist-check" | |
| wheel-smoke-uv: | |
| name: Wheel smoke install (uv) | |
| needs: test-jacs | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Set up Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: '1.93' | |
| - name: Install uv and maturin | |
| run: python -m pip install uv maturin | |
| - name: Build wheel | |
| working-directory: jacspy | |
| run: UV_NO_SYNC=1 uv run maturin build --release --out dist | |
| - name: Smoke test wheel import in clean venv | |
| working-directory: jacspy | |
| run: | | |
| set -euo pipefail | |
| uv venv /tmp/jacs-wheel-smoke | |
| uv pip install --python /tmp/jacs-wheel-smoke/bin/python dist/jacs-*.whl | |
| uv run --python /tmp/jacs-wheel-smoke/bin/python python - <<'PY' | |
| import jacs | |
| import jacs.simple | |
| import jacs.hai | |
| print("wheel smoke imports ok") | |
| PY | |
| # Job to build wheels for CI coverage (PyPI package name is jacs) | |
| build-jacs-wheels: | |
| name: Build jacs wheels on ${{ matrix.os }} | |
| needs: [test-jacs, wheel-smoke-uv] | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-14, macos-latest] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Needed for cibuildwheel versioning | |
| - name: Set up QEMU (Linux only) | |
| if: runner.os == 'Linux' | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Set up Rust (macOS) | |
| if: runner.os == 'macOS' | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: '1.93' | |
| target: x86_64-apple-darwin,aarch64-apple-darwin | |
| - name: Install cibuildwheel | |
| run: python -m pip install cibuildwheel | |
| - name: Build wheels | |
| run: cibuildwheel --output-dir wheelhouse jacspy | |
| env: | |
| CIBW_ARCHS_LINUX: "x86_64 aarch64" | |
| CIBW_ARCHS_MACOS: "x86_64 arm64" | |
| CIBW_BUILD: "cp311-* cp312-* cp313-*" | |
| # macOS: set minimum deployment target so delocate doesn't reject the wheel | |
| CIBW_ENVIRONMENT_MACOS: 'MACOSX_DEPLOYMENT_TARGET=10.13' | |
| # Linux: install Rust toolchain and OpenSSL inside manylinux containers | |
| CIBW_BEFORE_ALL_LINUX: >- | |
| if command -v yum &>/dev/null; then | |
| yum install -y openssl-devel perl-IPC-Cmd; | |
| elif command -v apk &>/dev/null; then | |
| apk add --no-cache openssl-dev perl musl-dev; | |
| fi && | |
| curl https://sh.rustup.rs -sSf | sh -s -- -y | |
| CIBW_ENVIRONMENT_LINUX: 'PATH=$HOME/.cargo/bin:$PATH' | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-jacs-${{ matrix.os }} | |
| # Path is relative to GITHUB_WORKSPACE (repo root) | |
| path: ./wheelhouse/*.whl |