Skip to content

Commit

Permalink
Compile armv7l wheels for more Python versions (#17)
Browse files Browse the repository at this point in the history
Also compile them on Debian Buster, so the binary depends on an old version of libc
  • Loading branch information
Lauszus authored Nov 14, 2024
1 parent 600e471 commit a0272b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 3 additions & 9 deletions Dockerfile.armv7l
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit a0272b1

Please sign in to comment.