-
-
Notifications
You must be signed in to change notification settings - Fork 246
139 lines (116 loc) · 4.01 KB
/
build-and-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: build-and-test-wheels
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
linux-build-86_64:
name: Build wheel for linux x86_64
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare snap7 archive
uses: ./.github/actions/prepare_snap7
- name: Build wheel
uses: ./.github/actions/manylinux_2_28_x86_64
with:
script: ./.github/build_scripts/build_package.sh
platform: manylinux_2_28_x86_64
makefile: x86_64_linux.mk
python: /opt/python/cp38-cp38/bin/python
wheeldir: wheelhouse/${{ runner.os }}/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels
path: wheelhouse/*/*.whl
windows-build:
name: Build wheel for windows
runs-on: windows-2019
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare snap7 archive
uses: ./.github/actions/prepare_snap7
- name: Build wheel
run: |
mkdir -p snap7/lib/
Copy-Item .\snap7-full-1.4.2\release\Windows\Win64\snap7.dll .\snap7\lib
python3 -m build . --wheel -C="--build-option=--plat-name=win_amd64"
mkdir -p wheelhouse/${{ runner.os }}/
cp dist/*.whl wheelhouse/${{ runner.os }}/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels
path: wheelhouse/*/*.whl
osx-build:
name: Build wheel for osx
runs-on: macos-11
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare snap7 archive
uses: ./.github/actions/prepare_snap7
- name: Prepare files
run: |
cp .github/build_scripts/arm64_osx.mk snap7-full-1.4.2/build/osx/
pushd snap7-full-1.4.2/build/osx/
make -f x86_64_osx.mk all
make -f arm64_osx.mk all
lipo -create -output /usr/local/lib/libsnap7.dylib ../bin/x86_64-osx/libsnap7.dylib ../bin/arm64-osx/libsnap7.dylib
install_name_tool -id /usr/local/lib/libsnap7.dylib /usr/local/lib/libsnap7.dylib
popd
mkdir -p snap7/lib/
cp /usr/local/lib/libsnap7.dylib snap7/lib/
- name: Build wheel
run: |
python3 -m build . --wheel -C="--build-option=--plat-name=macosx_10_9_universal2"
mkdir -p wheelhouse/${{ runner.os }}/
cp dist/*.whl wheelhouse/${{ runner.os }}/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels
path: wheelhouse/*/*.whl
test-wheels-86_64:
name: Testing wheels
needs: [linux-build-86_64, windows-build, osx-build]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install pytest
run: |
python3 -m pip install --upgrade pip
python3 -m pip install pytest
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: wheels
path: wheelhouse
- name: Install python-snap7
run: python3 -m pip install $(ls wheelhouse/${{ runner.os }}/*.whl)
- name: Run pytest
run: |
which pytest
pytest -m "server or util or client or mainloop"
- name: Run tests required sudo
if: ${{ runner.os == 'Linux'}}
run: sudo /opt/hostedtoolcache/Python/${{ matrix.python-version }}*/x64/bin/pytest -m partner
- name: Run tests required sudo
if: ${{ runner.os == 'macOS'}}
run: sudo pytest -m partner
- name: Run tests required sudo
if: ${{ runner.os == 'Windows'}}
run: pytest -m partner