Skip to content

Commit

Permalink
Various issues (#524)
Browse files Browse the repository at this point in the history
* add parameter type

* move db module back to be more backwards compatible

* small fixes

* sync log code with client code

* lets see if we can get the pypi test upload working again

* improve the test situation

* lets see if this recv is causing all trouble

* trigger test pypi upload

* switch to new workflow comaptible action container

* use workflow file names

* use dist as folder everywhere, at source tarball

* flatten dist structure

* fix artefact name

* switch to manual trigger
  • Loading branch information
gijzelaerr authored Jul 5, 2024
1 parent 3752d51 commit fe1f2ca
Show file tree
Hide file tree
Showing 38 changed files with 992 additions and 1,166 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Doc
name: Documentation
on:
push:
branches: [master]
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/linux-build-test-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
platform: manylinux_2_28_x86_64
makefile: x86_64_linux.mk
python: /opt/python/cp38-cp38/bin/python
wheeldir: wheelhouse/${{ runner.os }}/
wheeldir: dist/

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: wheels-${{ runner.os }}
path: wheelhouse/${{ runner.os }}/*.whl
name: dist
path: dist/*.whl



Expand All @@ -52,15 +52,15 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: wheels-${{ runner.os }}
path: wheelhouse
name: dist
path: dist

- name: Install python-snap7
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install pytest
venv/bin/pip install wheelhouse/*.whl
venv/bin/pip install dist/*.whl
- name: Run tests
run: |
Expand Down
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 @@ -27,12 +27,13 @@ jobs:
platform: manylinux_2_28_aarch64
makefile: aarch64-linux-gnu.mk
python: /opt/python/cp38-cp38/bin/python
wheeldir: dist/

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

linux-test-arm64:
name: Testing wheel for arm64
Expand All @@ -48,8 +49,8 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: wheels
path: wheelhouse
name: dist
path: dist

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -60,12 +61,12 @@ jobs:
run: |
docker run --rm --interactive -v $PWD/tests:/tests \
-v $PWD/pyproject.toml:/pyproject.toml \
-v $PWD/wheelhouse:/wheelhouse \
-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 $(ls wheelhouse/*.whl)
venv/bin/pip install dist/*.whl
venv/bin/pytest -m "server or util or client or mainloop or partner"
EOF
2 changes: 1 addition & 1 deletion .github/workflows/linux-test-with-deb.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Linux Test all Pythons with Debian packages
name: Test with Debian packages
on:
push:
branches: [master]
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/osx-build-test-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@ jobs:
- 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-${{ runner.os }}
path: wheelhouse/${{ runner.os }}/*.whl
name: dist
path: dist/*.whl


osx-test:
Expand All @@ -62,15 +60,15 @@ jobs:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: wheels-${{ runner.os }}
path: wheelhouse
name: dist
path: dist

- name: Install python-snap7
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install pytest
venv/bin/pip install wheelhouse/*.whl
venv/bin/pip install dist/*.whl
- name: Run tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/osx-test-with-brew.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: OS X Test
name: Test on macOS with brew
on:
push:
branches: [master]
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
name: pre-commit
name: Run pre-commit hook
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
pre-commit:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- uses: pre-commit/[email protected]
86 changes: 86 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Publish distribution 📦 to PyPI

on:
workflow_dispatch:

jobs:
publish-to-testpypi:
environment:
name: pypi
url: https://pypi.org/p/python-snap7

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

name: Publish distribution 📦 toPyPI
runs-on: ubuntu-latest
steps:
- name: "Download macOS artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: osx-build-test-amd64.yml
path: dist
- name: "Download Linux/amd64 artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: osx-build-test-amd64.yml
path: .
- name: "Download Linux/arm64 artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: linux-build-test-arm64.yml
path: .
- name: "Download Windows artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: windows-build-test-amd64.yml
path: .
- name: "Download source artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: source-build.yml
path: .
- name: Combine artifacts
uses: actions/upload-artifact@v4
with:
path: dist
- name: show dist layout
run: |
ls -al
ls -al dist
find dist
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
test-pypi-packages:
runs-on: ${{ matrix.os }}
needs: publish-to-testpypi
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, macos-14, macos-12, windows-2022, windows-2019]
python-version: ["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 python-snap7
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install python-snap7[test]
- name: Run pytest
run: |
venv/bin/pytest -m "server or util or client or mainloop"
- name: Run tests required sudo on Linux and macOS
if: ${{ runner.os == 'Linux' || runner.os == 'macOS'}}
run: sudo venv/bin/pytest -m partner

- name: On windows we don't need sudo
if: ${{ runner.os == 'Windows'}}
run: venv/bin/pytest -m partner
88 changes: 88 additions & 0 deletions .github/workflows/publish-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Publish distribution 📦 to Test PyPI

on:
workflow_dispatch:

jobs:
publish-to-testpypi:
environment:
name: testpypi
url: https://test.pypi.org/p/python-snap7

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

name: Publish distribution 📦 to TestPyPI
runs-on: ubuntu-latest
steps:
- name: "Download macOS artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: osx-build-test-amd64.yml
path: dist
- name: "Download Linux/amd64 artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: osx-build-test-amd64.yml
path: .
- name: "Download Linux/arm64 artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: linux-build-test-arm64.yml
path: .
- name: "Download Windows artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: windows-build-test-amd64.yml
path: .
- name: "Download source artifacts"
uses: dawidd6/action-download-artifact@v6
with:
workflow: source-build.yml
path: .
- name: Combine artifacts
uses: actions/upload-artifact@v4
with:
path: dist
- name: show dist layout
run: |
ls -al
ls -al dist
find dist
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
test-pypi-packages:
runs-on: ${{ matrix.os }}
needs: publish-to-testpypi
strategy:
matrix:
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04, macos-14, macos-12, windows-2022, windows-2019]
python-version: ["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 python-snap7
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip
venv/bin/pip install -i https://test.pypi.org/simple/ python-snap7[test]
- name: Run pytest
run: |
venv/bin/pytest -m "server or util or client or mainloop"
- name: Run tests required sudo on Linux and macOS
if: ${{ runner.os == 'Linux' || runner.os == 'macOS'}}
run: sudo venv/bin/pytest -m partner

- name: On windows we don't need sudo
if: ${{ runner.os == 'Windows'}}
run: venv/bin/pytest -m partner
29 changes: 29 additions & 0 deletions .github/workflows/source-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test with Debian packages
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
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: Install build tools
run: |
python3 -m venv venv
venv/bin/pip install --upgrade pip wheel build setuptools
- name: Create source tarball
run: |
venv/bin/python -m build . --sdist
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/*.tar.gz
35 changes: 0 additions & 35 deletions .github/workflows/test-pypi-packages.yml

This file was deleted.

2 changes: 1 addition & 1 deletion doc/development.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
===========
development
Development
===========

Github
Expand Down
Loading

0 comments on commit fe1f2ca

Please sign in to comment.