diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index a7c753e9d..1692e31e8 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -2,7 +2,6 @@ name: Python Artifacts env: TRIGGER_ON_PR_PUSH: true # Set to true to enable triggers on PR pushes - PYTHON_VERSION: '3.10' on: push: @@ -63,7 +62,6 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.10', '3.11', '3.12', '3.13'] architecture: [ x86_64, aarch64 ] exclude: - os: windows-latest @@ -77,7 +75,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: '3.10' - name: Remove conflicting README.md run: | @@ -92,7 +90,7 @@ jobs: uses: PyO3/maturin-action@v1 with: command: build - args: --release --out dist --interpreter python${{ matrix.python-version }} + args: --release --out dist --interpreter python3.10 working-directory: python/pecos-rslib target: ${{ matrix.architecture == 'aarch64' && (matrix.os == 'macos-latest' && 'aarch64-apple-darwin' || 'aarch64-unknown-linux-gnu') || (matrix.os == 'macos-latest' && 'x86_64-apple-darwin' || '') }} manylinux: auto @@ -116,18 +114,73 @@ jobs: echo "No README.md backup found" fi - - name: Test wheel - if: ${{ !(matrix.architecture == 'x86_64' && matrix.os == 'macos-latest') && matrix.architecture != 'aarch64' }} + - name: Test wheel is abi3 run: | - pip install --force-reinstall --verbose python/pecos-rslib/dist/*.whl - python -c 'import pecos_rslib; print(pecos_rslib.__version__)' + # Check that the wheel has abi3 tag + ls -la python/pecos-rslib/dist/ + wheel_file=$(ls python/pecos-rslib/dist/*.whl) + echo "Built wheel: $wheel_file" + if [[ $wheel_file == *"abi3"* ]]; then + echo "Wheel has abi3 tag" + else + echo "ERROR: Wheel does not have abi3 tag!" + exit 1 + fi - name: Upload wheel uses: actions/upload-artifact@v4 with: - name: wheel-pecos-rslib-${{ matrix.os }}-${{ matrix.architecture }}-py${{ matrix.python-version }} + name: wheel-pecos-rslib-${{ matrix.os }}-${{ matrix.architecture }} path: python/pecos-rslib/dist/*.whl + test_abi3_wheels: + needs: build_wheels_pecos_rslib + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + python-version: ['3.10', '3.11', '3.12', '3.13'] + include: + # Linux x86_64 + - runner: ubuntu-latest + os: ubuntu-latest + architecture: x86_64 + # Windows x86_64 + - runner: windows-latest + os: windows-latest + architecture: x86_64 + # macOS x86_64 (Intel) + - runner: macos-13 + os: macos-latest + architecture: x86_64 + # macOS aarch64 (Apple Silicon) + - runner: macos-latest + os: macos-latest + architecture: aarch64 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.sha || github.sha }} + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Download abi3 wheel + uses: actions/download-artifact@v4 + with: + name: wheel-pecos-rslib-${{ matrix.os }}-${{ matrix.architecture }} + path: ./pecos-rslib-wheel + + - name: Test abi3 wheel with Python ${{ matrix.python-version }} + run: | + echo "Testing abi3 wheel with Python ${{ matrix.python-version }}" + python --version + pip install --force-reinstall --verbose ./pecos-rslib-wheel/*.whl + python -c 'import pecos_rslib; print(f"pecos_rslib version: {pecos_rslib.__version__}")' + python -c 'import sys; print(f"Python version: {sys.version}")' + build_sdist_quantum_pecos: needs: [check_pr_push, build_wheels_pecos_rslib] if: | @@ -143,12 +196,12 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: '3.10' - name: Download pecos-rslib wheel uses: actions/download-artifact@v4 with: - name: wheel-pecos-rslib-ubuntu-latest-x86_64-py${{ env.PYTHON_VERSION }} + name: wheel-pecos-rslib-ubuntu-latest-x86_64 path: ./pecos-rslib-wheel - name: Install pecos-rslib @@ -188,24 +241,21 @@ jobs: (needs.check_pr_push.result == 'success' && needs.check_pr_push.outputs.run == 'true' || needs.check_pr_push.result == 'skipped') && (github.event_name != 'pull_request' || github.event.pull_request.merged == true || github.event.action == 'opened' || github.event.action == 'synchronize') runs-on: ubuntu-latest - strategy: - matrix: - python-version: ['3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v4 with: ref: ${{ inputs.sha || github.sha }} - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: '3.10' - name: Download pecos-rslib wheel uses: actions/download-artifact@v4 with: - name: wheel-pecos-rslib-ubuntu-latest-x86_64-py${{ matrix.python-version }} + name: wheel-pecos-rslib-ubuntu-latest-x86_64 path: ./pecos-rslib-wheel - name: Install pecos-rslib @@ -234,7 +284,6 @@ jobs: - name: Upload quantum-pecos wheel uses: actions/upload-artifact@v4 - if: matrix.python-version == '3.10' with: name: wheel-quantum-pecos path: python/quantum-pecos/dist/*.whl