Skip to content

Commit

Permalink
Fix #451 (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikteliy authored Aug 5, 2023
1 parent b5ff3d7 commit 36996c2
Show file tree
Hide file tree
Showing 23 changed files with 276 additions and 280 deletions.
6 changes: 6 additions & 0 deletions .github/actions/linux_armv7l/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ghcr.io/nikteliy/manylinux_2_24_armv7l:python3.7

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
28 changes: 28 additions & 0 deletions .github/actions/linux_armv7l/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'linux_armv7l'
description: 'Builds linux_armv7l package'
inputs:
script:
description: 'Specifies the path to the build script'
required: true
platform:
description: 'Specifies the --plat-name option to the build command'
required: true
makefile:
description: 'Specifies the path to the .mk file'
required: true
python:
description: 'Specifies the path to the python interpreter'
default: /usr/bin/python3
wheeldir:
description: 'Specifies directory to store delocated wheels'
required: true
default: wheelhouse
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.script }}
- ${{ inputs.platform }}
- ${{ inputs.makefile }}
- ${{ inputs.python }}
- ${{ inputs.wheeldir }}
7 changes: 7 additions & 0 deletions .github/actions/linux_armv7l/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -o errexit
set -o pipefail
set -o nounset

exec "$INPUT_SCRIPT"
6 changes: 6 additions & 0 deletions .github/actions/manylinux_2_24_aarch64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM quay.io/pypa/manylinux_2_24_aarch64:latest

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
28 changes: 28 additions & 0 deletions .github/actions/manylinux_2_24_aarch64/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'manylinux_2_24_aarch64'
description: 'Builds manylinux_2_24_aarch64 package'
inputs:
script:
description: 'Specifies the path to the build script'
required: true
platform:
description: 'Specifies the --plat-name option to the build command'
required: true
makefile:
description: 'Specifies the path to the .mk file'
required: true
python:
description: 'Specifies the path to the python interpreter'
default: /usr/bin/python3
wheeldir:
description: 'Specifies directory to store delocated wheels'
required: true
default: wheelhouse
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.script }}
- ${{ inputs.platform }}
- ${{ inputs.makefile }}
- ${{ inputs.python }}
- ${{ inputs.wheeldir }}
7 changes: 7 additions & 0 deletions .github/actions/manylinux_2_24_aarch64/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -o errexit
set -o pipefail
set -o nounset

exec "$INPUT_SCRIPT"
6 changes: 6 additions & 0 deletions .github/actions/manylinux_2_24_x86_64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM quay.io/pypa/manylinux_2_24_x86_64:latest

COPY /entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
28 changes: 28 additions & 0 deletions .github/actions/manylinux_2_24_x86_64/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'manylinux_2_24_x86_64'
description: 'Builds manylinux_2_24_x86_64 package'
inputs:
script:
description: 'Specifies the path to the build script'
required: true
platform:
description: 'Specifies the --plat-name option to the build command'
required: true
makefile:
description: 'Specifies the path to the .mk file'
required: true
python:
description: 'Specifies the path to the python interpreter'
default: /usr/bin/python3
wheeldir:
description: 'Specifies directory to store delocated wheels'
required: true
default: wheelhouse
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.script }}
- ${{ inputs.platform }}
- ${{ inputs.makefile }}
- ${{ inputs.python }}
- ${{ inputs.wheeldir }}
7 changes: 7 additions & 0 deletions .github/actions/manylinux_2_24_x86_64/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -o errexit
set -o pipefail
set -o nounset

exec "$INPUT_SCRIPT"
9 changes: 1 addition & 8 deletions .github/actions/prepare_snap7/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ runs:
shell: bash
run: 7z x snap7-full-1.4.2.7z

- name: Copy files
shell: bash
run: |
mkdir src
cp snap7-full-1.4.2/release/Wrappers/c-cpp/snap7.h src
cp .github/build_scripts/dummy.c ./
- name: Update wheel
shell: bash
run: python -m pip install --upgrade pip wheel
run: python3 -m pip install --upgrade pip wheel build
13 changes: 13 additions & 0 deletions .github/build_scripts/build_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

