From 019f85528d1aabd6717074eca510025604c2aff5 Mon Sep 17 00:00:00 2001 From: collerek Date: Mon, 17 Aug 2026 11:27:52 +0200 Subject: [PATCH] ci: build musllinux wheels and test them on Alpine Only glibc wheels were published, so on musl distros pip fell back to the sdist and required a Rust toolchain on the target machine. Adds musllinux_1_2 wheels for x86_64 and aarch64, and a test-musl job that installs the built wheel in an Alpine container and runs the test suite. Artifact names now include the manylinux value to avoid the glibc/musl collision that upload-artifact@v4 rejects. --- .github/workflows/ci.yml | 46 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0b36a1c..9f2f25c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,9 +59,35 @@ jobs: - name: Run tests run: pytest tests/ -v + test-musl: + name: Test (musllinux wheel on Alpine) + needs: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Build musllinux wheel + uses: PyO3/maturin-action@v1 + with: + target: x86_64 + args: --release --out dist + manylinux: musllinux_1_2 + # Alpine marks its system Python as externally managed (PEP 668), so the + # wheel is installed into a venv. --no-index is the real assertion here: + # if the wheel is not tagged musllinux, pip finds no candidate at all and + # the job fails, which is precisely the breakage being guarded against. + - name: Install wheel and run tests on Alpine + run: | + docker run --rm -v "$PWD:/io" -w /io alpine:latest sh -euc ' + apk add --no-cache python3 + python3 -m venv /venv + /venv/bin/pip install pytest + /venv/bin/pip install --no-index --find-links dist ormar-utils + /venv/bin/pytest tests/ -v + ' + build: - name: Build wheels (${{ matrix.os }}-${{ matrix.target }}) - needs: test + name: Build wheels (${{ matrix.os }}-${{ matrix.target }}-${{ matrix.manylinux || 'auto' }}) + needs: [test, test-musl] if: startsWith(github.ref, 'refs/tags/v') runs-on: ${{ matrix.os }} strategy: @@ -71,6 +97,15 @@ jobs: target: x86_64 - os: ubuntu-latest target: aarch64 + # musl builds for Alpine and other musl-libc distros. glibc wheels are + # not installable there, so without these pip falls back to the sdist + # and requires a Rust toolchain on the target machine. + - os: ubuntu-latest + target: x86_64 + manylinux: musllinux_1_2 + - os: ubuntu-latest + target: aarch64 + manylinux: musllinux_1_2 - os: macos-latest target: x86_64 - os: macos-latest @@ -89,11 +124,14 @@ jobs: with: target: ${{ matrix.target }} args: --release --out dist - manylinux: auto + manylinux: ${{ matrix.manylinux || 'auto' }} + # The manylinux value is part of the name because the glibc and musl + # builds otherwise collide on os+target, and upload-artifact@v4 rejects + # duplicate artifact names. - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-${{ matrix.os }}-${{ matrix.target }} + name: wheels-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.manylinux || 'auto' }} path: dist sdist: