Skip to content

Commit

Permalink
musllinux
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin committed Jan 19, 2024
1 parent f77ed44 commit f26e135
Showing 1 changed file with 18 additions and 152 deletions.
170 changes: 18 additions & 152 deletions .github/workflows/build-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ env:

jobs:
sdist:
# TODO(charlie): Enable source distribution builds.
if: false
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -210,8 +209,8 @@ jobs:
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- i686-unknown-linux-gnu
- x86_64-unknown-linux-musl
#- i686-unknown-linux-musl
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -220,29 +219,16 @@ jobs:
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- name: Install musl tools
run: sudo apt-get install -y musl-tools
- name: "Prep README.md"
run: echo "# Puffin" > README.md
- name: "Build wheels"
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: auto
container: off
args: --release --locked --out dist
# See: https://github.com/sfackler/rust-openssl/issues/2036#issuecomment-1724324145
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
# 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
- name: "Test wheel"
if: ${{ startsWith(matrix.target, 'x86_64') }}
run: |
Expand Down Expand Up @@ -276,25 +262,28 @@ jobs:
*.sha256
linux-cross:
# TODO(charlie): Enable cross-compilation.
if: false
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- target: aarch64-unknown-linux-gnu
- target: aarch64-unknown-linux-musl
arch: aarch64
# see https://github.com/astral-sh/puffin/issues/3791
# and https://github.com/gnzlbg/jemallocator/issues/170#issuecomment-1503228963
maturin_docker_options: -e JEMALLOC_SYS_WITH_LG_PAGE=16
- target: armv7-unknown-linux-gnueabihf
compatibility: "manylinux2014 musllinux_1_1"
- target: armv7-unknown-linux-musleabihf
arch: armv7
- target: s390x-unknown-linux-gnu
compatibility: "manylinux2014 musllinux_1_1"
- target: s390x-unknown-linux-musl
arch: s390x
- target: powerpc64le-unknown-linux-gnu
compatibility: "manylinux2014"
- target: powerpc64le-unknown-linux-musl
arch: ppc64le
- target: powerpc64-unknown-linux-gnu
compatibility: "manylinux2014 musllinux_1_1"
- target: powerpc64-unknown-linux-musl
arch: ppc64
compatibility: "manylinux2014 musllinux_1_1"

steps:
- uses: actions/checkout@v4
Expand All @@ -303,6 +292,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- run: rustup target add ${{ matrix.platform.target }}
- name: "Prep README.md"
run: echo "# Puffin" > README.md
- name: "Build wheels"
Expand All @@ -311,13 +301,13 @@ jobs:
target: ${{ matrix.platform.target }}
manylinux: 2_28
docker-options: ${{ matrix.platform.maturin_docker_options }}
args: --release --locked --out dist
args: --release --locked --out dist --compatibility ${{ matrix.platform.compatibility }}
- uses: uraimo/run-on-arch-action@v2
if: matrix.platform.arch != 'ppc64'
name: Test wheel
with:
arch: ${{ matrix.platform.arch }}
distro: ubuntu20.04
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
apt-get update
Expand Down Expand Up @@ -352,127 +342,3 @@ jobs:
*.tar.gz
*.sha256
musllinux:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-musl
- i686-unknown-linux-musl
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- name: "Prep README.md"
run: echo "# Puffin" > README.md
- name: "Build wheels"
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: musllinux_1_2
args: --release --locked --out dist
- name: "Test wheel"
if: matrix.target == 'x86_64-unknown-linux-musl'
uses: addnab/docker-run-action@v3
with:
image: alpine:latest
options: -v ${{ github.workspace }}:/io -w /io
run: |
apk add python3
python -m venv .venv
.venv/bin/pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
.venv/bin/${{ 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.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
musllinux-cross:
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- target: aarch64-unknown-linux-musl
arch: aarch64
maturin_docker_options: -e JEMALLOC_SYS_WITH_LG_PAGE=16
- target: armv7-unknown-linux-musleabihf
arch: armv7

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: musllinux_1_2
args: --release --locked --out dist
docker-options: ${{ matrix.platform.maturin_docker_options }}
- uses: uraimo/run-on-arch-action@v2
name: Test wheel
with:
arch: ${{ matrix.platform.arch }}
distro: alpine_latest
githubToken: ${{ github.token }}
install: |
apk add python3
run: |
python -m venv .venv
.venv/bin/pip3 install ${{ env.PACKAGE_NAME }} --no-index --find-links dist/ --force-reinstall
.venv/bin/${{ 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

0 comments on commit f26e135

Please sign in to comment.