Skip to content

Commit 22013d8

Browse files
authored
* add universal2 build; add python3.10 to job matrix; update classifiers in setup.py * update cibuildwheel version; format yaml; * fix test
1 parent 6f8bcb1 commit 22013d8

File tree

7 files changed

+50
-24
lines changed

7 files changed

+50
-24
lines changed

.github/build_scripts/arm64_osx.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
TargetCPU :=arm64
2+
OS :=osx
3+
CXXFLAGS := -O3 -fPIC -pedantic -target arm64-apple-darwin
4+
5+
# Standard part
6+
7+
include common.mk
8+
9+
# Override the variable to add a target flag
10+
SharedObjectLinkerName :=g++ -shared -fPIC --target=arm64-apple-darwin

.github/workflows/build-and-test-arm64.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build-and-test-wheels
1+
name: build-and-test-wheels-arm64
22
on:
33
push:
44
branches: [master]
@@ -25,6 +25,7 @@ jobs:
2525
if: steps.snap7-archive.outputs.cache-hit != 'true'
2626
run: |
2727
wget -O snap7-full-1.4.2.7z --content-disposition -c ${{ env.snap7-archive-url }}
28+
2829
- name: Extract archive
2930
run: 7z x snap7-full-1.4.2.7z
3031

@@ -41,7 +42,7 @@ jobs:
4142
platforms: arm64
4243

4344
- name: Build wheels
44-
uses: joerick/cibuildwheel@v1.11.0
45+
uses: pypa/cibuildwheel@v2.1.3
4546
with:
4647
output-dir: wheelhouse
4748
env:
@@ -56,29 +57,34 @@ jobs:
5657
- name: Repack wheel
5758
run: bash .github/build_scripts/repack_wheel.sh wheelhouse dist wheelhouse/${{ runner.os }}
5859

59-
- name: upload artifacts
60+
- name: Upload artifacts
6061
uses: actions/upload-artifact@v2
6162
with:
6263
name: wheels
6364
path: wheelhouse/*/*.whl
65+
6466
test-wheel:
65-
name: testing wheel
67+
name: Testing wheel
6668
needs: arm64-build
6769
runs-on: ubuntu-latest
6870
strategy:
6971
matrix:
70-
python-version: [3.6, 3.7, 3.8, 3.9]
72+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
7173
steps:
7274
- name: Checkout
7375
uses: actions/checkout@v2
74-
- uses: actions/download-artifact@v2
76+
77+
- name: Download artifacts
78+
uses: actions/download-artifact@v2
7579
with:
7680
name: wheels
7781
path: wheelhouse
82+
7883
- name: Set up QEMU
7984
uses: docker/setup-qemu-action@v1
8085
with:
8186
platforms: arm64
87+
8288
- name: Run tests in docker:arm64v8
8389
run: |
8490
docker run --rm --interactive -v $PWD/test:/test -v $PWD/wheelhouse:/wheelhouse "arm64v8/python:${{ matrix.python-version }}-buster" /bin/bash -s <<EOF

.github/workflows/build-and-test.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ jobs:
4141
- name: Repack wheel
4242
run: .github/build_scripts/repack_wheel_windows.ps1 Win64 wheelhouse/${{ runner.os }}
4343

44-
- uses: actions/upload-artifact@v2
44+
- name: Upload artifacts
45+
uses: actions/upload-artifact@v2
4546
with:
4647
name: wheels
4748
path: wheelhouse/*/*.whl
@@ -72,11 +73,12 @@ jobs:
7273
mkdir src
7374
cp snap7-full-1.4.2/release/Wrappers/c-cpp/snap7.h src
7475
cp .github/build_scripts/dummy.c ./
76+
7577
- name: Build pure python wheel
7678
run: python3 setup.py bdist_wheel --plat-name=manylinux1_x86_64
7779

7880
- name: Build platform wheel
79-
uses: joerick/cibuildwheel@v1.11.0
81+
uses: pypa/cibuildwheel@v2.1.3
8082
with:
8183
output-dir: wheelhouse
8284
env:
@@ -88,15 +90,15 @@ jobs:
8890
- name: Repack wheel
8991
run: bash .github/build_scripts/repack_wheel.sh wheelhouse dist wheelhouse/${{ runner.os }}
9092

