Enable PowerPC builds #81
Workflow file for this run
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
# Build Puffin on all platforms. | |
# | |
# Generates both wheels (for PyPI) and archived binaries (for GitHub releases). | |
# | |
# Assumed to run as a subworkflow of .github/workflows/release.yml; specifically, as a local | |
# artifacts job within `cargo-dist`. | |
name: "Build binaries" | |
on: | |
workflow_call: | |
inputs: | |
plan: | |
required: true | |
type: string | |
pull_request: | |
paths: | |
# When we change pyproject.toml, we want to ensure that the maturin builds still work. | |
- pyproject.toml | |
# And when we change this workflow itself... | |
- .github/workflows/build-binaries.yml | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
PACKAGE_NAME: puffin_alpha | |
MODULE_NAME: puffin | |
PYTHON_VERSION: "3.11" | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
CARGO_TERM_COLOR: always | |
RUSTUP_MAX_RETRIES: 10 | |
jobs: | |
linux-cross: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
platform: | |
- target: powerpc64le-unknown-linux-gnu | |
arch: ppc64le | |
# - target: powerpc64-unknown-linux-gnu | |
# arch: ppc64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: "Prep README.md" | |
run: echo "# Puffin" > README.md | |
- name: "Build wheels" | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.platform.target }} | |
manylinux: auto | |
docker-options: ${{ matrix.platform.maturin_docker_options }} | |
args: --release --locked --out dist | |
before-script-linux: | | |
# If we're running on rhel centos, install needed packages. | |
if command -v yum &> /dev/null; then | |
yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic | |
yum -y install epel-release | |
yum repolist | |
yum install -y gcc-powerpc64-linux-gnu | |
# If we're running on i686 we need to symlink libatomic | |
# in order to build openssl with -latomic flag. | |
if [[ ! -d "/usr/lib64" ]]; then | |
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so | |
fi | |
else | |
# If we're running on debian-based system. | |
apt update -y && apt-get install -y libssl-dev openssl pkg-config | |
fi | |
- uses: uraimo/run-on-arch-action@v2 | |
if: matrix.platform.arch != 'ppc64' | |
name: Test wheel | |
with: | |
arch: ${{ matrix.platform.arch }} | |
distro: ubuntu20.04 | |
githubToken: ${{ github.token }} | |
install: | | |
apt-get update | |
apt-get install -y --no-install-recommends python3 python3-pip | |
pip3 install -U pip | |
run: | | |
pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall | |
${{ env.MODULE_NAME }} --help | |
- name: "Upload wheels" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
- name: "Archive binary" | |
shell: bash | |
run: | | |
set -euo pipefail | |
TARGET=${{ matrix.platform.target }} | |
ARCHIVE_NAME=puffin-$TARGET | |
ARCHIVE_FILE=$ARCHIVE_NAME.tar.gz | |
mkdir -p $ARCHIVE_NAME | |
cp target/$TARGET/release/puffin $ARCHIVE_NAME/puffin | |
tar czvf $ARCHIVE_FILE $ARCHIVE_NAME | |
shasum -a 256 $ARCHIVE_FILE > $ARCHIVE_FILE.sha256 | |
- name: "Upload binary" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: | | |
*.tar.gz | |
*.sha256 |