cp .github/build_scripts/aarch64-linux-gnu.mk snap7-full-1.4.2/build/unix/
pushd snap7-full-1.4.2/build/unix/
make -f "${INPUT_MAKEFILE}" install
popd
mkdir -p snap7/lib/
cp /usr/lib/libsnap7.so snap7/lib/
${INPUT_PYTHON} -m pip install wheel build auditwheel patchelf
${INPUT_PYTHON} -m build . --wheel -C="--build-option=--plat-name=${INPUT_PLATFORM}"

auditwheel repair dist/*${INPUT_PLATFORM}.whl --plat ${INPUT_PLATFORM} -w ${INPUT_WHEELDIR}

1 change: 0 additions & 1 deletion .github/build_scripts/dummy.c

This file was deleted.

62 changes: 0 additions & 62 deletions .github/build_scripts/repack_wheel.sh

This file was deleted.

15 changes: 0 additions & 15 deletions .github/build_scripts/repack_wheel_windows.ps1

This file was deleted.

50 changes: 20 additions & 30 deletions .github/workflows/build-and-test-arm32v7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,38 @@ on:
pull_request:
branches: [master]
jobs:
arm32-build:
linux-build-arm32v7:
name: Build arm32 wheel
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: prepare snap7 archive
- name: Prepare snap7 archive
uses: ./.github/actions/prepare_snap7

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: arm

- name: Build libsnap7.so
run: |
docker run --rm --interactive -v $PWD/snap7-full-1.4.2:/snap7-full-1.4.2 "arm32v7/gcc:latest" /bin/bash -s <<EOF
cd snap7-full-1.4.2/build/unix/
make -f arm_v7_linux.mk all
EOF
- name: Build pure python wheel
run: python3 setup.py bdist_wheel --plat-name=linux_armv7l

- name: Repack wheel
run: |
unpack_tmp_dir=unpack_tmp_dir
mkdir -p $unpack_tmp_dir
packagename=$(python3 -m wheel unpack $(ls dist/*linux_armv7l.whl) -d $unpack_tmp_dir | sed -e 's/.*\/\(.*\)...OK/\1/')
echo $packagename
mkdir -p $unpack_tmp_dir/$packagename/snap7/lib
cp snap7-full-1.4.2/build/bin/arm_v7-linux/libsnap7.so $unpack_tmp_dir/$packagename/snap7/lib/
mkdir -p wheelhouse/linux_armv7l
python3 -m wheel pack $unpack_tmp_dir/$packagename -d wheelhouse/linux_armv7l/

- name: Build wheel
uses: ./.github/actions/linux_armv7l
with:
script: ./.github/build_scripts/build_package.sh
platform: manylinux_2_24_armv7l
makefile: arm_v7_linux.mk
python: /usr/local/bin/python3

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/*/*.whl
path: wheelhouse/*.whl

test-wheel:
test-wheels-arm32:
name: Testing wheel
needs: arm32-build
needs: linux-build-arm32v7
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -68,11 +55,14 @@ jobs:
uses: docker/setup-qemu-action@v2
with:
platforms: arm

- name: Run tests in docker:arm32v7
run: |
docker run --platform linux/arm/v7 --rm --interactive -v $PWD/tests:/tests -v $PWD/setup.cfg:/setup.cfg \
-v $PWD/wheelhouse:/wheelhouse "arm32v7/python:${{ matrix.python-version }}-buster" /bin/bash -s <<EOF
python -m pip install pytest pytest-asyncio $(ls wheelhouse/linux_armv7l/*.whl)
docker run --platform linux/arm/v7 --rm --interactive -v $PWD/tests:/tests \
-v $PWD/pyproject.toml:/pyproject.toml \
-v $PWD/wheelhouse:/wheelhouse \
"arm32v7/python:${{ matrix.python-version }}-buster" /bin/bash -s <<EOF
python -m pip install pytest pytest-asyncio $(ls wheelhouse/*manylinux_2_24_armv7l.whl)
python -m pytest tests/ -m "server or util or client or mainloop or partner"
EOF
Loading

0 comments on commit 36996c2

Please sign in to comment.