91-
- name: upload artifacts
93+
- name: Upload artifacts
9294
uses: actions/upload-artifact@v2
9395
with:
9496
name: wheels
9597
path: wheelhouse/*/*.whl
9698

9799
osx-build:
98100
name: Build wheel for osx
99-
runs-on: macos-latest
101+
runs-on: macos-11
100102
steps:
101103
- name: Checkout
102104
uses: actions/checkout@v2
@@ -121,43 +123,46 @@ jobs:
121123
mkdir src
122124
cp snap7-full-1.4.2/release/Wrappers/c-cpp/snap7.h src
123125
cp .github/build_scripts/dummy.c ./
126+
cp .github/build_scripts/arm64_osx.mk snap7-full-1.4.2/build/osx/
124127
pushd snap7-full-1.4.2/build/osx/
125128
make -f x86_64_osx.mk all
126-
cp ../bin/x86_64-osx/libsnap7.dylib /usr/local/lib
129+
make -f arm64_osx.mk all
130+
lipo -create -output /usr/local/lib/libsnap7.dylib ../bin/x86_64-osx/libsnap7.dylib ../bin/arm64-osx/libsnap7.dylib
127131
install_name_tool -id /usr/local/lib/libsnap7.dylib /usr/local/lib/libsnap7.dylib
128132
129133
- name: Install cibuildwheel
130-
run: python3 -m pip install cibuildwheel==1.10.0 wheel --upgrade
134+
run: python3 -m pip install cibuildwheel wheel --upgrade
131135

132136
- name: Build pure python wheel
133-
run: python3 setup.py bdist_wheel --plat-name=macosx_10_9_x86_64
137+
run: python3 setup.py bdist_wheel --plat-name=macosx_10_9_universal2
134138

135139
- name: Build platform wheel
136-
uses: joerick/cibuildwheel@v1.11.0
140+
uses: pypa/cibuildwheel@v2.1.3
137141
with:
138142
output-dir: wheelhouse
139143
env:
140-
CIBW_BUILD: cp36-macosx_x86_64
144+
CIBW_BUILD: cp38-macosx_universal2
145+
CIBW_ARCHS_MACOS: universal2
141146
CIBW_BUILD_VERBOSITY: 1
142147
CIBW_ENVIRONMENT: "BUILD_WHEEL_WITH_EXTENSION=1"
143148

144149
- name: Repack wheel
145150
run: bash .github/build_scripts/repack_wheel.sh wheelhouse dist wheelhouse/${{ runner.os }}
146151

147-
- name: upload artifacts
152+
- name: Upload artifacts
148153
uses: actions/upload-artifact@v2
149154
with:
150155
name: wheels
151156
path: wheelhouse/*/*.whl
152157

153158
test-wheels:
154-
name: testing wheels
159+
name: Testing wheels
155160
needs: [windows-build, linux-build, osx-build]
156161
runs-on: ${{ matrix.os }}
157162
strategy:
158163
matrix:
159164
os: [ubuntu-latest, macos-latest, windows-latest]
160-
python-version: [3.6, 3.7, 3.8, 3.9]
165+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
161166
steps:
162167
- name: Checkout
163168
uses: actions/checkout@v2
@@ -172,12 +177,13 @@ jobs:
172177
python3 -m pip install --upgrade pip
173178
python3 -m pip install pytest
174179
175-
- uses: actions/download-artifact@v2
180+
- name: Download artifacts
181+
uses: actions/download-artifact@v2
176182
with:
177183
name: wheels
178184
path: wheelhouse
179185

180-
- name: install python-snap7
186+
- name: Install python-snap7
181187
run: python3 -m pip install $(ls wheelhouse/${{ runner.os }}/*.whl)
182188

183189
- name: Run pytest

.github/workflows/linux.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
name: Linux Test all Pythons
22
on:
33
push:
4-
branches: [ master ]
4+
branches: [master]
55
pull_request:
6-
branches: [ master ]
6+
branches: [master]
77
jobs:
88
build:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: [3.6, 3.7, 3.8, 3.9]
12+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v2

.github/workflows/test-pypi-packages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
strategy:
77
matrix:
88
os: [ubuntu-latest, macos-latest, windows-latest]
9-
python-version: [3.6, 3.7, 3.8, 3.9]
9+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@v2

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def read(fname):
4949
"Programming Language :: Python :: 3.6",
5050
"Programming Language :: Python :: 3.7",
5151
"Programming Language :: Python :: 3.8",
52+
"Programming Language :: Python :: 3.9",
53+
"Programming Language :: Python :: 3.10",
5254
],
5355
python_requires='>=3.6',
5456
extras_require=extras_require,

test/test_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,8 @@ def test_wait_as_completion_timeouted(self, timeout=0, tries=500):
599599
except Snap7Exception as s7_err:
600600
if not s7_err.args[0] == b'CLI : Job Timeout':
601601
self.fail(f"While waiting another error appeared: {s7_err}")
602+
# Wait for a thread to finish
603+
time.sleep(0.1)
602604
return
603605
except BaseException:
604606
self.fail(f"While waiting another error appeared:>>>>>>>> {res2}")

0 commit comments

Comments
 (0)