diff --git a/.github/workflows/nightly-validation.yml b/.github/workflows/nightly-validation.yml index 3f29e1024..5d560677b 100644 --- a/.github/workflows/nightly-validation.yml +++ b/.github/workflows/nightly-validation.yml @@ -665,6 +665,57 @@ jobs: pip install $wheel.FullName python -c "import z3; x = z3.Int('x'); s = z3.Solver(); s.add(x > 0); print('Result:', s.check()); print('Model:', s.model())" + validate-python-wheel-riscv64: + name: "Validate Python wheel for RISC-V 64" + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} + timeout-minutes: 30 + steps: + - name: Checkout code + uses: actions/checkout@v6.0.2 + + - name: Setup Python + uses: actions/setup-python@v6 + with: + python-version: '3.x' + + - name: Download RISC-V 64 Python wheel from release + env: + GH_TOKEN: ${{ github.token }} + run: | + TAG="${{ github.event.inputs.release_tag }}" + if [ -z "$TAG" ]; then + TAG="Nightly" + fi + gh release download $TAG --pattern "*riscv64.whl" --dir wheels + + - name: Verify wheel platform tag and contents + run: | + pip install wheel + WHEEL_FILE=$(ls wheels/*.whl | head -n 1) + echo "Wheel file: $WHEEL_FILE" + + # Check that the wheel has a riscv64 platform tag + WHEEL_NAME=$(basename $WHEEL_FILE) + echo "Wheel name: $WHEEL_NAME" + if echo "$WHEEL_NAME" | grep -q "riscv64"; then + echo "riscv64 platform tag found" + else + echo "ERROR: riscv64 platform tag not found in wheel name" + exit 1 + fi + + # Inspect wheel contents + python -m zipfile -l $WHEEL_FILE + + # Verify wheel contains z3 library + if python -m zipfile -l $WHEEL_FILE | grep -q "libz3"; then + echo "libz3 found in wheel" + else + echo "ERROR: libz3 not found in wheel" + exit 1 + fi + # ============================================================================ # MACOS DYLIB HEADERPAD VALIDATION # ============================================================================ diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0decaffad..6c911b5b7 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -364,6 +364,45 @@ jobs: path: src/api/python/wheelhouse/*.whl retention-days: 2 + manylinux-python-riscv64: + name: "Python bindings (manylinux RISC-V 64 cross)" + runs-on: ubuntu-latest + timeout-minutes: 90 + container: quay.io/pypa/manylinux_2_28_x86_64:latest + steps: + - name: Checkout code + uses: actions/checkout@v6.0.2 + + - name: Download RISC-V toolchain + run: curl -L -o /tmp/riscv-toolchain.tar.gz 'https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.09.03/riscv64-glibc-ubuntu-20.04-gcc-nightly-2024.09.03-nightly.tar.gz' + + - name: Extract RISC-V toolchain + run: | + mkdir -p /tmp/riscv-toolchain/ + tar xf /tmp/riscv-toolchain.tar.gz -C /tmp/riscv-toolchain/ --strip-components=1 + + - name: Setup Python environment + run: | + /opt/python/cp38-cp38/bin/python -m venv $PWD/env + echo "$PWD/env/bin" >> $GITHUB_PATH + echo "/tmp/riscv-toolchain/bin" >> $GITHUB_PATH + + - name: Install build tools + run: | + echo $PATH + stat $(which riscv64-unknown-linux-gnu-gcc) + pip install build git+https://github.com/rhelmot/auditwheel + + - name: Build wheels + run: cd src/api/python && CC=riscv64-unknown-linux-gnu-gcc CXX=riscv64-unknown-linux-gnu-g++ AR=riscv64-unknown-linux-gnu-ar LD=riscv64-unknown-linux-gnu-ld Z3_CROSS_COMPILING=riscv64 python -m build && AUDITWHEEL_PLAT= auditwheel repair --best-plat dist/*.whl && cd ../../.. + + - name: Upload artifact + uses: actions/upload-artifact@v7 + with: + name: ManyLinuxPythonBuildRiscv64 + path: src/api/python/wheelhouse/*.whl + retention-days: 2 + windows-build-x64: name: "Windows x64 build" runs-on: windows-latest @@ -568,7 +607,7 @@ jobs: python-package: name: "Python packaging" - needs: [mac-build-x64, mac-build-arm64, windows-build-x64, windows-build-x86, windows-build-arm64, manylinux-python-amd64, manylinux-python-arm64] + needs: [mac-build-x64, mac-build-arm64, windows-build-x64, windows-build-x86, windows-build-arm64, manylinux-python-amd64, manylinux-python-arm64, manylinux-python-riscv64] runs-on: ubuntu-24.04 steps: - name: Checkout code @@ -621,6 +660,12 @@ jobs: name: ManyLinuxPythonBuildArm64 path: artifacts + - name: Download ManyLinux RISC-V 64 Build + uses: actions/download-artifact@v8.0.1 + with: + name: ManyLinuxPythonBuildRiscv64 + path: artifacts + - name: Extract builds run: | cd artifacts diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 712490003..3a6fbf743 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -374,6 +374,45 @@ jobs: path: src/api/python/wheelhouse/*.whl retention-days: 7 + manylinux-python-riscv64: + name: "Python bindings (manylinux RISC-V 64 cross)" + runs-on: ubuntu-latest + timeout-minutes: 90 + container: quay.io/pypa/manylinux_2_28_x86_64:latest + steps: + - name: Checkout code + uses: actions/checkout@v6.0.2 + + - name: Download RISC-V toolchain + run: curl -L -o /tmp/riscv-toolchain.tar.gz 'https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2024.09.03/riscv64-glibc-ubuntu-20.04-gcc-nightly-2024.09.03-nightly.tar.gz' + + - name: Extract RISC-V toolchain + run: | + mkdir -p /tmp/riscv-toolchain/ + tar xf /tmp/riscv-toolchain.tar.gz -C /tmp/riscv-toolchain/ --strip-components=1 + + - name: Setup Python environment + run: | + /opt/python/cp38-cp38/bin/python -m venv $PWD/env + echo "$PWD/env/bin" >> $GITHUB_PATH + echo "/tmp/riscv-toolchain/bin" >> $GITHUB_PATH + + - name: Install build tools + run: | + echo $PATH + stat $(which riscv64-unknown-linux-gnu-gcc) + pip install build git+https://github.com/rhelmot/auditwheel + + - name: Build wheels + run: cd src/api/python && CC=riscv64-unknown-linux-gnu-gcc CXX=riscv64-unknown-linux-gnu-g++ AR=riscv64-unknown-linux-gnu-ar LD=riscv64-unknown-linux-gnu-ld Z3_CROSS_COMPILING=riscv64 python -m build && AUDITWHEEL_PLAT= auditwheel repair --best-plat dist/*.whl && cd ../../.. + + - name: Upload artifact + uses: actions/upload-artifact@v7 + with: + name: ManyLinuxPythonBuildRiscv64 + path: src/api/python/wheelhouse/*.whl + retention-days: 7 + windows-build-x64: name: "Windows x64 build" runs-on: windows-latest @@ -578,7 +617,7 @@ jobs: python-package: name: "Python packaging" - needs: [mac-build-x64, mac-build-arm64, windows-build-x64, windows-build-x86, windows-build-arm64, manylinux-python-amd64, manylinux-python-arm64] + needs: [mac-build-x64, mac-build-arm64, windows-build-x64, windows-build-x86, windows-build-arm64, manylinux-python-amd64, manylinux-python-arm64, manylinux-python-riscv64] runs-on: ubuntu-24.04 steps: - name: Checkout code @@ -631,6 +670,12 @@ jobs: name: ManyLinuxPythonBuildArm64 path: artifacts + - name: Download ManyLinux RISC-V 64 Build + uses: actions/download-artifact@v8.0.1 + with: + name: ManyLinuxPythonBuildRiscv64 + path: artifacts + - name: Extract builds run: | cd artifacts