From 8035ef79d483bc0b21744a773615e4d1fda37f2a Mon Sep 17 00:00:00 2001 From: Gijs Molenaar Date: Fri, 3 May 2024 10:37:13 +0200 Subject: [PATCH] Also include submodules & and continue on error (#503) * Also include submodules * drop python 3.8, almost EOL * typo * dont fail full step if job fails * add more pre commits * rename for clarity * lets try this * nah i think we want this --- ...-and-test.yml => build-and-test-amd64.yml} | 19 ++++++------ .github/workflows/build-and-test-arm64.yml | 15 +++++----- .github/workflows/linux.yml | 12 ++++---- .github/workflows/pre-commit.yml | 2 +- .github/workflows/test-pypi-packages.yml | 29 +++++++------------ .pre-commit-config.yaml | 3 ++ README.rst | 2 +- pyproject.toml | 3 +- 8 files changed, 42 insertions(+), 43 deletions(-) rename .github/workflows/{build-and-test.yml => build-and-test-amd64.yml} (90%) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test-amd64.yml similarity index 90% rename from .github/workflows/build-and-test.yml rename to .github/workflows/build-and-test-amd64.yml index 2dd2624e..4ff5bf6c 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test-amd64.yml @@ -1,12 +1,12 @@ -name: build-and-test-wheels +name: Build and test wheels AMD64 on: push: branches: [master] pull_request: branches: [master] jobs: - linux-build-86_64: - name: Build wheel for linux x86_64 + linux-build: + name: Build wheel for linux AMD64 runs-on: ubuntu-20.04 steps: - name: Checkout @@ -31,7 +31,7 @@ jobs: path: wheelhouse/${{ runner.os }}/*.whl windows-build: - name: Build wheel for windows + name: Build wheel for windows AMD64 runs-on: windows-2022 steps: - name: Checkout @@ -55,7 +55,7 @@ jobs: path: wheelhouse/${{ runner.os }}/*.whl osx-build: - name: Build wheel for osx + name: Build wheel for osx AMD64 runs-on: macos-11 steps: - name: Checkout @@ -91,13 +91,14 @@ jobs: test-wheels-86_64: - name: Testing wheels - needs: [linux-build-86_64, windows-build, osx-build] + name: Testing wheels for AMD64 + needs: [linux-build, windows-build, osx-build] + continue-on-error: true runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-20.04, windows-2022, macos-14] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + os: [ubuntu-22.04, ubuntu-20.04, macos-14, macos-11, windows-2022, windows-2019] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/build-and-test-arm64.yml b/.github/workflows/build-and-test-arm64.yml index c0e61225..1dedcdd7 100644 --- a/.github/workflows/build-and-test-arm64.yml +++ b/.github/workflows/build-and-test-arm64.yml @@ -1,11 +1,11 @@ -name: build-and-test-wheels-arm64 +name: Build and test wheels ARM64 on: push: branches: [master] pull_request: branches: [master] jobs: - linux-build-aarch64: + linux-build-arm64: name: Build wheel for linux arm64 runs-on: ubuntu-20.04 steps: @@ -20,7 +20,7 @@ jobs: with: platforms: arm64 - - name: Build wheel + - name: Build wheel for aarch64 uses: ./.github/actions/manylinux_2_28_aarch64 with: script: ./.github/build_scripts/build_package.sh @@ -34,13 +34,14 @@ jobs: name: wheels path: wheelhouse/*.whl - test-wheels-aarch64: - name: Testing wheel - needs: linux-build-aarch64 + test-wheels-arm64: + name: Testing wheel for arm64 + needs: linux-build-arm64 + continue-on-error: true runs-on: ubuntu-20.04 strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 4c35d2d6..473b30d0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,4 +1,4 @@ -name: Linux Test all Pythons +name: Linux Test all Pythons with Debian packages on: push: branches: [master] @@ -6,10 +6,12 @@ on: branches: [master] jobs: build: - runs-on: ubuntu-20.04 strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] + runs-on: ["ubuntu-20.04", "ubuntu-22.04"] + runs-on: ${{ matrix.runs-on }} + continue-on-error: true steps: - name: Checkout uses: actions/checkout@v4 @@ -32,5 +34,5 @@ jobs: venv/bin/pip install ".[test]" - name: Run pytest run: | - venv/bin/pytest tests/test_client.py tests/test_mainloop.py tests/test_server.py tests/test_util.py - sudo venv/bin/pytest tests/test_partner.py + venv/bin/pytest -m "server or util or client or mainloop" + sudo venv/bin/pytest -m partner diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 0dba3039..371b529d 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -11,5 +11,5 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.8' + python-version: '3.9' - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/test-pypi-packages.yml b/.github/workflows/test-pypi-packages.yml index 0f29fbd7..b733bf3e 100644 --- a/.github/workflows/test-pypi-packages.yml +++ b/.github/workflows/test-pypi-packages.yml @@ -6,7 +6,7 @@ jobs: strategy: matrix: os: [ubuntu-22.04, ubuntu-20.04, macos-14, macos-11, windows-2022, windows-2019] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - name: Checkout uses: actions/checkout@v4 @@ -16,27 +16,20 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install pytest - run: | - python3 -m pip install --upgrade pip - python3 -m pip install pytest - - name: install python-snap7 - run: python3 -m pip install -i https://test.pypi.org/simple/ 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: | - 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 + venv/bin/pytest -m "server or util or client or mainloop" - - name: Run tests required sudo - if: ${{ runner.os == 'macOS'}} - run: sudo pytest -m partner + - name: Run tests required sudo on Linux and macOS + if: ${{ runner.os == 'Linux' || runner.os == 'macOS'}} + run: sudo venv/bin/pytest -m partner - - name: Run tests required sudo + - name: On windows we don't need sudo if: ${{ runner.os == 'Windows'}} - run: pytest -m partner + run: venv/bin/pytest -m partner diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1ee2778b..b6b4a8c5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,10 +4,12 @@ repos: hooks: - id: trailing-whitespace - id: end-of-file-fixer + - id: check-ast - id: check-json - id: check-toml - id: check-xml - id: check-yaml + - id: check-merge-conflict - id: debug-statements - id: check-builtin-literals - id: check-case-conflict @@ -25,3 +27,4 @@ repos: rev: 'v0.4.2' hooks: - id: ruff + - id: ruff-format diff --git a/README.rst b/README.rst index 142808a9..d83c8a7e 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ This is a ctypes-based Python wrapper for snap7. Snap7 is an open-source, 32/64 bit, multi-platform Ethernet communication suite for interfacing natively with Siemens S7 PLCs. -Python-snap7 is tested with Python 3.8+, on Windows, Linux and OS X. +Python-snap7 is tested with Python 3.9+, on Windows, Linux and OS X. The full documentation is available on `Read The Docs `_. diff --git a/pyproject.toml b/pyproject.toml index e505b0cb..9e7a1dba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,8 +39,7 @@ doc = ["sphinx", "sphinx_rtd_theme"] snap7 = ["py.typed", "lib/libsnap7.so", "lib/snap7.dll", "lib/libsnap7.dylib"] [tool.setuptools.packages.find] -where = ["."] -include = ["snap7", "snap7.lib"] +include = ["snap7*"] [project.scripts] snap7-server = "snap7.server.__main__:main"