Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/build_scripts/x86_64_osx.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
TargetCPU :=x86_64
OS :=osx
CXXFLAGS := -O3 -fPIC -pedantic -target x86_64-apple-darwin

# Standard part

include common.mk

# Override the variable to add a target flag
SharedObjectLinkerName :=g++ -shared -fPIC --target=x86_64-apple-darwin
17 changes: 7 additions & 10 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,19 @@ on:
branches: [master]
jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Debian packages
run: |
sudo apt-get update -qq
sudo apt-get install -y python3-pip make
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: "3.10"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install ".[doc,cli]"
uv venv
uv pip install ".[doc,cli]"
- name: Run doc
run: venv/bin/sphinx-build -N -bhtml doc/ doc/_build -W
run: uv run sphinx-build -N -bhtml doc/ doc/_build -W
18 changes: 11 additions & 7 deletions .github/workflows/linux-build-test-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-24.04", "ubuntu-22.04"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -49,6 +49,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Download artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -57,12 +60,13 @@ jobs:

- name: Install python-snap7
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install pytest
venv/bin/pip install dist/*.whl
uv venv
uv pip install pytest
uv pip install dist/*.whl

# Use --no-project to prevent uv from syncing pyproject.toml,
# which would rebuild from source and lose the bundled snap7 library.
- name: Run tests
run: |
venv/bin/pytest -m "server or util or client or mainloop"
sudo venv/bin/pytest -m partner
uv run --no-project pytest -m "server or util or client or mainloop"
sudo .venv/bin/pytest -m partner
13 changes: 7 additions & 6 deletions .github/workflows/linux-build-test-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -64,9 +64,10 @@ jobs:
-v $PWD/dist:/dist \
--platform linux/arm64 \
"arm64v8/python:${{ matrix.python-version }}-bookworm" /bin/bash -s <<EOF
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install pytest
venv/bin/pip install dist/*.whl
venv/bin/pytest -m "server or util or client or mainloop or partner"
pip install --upgrade pip uv
uv venv
uv pip install pytest
uv pip install dist/*.whl
# Use --no-project to prevent uv from rebuilding from source
uv run --no-project pytest -m "server or util or client or mainloop or partner"
EOF
14 changes: 7 additions & 7 deletions .github/workflows/linux-test-with-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
runs-on: ["ubuntu-22.04", "ubuntu-24.04"]
runs-on: ${{ matrix.runs-on }}
steps:
Expand All @@ -21,17 +21,17 @@ jobs:
sudo add-apt-repository -y ppa:gijzelaar/snap7
sudo apt-get update -qq
sudo apt-get install -y libsnap7-dev libsnap7-1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install ".[test]"
uv venv
uv pip install ".[test]"
- name: Run pytest
run: |
venv/bin/pytest -m "server or util or client or mainloop"
sudo venv/bin/pytest -m partner
.venv/bin/pytest -m "server or util or client or mainloop"
sudo .venv/bin/pytest -m partner
17 changes: 11 additions & 6 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ on:
branches: [master]
jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Debian packages
run: |
sudo apt-get update -qq
sudo apt-get install -y python3-pip
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Run mypy
run: make mypy
run: |
uv venv
uv pip install -e ".[test]"
uv run mypy snap7 tests example
30 changes: 18 additions & 12 deletions .github/workflows/osx-build-test-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

osx-build:
name: Build wheel for OSX
runs-on: macos-13
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -20,14 +20,16 @@ jobs:
- name: Prepare files
run: |
cp .github/build_scripts/arm64_osx.mk snap7-full-1.4.2/build/osx/
cp .github/build_scripts/x86_64_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
mkdir -p snap7/lib/
lipo -create -output snap7/lib/libsnap7.dylib ../bin/x86_64-osx/libsnap7.dylib ../bin/arm64-osx/libsnap7.dylib
install_name_tool -id @rpath/libsnap7.dylib snap7/lib/libsnap7.dylib
popd
mkdir -p snap7/lib/
cp /usr/local/lib/libsnap7.dylib snap7/lib/
cp snap7-full-1.4.2/build/osx/snap7/lib/libsnap7.dylib snap7/lib/

- name: Build wheel
run: |
Expand All @@ -46,8 +48,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["macos-13", "macos-14", "macos-15"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: ["macos-14", "macos-15"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- name: Checkout
Expand All @@ -58,6 +60,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: Download artifacts
uses: actions/download-artifact@v4
with:
Expand All @@ -66,12 +71,13 @@ jobs:

- name: Install python-snap7
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install pytest
venv/bin/pip install dist/*.whl
uv venv
uv pip install pytest
uv pip install dist/*.whl

# Use --no-project to prevent uv from syncing pyproject.toml,
# which would rebuild from source and lose the bundled snap7 library.
- name: Run tests
run: |
venv/bin/pytest -m "server or util or client or mainloop"
sudo venv/bin/pytest -m partner
uv run --no-project pytest -m "server or util or client or mainloop"
sudo .venv/bin/pytest -m partner
15 changes: 8 additions & 7 deletions .github/workflows/osx-test-with-brew.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ jobs:
osx_wheel:
strategy:
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
runs-on: ["macos-13", "macos-14", "macos-15"]
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
runs-on: ["macos-14", "macos-15"]

runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install snap7
run: brew install --overwrite snap7 python@${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install python-snap7
run: |
python${{ matrix.python-version }} -m venv venv
venv/bin/python3 -m pip install --upgrade pip setuptools
venv/bin/python3 -m pip install -e .[test]
uv venv --python python${{ matrix.python-version }}
uv pip install -e ".[test]"
- name: Run pytest
run: |
venv/bin/pytest -m "server or util or client or mainloop"
sudo venv/bin/pytest -m partner
uv run pytest -m "server or util or client or mainloop"
sudo uv run pytest -m partner
20 changes: 12 additions & 8 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
needs: publish-to-testpypi
strategy:
matrix:
os: ["ubuntu-24.04"," ubuntu-22.04", "macos-13", "macos-14", "macos-15"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: ["ubuntu-24.04", "ubuntu-22.04", "macos-14", "macos-15"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -64,19 +64,21 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: install python-snap7
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install --extra-index-url https://test.pypi.org/simple/ python-snap7[test]
uv venv
uv pip install --extra-index-url https://test.pypi.org/simple/ python-snap7[test]

test-pypi-package-windows:
runs-on: ${{ matrix.os }}
needs: publish-to-testpypi
strategy:
matrix:
os: ["windows-2025", "windows-2022"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -86,7 +88,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: install python-snap7
run: |
pip.exe install --upgrade pip
pip.exe install --extra-index-url https://test.pypi.org/simple/ python-snap7[test]
uv pip install --extra-index-url https://test.pypi.org/simple/ python-snap7[test]
20 changes: 12 additions & 8 deletions .github/workflows/publish-test-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ jobs:
needs: publish-to-testpypi
strategy:
matrix:
os: ["ubuntu-24.04"," ubuntu-22.04", "macos-13", "macos-14", "macos-15"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: ["ubuntu-24.04", "ubuntu-22.04", "macos-14", "macos-15"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -67,19 +67,21 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: install python-snap7
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install --extra-index-url https://test.pypi.org/simple/ python-snap7[test]
uv venv
uv pip install --extra-index-url https://test.pypi.org/simple/ python-snap7[test]

test-pypi-package-windows:
runs-on: ${{ matrix.os }}
needs: publish-to-testpypi
strategy:
matrix:
os: ["windows-2025", "windows-2022"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -89,7 +91,9 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: install python-snap7
run: |
pip.exe install --upgrade pip
pip.exe install --extra-index-url https://test.pypi.org/simple/ python-snap7[test]
uv pip install --extra-index-url https://test.pypi.org/simple/ python-snap7[test]
20 changes: 11 additions & 9 deletions .github/workflows/source-build.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
name: Test with Debian packages
name: Build source distribution
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Debian packages
run: |
sudo apt-get update -qq
sudo apt-get install -y python3 python3-pip
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Install build tools
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip wheel build setuptools
uv venv
uv pip install build
- name: Create source tarball
run: |
venv/bin/python -m build . --sdist
uv run python -m build . --sdist

- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
Loading
Loading