Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test building from sdist #374

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
50 changes: 30 additions & 20 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ permissions:
jobs:
build-wheels:
name: Wheel - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }}
needs: build-sdist
runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -125,34 +126,36 @@ jobs:
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main

- name: Checkout code
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
fetch-depth: 0
name: packages-sdist
path: ./target/wheels/

- name: extract
shell: bash
run: |
mkdir extracted
cd extracted
ls -la ../target/wheels/
tar -xvzf ../target/wheels/*.tar.gz
ls -la

- uses: Chia-Network/actions/setup-python@main
with:
python-version: ${{ matrix.python.major-dot-minor }}

- name: Update pip
run: |
python -m pip install --upgrade pip

- name: Set up rust
uses: dtolnay/rust-toolchain@stable

- name: Install dependencies
run: |
python -m pip install maturin

- name: Build MacOs with maturin on Python ${{ matrix.python }}
if: matrix.os.matrix == 'macos'
env:
MACOSX_DEPLOYMENT_TARGET: "13.0"
run: |
python${{ matrix.python.major-dot-minor }} -m venv venv
. venv/bin/activate
maturin build -i python --release -m wheel/Cargo.toml
pip install build
python -m build --wheel extracted/chia_rs-*/

- name: Build Linux with maturin on Python ${{ matrix.python }}
if: matrix.os.matrix == 'ubuntu'
Expand All @@ -166,20 +169,27 @@ jobs:
rustup target add ${{ matrix.python.by-arch[matrix.arch.matrix].rustup-target }} && \
python${{ matrix.python.major-dot-minor }} -m venv /venv && \
. /venv/bin/activate && \
pip install --upgrade pip && \
pip install maturin && \
CC=gcc maturin build --release --manylinux ${{ matrix.python.by-arch[matrix.arch.matrix].manylinux-version }} -m wheel/Cargo.toml \
pip install build && \
CC=gcc python -m build --wheel extracted/chia_rs-*/ \
'

- name: Build Windows with maturin on Python ${{ matrix.python }}
if: matrix.os.matrix == 'windows'
shell: bash
env:
CC: "clang"
CFLAGS: "-D__BLST_PORTABLE__"
run: |
py -${{ matrix.python.major-dot-minor }} -m venv venv
. .\venv\Scripts\Activate.ps1
maturin build -i python --release -m wheel/Cargo.toml
. venv/Scripts/activate
pip install build
python -m build --wheel extracted/chia_rs-*/

- name: copy the wheel
run: |
# TODO: maturin seems to entirely ignore python -m build --outdir
mkdir dist/
cp extracted/*/target/wheels/*.whl dist/

- uses: Chia-Network/actions/create-venv@main
id: create-venv
Expand All @@ -192,7 +202,7 @@ jobs:
shell: bash
run: |
TMP_DEST=$(mktemp -d)
pip download --no-index --no-deps --only-binary :all: --find-links target/wheels/ --dest "${TMP_DEST}" chia_rs
pip download --no-index --no-deps --only-binary :all: --find-links dist/ --dest "${TMP_DEST}" chia_rs
echo ====
ls -l "${TMP_DEST}"
echo ====
Expand Down Expand Up @@ -271,8 +281,8 @@ jobs:
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: packages-sdist-${{ matrix.os.name }}-${{ matrix.python.major-dot-minor }}-${{ matrix.arch.name }}
path: ./target/wheels/
name: packages-sdist
path: ./target/wheels/*.tar.gz

fmt:
runs-on: ubuntu-latest
Expand Down
Loading