Build via PyPI #17
This file contains 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: Build via PyPI | |
on: | |
workflow_dispatch: | |
inputs: | |
package: | |
required: true | |
type: string | |
version: | |
required: true | |
type: string | |
python_version: | |
required: true | |
type: string | |
workflow_call: | |
inputs: | |
package: | |
required: true | |
type: string | |
version: | |
required: true | |
type: string | |
python_version: | |
required: true | |
type: string | |
jobs: | |
build: | |
name: Python ${{ inputs.python_version }} ${{ inputs.package }} ${{ inputs.version }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get build strategy | |
working-directory: packages/${{ inputs.package }} | |
run: | | |
echo STRATEGY=$(cat build.yaml | yq .strategy) >> $GITHUB_ENV | |
- uses: nick-fields/assert-action@v1 | |
with: | |
expected: "pypi" | |
actual: ${{ env.STRATEGY }} | |
comparison: exact | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Run build | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: ghcr.io/bjia56/armv7l-wheel-builder:main | |
options: --platform linux/arm/v7 -v ${{ github.workspace }}:/work -v /tmp/output:/export --workdir /work | |
run: | | |
set -x | |
# these env vars allows compilation to find local openssl | |
export CFLAGS='-I/usr/local/ssl/include' | |
export LDFLAGS='-L/usr/local/ssl/lib' | |
export LD_LIBRARY_PATH=/usr/local/ssl/lib:$LD_LIBRARY_PATH | |
export PKG_CONFIG_PATH=/usr/local/ssl/lib/pkgconfig | |
# these env vars set the gcc toolchain to devtoolset-10 | |
export CC=/opt/rh/devtoolset-10/root/usr/bin/gcc | |
export FC=/opt/rh/devtoolset-10/root/usr/bin/gfortran5 | |
export CXX=/opt/rh/devtoolset-10/root/usr/bin/g++ | |
export LD=/opt/rh/devtoolset-10/root/usr/bin/g++ | |
python${{ inputs.python_version }} -m pip wheel --no-deps ${{ inputs.package }}==${{ inputs.version }} --no-binary ${{ inputs.package }} --extra-index-url https://bjia56.github.io/armv7l-wheels/ --prefer-binary | |
auditwheel repair ${{ inputs.package }}*armv7l.whl | |
python${{ inputs.python_version }} -m pip install wheelhouse/${{ inputs.package }}-*manylinux*armv7l.whl --extra-index-url https://bjia56.github.io/armv7l-wheels/ --prefer-binary | |
python${{ inputs.python_version }} -c 'import ${{ inputs.package }}; print(${{ inputs.package }})' | |
cp wheelhouse/${{ inputs.package }}-*manylinux*armv7l.whl /export | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ inputs.package }}-${{ inputs.version }}-cpython${{ inputs.python_version }} | |
path: /tmp/output/*.whl |