Skip to content

Remove QEMU in build_pypi workflow #1056

Remove QEMU in build_pypi workflow

Remove QEMU in build_pypi workflow #1056

Workflow file for this run

name: Pypi Build and Release
on: [push, pull_request]
jobs:
Pypi-Wheel-Build:
name: Build PyPI Wheel
strategy:
max-parallel: 4
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
platform: [ubuntu-22.04, ubuntu-22.04-arm]
include:
- image: "manylinux2014_x86_64"
platform: ubuntu-22.04
- image: "manylinux2014_aarch64"
platform: ubuntu-22.04-arm
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build Wheel
env:
DOCKER_IMG: quay.io/pypa/${{ matrix.image }}
DOCKER_MNT: pypi_build
WHEEL_DIR: wheel # wheel location
run: |
echo "Build wheel for PECOS using Python version ${{ matrix.python-version }}..."
docker run --rm -v $(pwd):/$DOCKER_MNT \
--env DOCKER_IMG=$DOCKER_IMG --env PIP_VER=${{ matrix.python-version }} \
--env DOCKER_MNT=$DOCKER_MNT --env WHEEL_DIR=$WHEEL_DIR \
$DOCKER_IMG /bin/bash /$DOCKER_MNT/.github/build_pypi_wheel.sh
- name: Test Wheel
env:
WHEEL_DIR: wheel # wheel location
run: |
python3 -m pip install $WHEEL_DIR/$(ls $WHEEL_DIR)
mkdir wheel_test
cp -r test/ wheel_test/
cd wheel_test
python3 -m pip install pytest pytest-coverage
python3 -m pytest
- name: Check Version Tag
id: check-ver-tag
run: |
if [[ "${{ github.event_name }}" == "push" ]] && \
[[ "${{ github.event.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "match=true" >> $GITHUB_OUTPUT
fi
- name: Upload to PyPI
if: steps.check-ver-tag.outputs.match == 'true' # Only upload for tags v*.*.*
env:
TWINE_USERNAME: ${{ secrets. PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets. PYPI_PASSWORD }}
WHEEL_DIR: wheel # same as Build-Wheel/WHEEL_DIR
run: |
WHEEL=$(ls $(pwd)/$WHEEL_DIR)
if [ -z $WHEEL ]; then
echo "Wheel build not successful, exit"
exit 1
fi
echo "Will upload $WHEEL to PyPI..."
pip install twine --upgrade
python3 -m twine upload $(pwd)/$WHEEL_DIR/$WHEEL --verbose