From a793fcb726fa8db0cbe034db9dedd1e00b357a56 Mon Sep 17 00:00:00 2001 From: Kristian Sloth Lauszus Date: Thu, 14 Nov 2024 13:03:06 +0100 Subject: [PATCH] Compile armv7l wheels for more Python versions Also compile then all using Debian Buster image, so depend on an old version of libc --- .github/workflows/build.yml | 14 +++++--------- Dockerfile.armv7l | 12 +++--------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 009119d..a258688 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,24 +9,22 @@ jobs: timeout-minutes: 15 strategy: matrix: - docker_images: ['balenalib/armv7hf-debian:buster', 'balenalib/armv7hf-debian:bullseye', 'balenalib/armv7hf-debian:bookworm'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v4 - name: Build ${{ matrix.docker_images }} wheel id: build run: | - docker build -f Dockerfile.armv7l -t lauszus/socketsocketcan --build-arg APP_IMAGE="${{ matrix.docker_images }}" . + docker build -f Dockerfile.armv7l -t lauszus/socketsocketcan --build-arg PYTHON_VERSION="${{ matrix.python-version }}" . docker cp "$(docker create lauszus/socketsocketcan)":/socketsocketcan-wheel . + + # Copy over the wheel. mkdir dist cp socketsocketcan-wheel/socketsocketcan*.whl dist/ - - # Special characters are not allowed, so just use the Debian codename for the artifact name - name=$(echo -n "${{ matrix.docker_images }}" | cut -d ':' -f2) - echo "name=$name" >> "$GITHUB_OUTPUT" - name: Upload wheel as artifact uses: actions/upload-artifact@v4 with: - name: socketsocketcan-armv7l-${{ steps.build.outputs.name }}-${{ github.sha }} + name: socketsocketcan-armv7l-${{ matrix.python-version }}-${{ github.sha }} path: dist retention-days: 1 if-no-files-found: error @@ -43,8 +41,6 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: pip3 install -U pip setuptools wheel pybind11 - name: Build amd64 ${{ matrix.python-version }} wheel run: pip3 -v wheel --wheel-dir=socketsocketcan-wheel . - name: Run amd64 ${{ matrix.python-version }} wheel diff --git a/Dockerfile.armv7l b/Dockerfile.armv7l index 75585c9..88edd2e 100644 --- a/Dockerfile.armv7l +++ b/Dockerfile.armv7l @@ -1,17 +1,11 @@ -ARG APP_IMAGE=balenalib/armv7hf-debian:stretch -FROM $APP_IMAGE +ARG DEBIAN_IMAGE=buster +ARG PYTHON_VERSION=3.7 +FROM balenalib/armv7hf-python:$PYTHON_VERSION-$DEBIAN_IMAGE-build COPY . /socketsocketcan RUN [ "cross-build-start" ] -# Get dependencies. -RUN apt-get -y update -RUN apt-get -y install apt-utils -RUN apt-get -y install build-essential python3-dev python3-pip -RUN rm /usr/lib/python3.*/EXTERNALLY-MANAGED || true -RUN python3 -m pip install --extra-index-url=https://www.piwheels.org/simple -U pip setuptools wheel pybind11 - # Build the wheel. RUN python3 -m pip -v wheel --wheel-dir=/socketsocketcan-wheel /socketsocketcan