From 2d3f642d6c116e477d5f7142171b8d15da2be0ea Mon Sep 17 00:00:00 2001 From: Gijs Molenaar Date: Thu, 4 Jul 2024 13:28:43 +0200 Subject: [PATCH] restructure testing, update osx --- .github/workflows/build-and-test-amd64.yml | 160 ------------------ .github/workflows/docker.yml | 2 +- .github/workflows/linux-build-test-amd64.yml | 68 ++++++++ ...t-arm64.yml => linux-build-test-arm64.yml} | 2 +- .github/workflows/linux-test-with-deb.yml | 2 +- .github/workflows/osx-build-test-amd64.yml | 78 +++++++++ .github/workflows/osx-test-with-brew.yml | 2 +- .github/workflows/test-pypi-packages.yml | 2 +- .../workflows/windows-build-test-amd64.yml | 62 +++++++ 9 files changed, 213 insertions(+), 165 deletions(-) delete mode 100644 .github/workflows/build-and-test-amd64.yml create mode 100644 .github/workflows/linux-build-test-amd64.yml rename .github/workflows/{build-and-test-arm64.yml => linux-build-test-arm64.yml} (98%) create mode 100644 .github/workflows/osx-build-test-amd64.yml create mode 100644 .github/workflows/windows-build-test-amd64.yml diff --git a/.github/workflows/build-and-test-amd64.yml b/.github/workflows/build-and-test-amd64.yml deleted file mode 100644 index e4cd511b..00000000 --- a/.github/workflows/build-and-test-amd64.yml +++ /dev/null @@ -1,160 +0,0 @@ -name: Build and test wheels AMD64 -on: - push: - branches: [master] - pull_request: - branches: [master] -jobs: - linux-build: - name: Build wheel for linux AMD64 - 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-${{ runner.os }} - path: wheelhouse/${{ runner.os }}/*.whl - - windows-build: - name: Build wheel for windows AMD64 - runs-on: windows-2022 - 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-${{ runner.os }} - path: wheelhouse/${{ runner.os }}/*.whl - - osx-build: - name: Build wheel for osx AMD64 - 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-${{ runner.os }} - path: wheelhouse/${{ runner.os }}/*.whl - - - test-wheels-unix-86_64: - name: Testing wheels for AMD64 unix - needs: [linux-build, osx-build] - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-22.04, ubuntu-20.04, macos-14, macos-11] - 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: Download artifacts - uses: actions/download-artifact@v4 - with: - name: wheels-${{ runner.os }} - path: wheelhouse - - - name: Install python-snap7 - run: | - python3 -m venv venv - venv/bin/pip install --upgrade pip - venv/bin/pip install pytest - venv/bin/pip install $(ls wheelhouse/*.whl) - - - name: Run tests - run: | - venv/bin/pytest -m "server or util or client or mainloop" - sudo venv/bin/pytest -m partner - - - - test-wheels-windows-86_64: - name: Testing wheels for AMD64 windows - needs: [windows-build] - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [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: Download artifacts - uses: actions/download-artifact@v4 - with: - name: wheels-${{ runner.os }} - path: wheelhouse - - - name: Install python-snap7 - run: | - python3 -m pip install --upgrade pip pytest - python3 -m pip install $(ls wheelhouse/*.whl) - - - name: Run pytest - run: | - pytest -m "server or util or client or mainloop or partner" diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bf20d25f..ff155745 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -9,7 +9,7 @@ env: IMAGE_NAME: python-snap7 jobs: build-and-push-container-image: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 permissions: packages: write contents: read diff --git a/.github/workflows/linux-build-test-amd64.yml b/.github/workflows/linux-build-test-amd64.yml new file mode 100644 index 00000000..e2872c90 --- /dev/null +++ b/.github/workflows/linux-build-test-amd64.yml @@ -0,0 +1,68 @@ +name: Build and test wheels AMD64 +on: + push: + branches: [master] + pull_request: + branches: [master] +jobs: + linux-build-amd64: + name: Build wheel for linux AMD64 + 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-${{ runner.os }} + path: wheelhouse/${{ runner.os }}/*.whl + + + + linux-test-amd64: + name: Testing wheels for linux/amd64 + needs: linux-build-amd64 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ["ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04"] + 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: Download artifacts + uses: actions/download-artifact@v4 + with: + name: wheels-${{ runner.os }} + path: wheelhouse + + - 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 + + - name: Run tests + run: | + venv/bin/pytest -m "server or util or client or mainloop" + sudo venv/bin/pytest -m partner diff --git a/.github/workflows/build-and-test-arm64.yml b/.github/workflows/linux-build-test-arm64.yml similarity index 98% rename from .github/workflows/build-and-test-arm64.yml rename to .github/workflows/linux-build-test-arm64.yml index 13d203a0..caffbccf 100644 --- a/.github/workflows/build-and-test-arm64.yml +++ b/.github/workflows/linux-build-test-arm64.yml @@ -34,7 +34,7 @@ jobs: name: wheels path: wheelhouse/*.whl - test-wheels-arm64: + linux-test-arm64: name: Testing wheel for arm64 needs: linux-build-arm64 runs-on: ubuntu-20.04 diff --git a/.github/workflows/linux-test-with-deb.yml b/.github/workflows/linux-test-with-deb.yml index 836ec7a7..d9b2c6f1 100644 --- a/.github/workflows/linux-test-with-deb.yml +++ b/.github/workflows/linux-test-with-deb.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] - runs-on: ["ubuntu-20.04", "ubuntu-22.04"] + runs-on: ["ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04"] runs-on: ${{ matrix.runs-on }} steps: - name: Checkout diff --git a/.github/workflows/osx-build-test-amd64.yml b/.github/workflows/osx-build-test-amd64.yml new file mode 100644 index 00000000..1f2ef117 --- /dev/null +++ b/.github/workflows/osx-build-test-amd64.yml @@ -0,0 +1,78 @@ +name: Build and test wheels AMD64 +on: + push: + branches: [master] + pull_request: + branches: [master] +jobs: + + + osx-build: + name: Build wheel for OSX + runs-on: macos-12 + 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-${{ runner.os }} + path: wheelhouse/${{ runner.os }}/*.whl + + + osx-test: + name: Testing wheels for OSX + needs: osx-build + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-14, macos-12] + 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: Download artifacts + uses: actions/download-artifact@v4 + with: + name: wheels-${{ runner.os }} + path: wheelhouse + + - 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 + + - name: Run tests + run: | + venv/bin/pytest -m "server or util or client or mainloop" + sudo venv/bin/pytest -m partner diff --git a/.github/workflows/osx-test-with-brew.yml b/.github/workflows/osx-test-with-brew.yml index ad72b058..bd16a691 100644 --- a/.github/workflows/osx-test-with-brew.yml +++ b/.github/workflows/osx-test-with-brew.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: python-version: [ "3.9", "3.10", "3.11", "3.12" ] - runs-on: [ "macos-14", "macos-11" ] + runs-on: [ "macos-14", "macos-12" ] runs-on: ${{ matrix.runs-on }} steps: - name: Checkout diff --git a/.github/workflows/test-pypi-packages.yml b/.github/workflows/test-pypi-packages.yml index b733bf3e..41338c20 100644 --- a/.github/workflows/test-pypi-packages.yml +++ b/.github/workflows/test-pypi-packages.yml @@ -5,7 +5,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-22.04, ubuntu-20.04, macos-14, macos-11, windows-2022, windows-2019] + 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 diff --git a/.github/workflows/windows-build-test-amd64.yml b/.github/workflows/windows-build-test-amd64.yml new file mode 100644 index 00000000..998bad38 --- /dev/null +++ b/.github/workflows/windows-build-test-amd64.yml @@ -0,0 +1,62 @@ +name: Build and test wheels AMD64 +on: + push: + branches: [master] + pull_request: + branches: [master] +jobs: + windows-build: + name: Build wheel for windows AMD64 + runs-on: windows-2022 + 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-${{ runner.os }} + path: wheelhouse/${{ runner.os }}/*.whl + + windows-test-amd64: + name: Testing wheels for AMD64 windows + needs: [windows-build] + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [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: Download artifacts + uses: actions/download-artifact@v4 + with: + name: wheels-${{ runner.os }} + path: wheelhouse + + - name: Install python-snap7 + run: | + python3 -m pip install --upgrade pip pytest + python3 -m pip install $(ls wheelhouse/*.whl) + + - name: Run pytest + run: | + pytest -m "server or util or client or mainloop or partner"