Skip to content

Various issues

Various issues #3

name: Publish distribution 📦 to Test PyPI
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_run:
workflows:
- "Build and test wheels linux/amd64"
- "Build and test wheels linux/arm64"
- "Build and test wheels osx/amd64"
- "Build and test wheels windows/amd64"
types:
- completed
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: actions/download-artifact@v4
with:
name: wheels-macOS
path: dist
- name: Download Linux artifacts
uses: actions/download-artifact@v4
with:
name: wheels-Linux
path: dist
- name: Download Windows artifacts
uses: actions/download-artifact@v4
with:
name: wheels-Windows
path: dist
- name: Combine artifacts
uses: actions/upload-artifact@v4
with:
name: all-wheels
path: 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