From 38f9d95d82e82e6772adbab7f40cc77fdf8fb8b7 Mon Sep 17 00:00:00 2001 From: Ian Waudby-Smith <5490890+WannabeSmith@users.noreply.github.com> Date: Tue, 11 Jan 2022 15:10:05 -0500 Subject: [PATCH 1/6] Build manylinux wheels Separate out linux wheels building to cibuildwheels-manylinux.yml so that we can use the cibuildwheel tool (https://cibuildwheel.readthedocs.io/en/stable/) This builds wheels for several linux distros, with cpython versions 3.7--3.10 and pypy 3.7--3.8. We don't support musl yet but it might be possible. --- .github/workflows/cibuildwheels-manylinux.yml | 30 +++++++++++++++++++ .github/workflows/python-package.yml | 24 ++++++++++----- pyproject.toml | 1 - 3 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/cibuildwheels-manylinux.yml diff --git a/.github/workflows/cibuildwheels-manylinux.yml b/.github/workflows/cibuildwheels-manylinux.yml new file mode 100644 index 0000000..571f7d8 --- /dev/null +++ b/.github/workflows/cibuildwheels-manylinux.yml @@ -0,0 +1,30 @@ +name: Build manylinux wheels + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v2 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.3.1 + env: + CIBW_BEFORE_ALL_LINUX: "yum install -y boost boost-thread boost-devel && python -m pip install --upgrade pip" + CIBW_ARCHS_LINUX: "auto64" + CIBW_SKIP: "*-musllinux_* cp36-*" + + - uses: actions/upload-artifact@v2 + with: + name: confseq_manylinux_wheels + path: ./wheelhouse/*.whl diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index d1cb6bd..567f1e4 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -1,7 +1,7 @@ # This workflow will install boost dependencies, lint, run unit tests, and build wheels with a variety of OS/Python configurations. # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Python package +name: Check package on: push: @@ -25,6 +25,7 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} + - name: Install dependencies run: | # Install boost library to OS @@ -35,27 +36,34 @@ jobs: brew install boost fi python -m pip install --upgrade pip - python -m pip install flake8 pytest build + - name: Install confseq package run: | - pip install ./ + python -m pip install ./ + - name: Lint with flake8 run: | + python -m pip install flake8 # stop the build if there are Python syntax errors or undefined names flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude test/googletest-* # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude test/googletest-* + - name: Run unit tests run: | + python -m pip install pytest # Run c++ unit tests make -C test runtests # Run python unit tests, but ignore googletest library pytest -m "not random" --ignore=test/googletest-1.8.1/ - - name: Build and upload wheels - run: | - python -m build - + + - name: Build and upload macOS wheels + run: | + if [ "$RUNNER_OS" == "macOS" ]; then + python -m pip install build + python -m build + fi - uses: actions/upload-artifact@v2 with: - name: confseq_dist + name: confseq_macos_dist path: ./dist/confseq-* diff --git a/pyproject.toml b/pyproject.toml index 9cba4db..87f36c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,4 +13,3 @@ build-backend = "setuptools.build_meta" markers = [ "random: marks tests as random (deselect with '-m \"not random\"')" ] - From 62a06b3a36fef5cf2df9d530addb0df75ca5a654 Mon Sep 17 00:00:00 2001 From: Ian Waudby-Smith <5490890+WannabeSmith@users.noreply.github.com> Date: Tue, 11 Jan 2022 17:50:19 -0500 Subject: [PATCH 2/6] Reorganize gh actions Separate out wheel building from testing, and separate manylinux from macos. --- .github/workflows/build-macos-dist.yml | 43 +++++++++++++++++++ .github/workflows/cibuildwheels-manylinux.yml | 11 ++++- ...age.yml => quick-check-python-package.yml} | 23 +++------- 3 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/build-macos-dist.yml rename .github/workflows/{python-package.yml => quick-check-python-package.yml} (74%) diff --git a/.github/workflows/build-macos-dist.yml b/.github/workflows/build-macos-dist.yml new file mode 100644 index 0000000..3d04007 --- /dev/null +++ b/.github/workflows/build-macos-dist.yml @@ -0,0 +1,43 @@ +# Builds the wheels (and source dist) for macOS on Python 3.7--3.10. +# This action is separated from the cibuildwheels-manylinux action because that cannot be parallelized while this is. +# Also, cibuildwheels makes building manylinux wheels much simpler, but macos wheels are straightforward to build via "python -m build". + +name: Build macOS dist + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [macos-latest] + python-version: ["3.7", "3.8", "3.9", "3.10"] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install boost dependency + run: | + brew install boost + + - name: Build and upload macOS wheels + run: | + python -m pip install build + python -m build + + - uses: actions/upload-artifact@v2 + with: + name: confseq_macos_dist + path: ./dist/confseq-* + diff --git a/.github/workflows/cibuildwheels-manylinux.yml b/.github/workflows/cibuildwheels-manylinux.yml index 571f7d8..aa11bc0 100644 --- a/.github/workflows/cibuildwheels-manylinux.yml +++ b/.github/workflows/cibuildwheels-manylinux.yml @@ -23,8 +23,17 @@ jobs: CIBW_BEFORE_ALL_LINUX: "yum install -y boost boost-thread boost-devel && python -m pip install --upgrade pip" CIBW_ARCHS_LINUX: "auto64" CIBW_SKIP: "*-musllinux_* cp36-*" +### At the moment, CIBW_TEST seems to not work (the gh-action just hangs with no output at all). Keeping this here +### in case we figure it out later. +# # Install pytest before running CIBW_TEST_COMMAND +# CIBW_TEST_REQUIRES: pytest +# CIBW_TEST_COMMAND: > +# # Run c++ unit tests +# make -C test runtests +# # Run python unit tests, but ignore googletest library +# pytest -m "not random" --ignore=test/googletest-1.8.1/ - uses: actions/upload-artifact@v2 with: - name: confseq_manylinux_wheels + name: confseq_wheels path: ./wheelhouse/*.whl diff --git a/.github/workflows/python-package.yml b/.github/workflows/quick-check-python-package.yml similarity index 74% rename from .github/workflows/python-package.yml rename to .github/workflows/quick-check-python-package.yml index 567f1e4..e2e0cf8 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/quick-check-python-package.yml @@ -1,11 +1,9 @@ -# This workflow will install boost dependencies, lint, run unit tests, and build wheels with a variety of OS/Python configurations. +# This workflow will install boost dependencies, lint, and run unit tests for the latest Ubuntu/macOS on Python 3.7 and 3.10. # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Check package +name: Check Python package on: - push: - branches: [ master ] pull_request: branches: [ master ] @@ -17,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] + python-version: ["3.7", "3.10"] steps: - uses: actions/checkout@v2 @@ -26,7 +24,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install dependencies + - name: Install boost run: | # Install boost library to OS if [ "$RUNNER_OS" == "Linux" ]; then @@ -35,10 +33,10 @@ jobs: elif [ "$RUNNER_OS" == "macOS" ]; then brew install boost fi - python -m pip install --upgrade pip - name: Install confseq package run: | + python -m pip install --upgrade pip python -m pip install ./ - name: Lint with flake8 @@ -56,14 +54,3 @@ jobs: make -C test runtests # Run python unit tests, but ignore googletest library pytest -m "not random" --ignore=test/googletest-1.8.1/ - - - name: Build and upload macOS wheels - run: | - if [ "$RUNNER_OS" == "macOS" ]; then - python -m pip install build - python -m build - fi - - uses: actions/upload-artifact@v2 - with: - name: confseq_macos_dist - path: ./dist/confseq-* From bb51dbca571795e264a25f1f22978263516108d3 Mon Sep 17 00:00:00 2001 From: Ian Waudby-Smith <5490890+WannabeSmith@users.noreply.github.com> Date: Tue, 11 Jan 2022 17:56:36 -0500 Subject: [PATCH 3/6] Update quick-check-python-package.yml --- .github/workflows/quick-check-python-package.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/quick-check-python-package.yml b/.github/workflows/quick-check-python-package.yml index e2e0cf8..fe50ba5 100644 --- a/.github/workflows/quick-check-python-package.yml +++ b/.github/workflows/quick-check-python-package.yml @@ -1,4 +1,4 @@ -# This workflow will install boost dependencies, lint, and run unit tests for the latest Ubuntu/macOS on Python 3.7 and 3.10. +# This workflow will install boost dependencies, lint, and run unit tests for the latest Ubuntu/macOS on Python 3.7--3.10. # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions name: Check Python package @@ -6,6 +6,8 @@ name: Check Python package on: pull_request: branches: [ master ] + push: + branches: [ master ] jobs: build: From 3f735f1f13e5cc23d8985b3888fc2c7e20a89356 Mon Sep 17 00:00:00 2001 From: Ian Waudby-Smith <5490890+WannabeSmith@users.noreply.github.com> Date: Tue, 11 Jan 2022 17:57:30 -0500 Subject: [PATCH 4/6] Update quick-check-python-package.yml --- .github/workflows/quick-check-python-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/quick-check-python-package.yml b/.github/workflows/quick-check-python-package.yml index fe50ba5..3e36538 100644 --- a/.github/workflows/quick-check-python-package.yml +++ b/.github/workflows/quick-check-python-package.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - python-version: ["3.7", "3.10"] + python-version: ["3.7", "3.8", "3.9", "3.10"] steps: - uses: actions/checkout@v2 From c2303f558c01db5b8cd58cf2cfda8f5239543d32 Mon Sep 17 00:00:00 2001 From: Ian Waudby-Smith <5490890+WannabeSmith@users.noreply.github.com> Date: Tue, 11 Jan 2022 17:59:06 -0500 Subject: [PATCH 5/6] Update cibuildwheels-manylinux.yml --- .github/workflows/cibuildwheels-manylinux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cibuildwheels-manylinux.yml b/.github/workflows/cibuildwheels-manylinux.yml index aa11bc0..293f034 100644 --- a/.github/workflows/cibuildwheels-manylinux.yml +++ b/.github/workflows/cibuildwheels-manylinux.yml @@ -35,5 +35,5 @@ jobs: - uses: actions/upload-artifact@v2 with: - name: confseq_wheels + name: confseq_manylinux_wheels path: ./wheelhouse/*.whl From e9bac020ea8fbdffc2013e0815815e563407e66c Mon Sep 17 00:00:00 2001 From: Ian Waudby-Smith <5490890+WannabeSmith@users.noreply.github.com> Date: Tue, 11 Jan 2022 21:02:11 -0500 Subject: [PATCH 6/6] Add functionality for publishing to (Test)PyPi Pre-releases on any branch will get published to TestPyPi. Releases on @gostevehoward's branch will get published to PyPi Also, bump version from 0.0.7 to 0.0.8. --- .github/workflows/build-macos-dist.yml | 43 --------- .github/workflows/build-wheels.yml | 96 +++++++++++++++++++ ...n-package.yml => check-python-package.yml} | 2 +- .github/workflows/cibuildwheels-manylinux.yml | 39 -------- CMakeLists.txt | 2 +- setup.py | 2 +- 6 files changed, 99 insertions(+), 85 deletions(-) delete mode 100644 .github/workflows/build-macos-dist.yml create mode 100644 .github/workflows/build-wheels.yml rename .github/workflows/{quick-check-python-package.yml => check-python-package.yml} (97%) delete mode 100644 .github/workflows/cibuildwheels-manylinux.yml diff --git a/.github/workflows/build-macos-dist.yml b/.github/workflows/build-macos-dist.yml deleted file mode 100644 index 3d04007..0000000 --- a/.github/workflows/build-macos-dist.yml +++ /dev/null @@ -1,43 +0,0 @@ -# Builds the wheels (and source dist) for macOS on Python 3.7--3.10. -# This action is separated from the cibuildwheels-manylinux action because that cannot be parallelized while this is. -# Also, cibuildwheels makes building manylinux wheels much simpler, but macos wheels are straightforward to build via "python -m build". - -name: Build macOS dist - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ${{ matrix.os }} - strategy: - fail-fast: true - matrix: - os: [macos-latest] - python-version: ["3.7", "3.8", "3.9", "3.10"] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - - name: Install boost dependency - run: | - brew install boost - - - name: Build and upload macOS wheels - run: | - python -m pip install build - python -m build - - - uses: actions/upload-artifact@v2 - with: - name: confseq_macos_dist - path: ./dist/confseq-* - diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml new file mode 100644 index 0000000..0b5a729 --- /dev/null +++ b/.github/workflows/build-wheels.yml @@ -0,0 +1,96 @@ +name: Build and publish wheels + +on: + pull_request: + branches: [ master ] + release: + types: [ prereleased, released ] + +jobs: + build_manylinux_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + + steps: + - uses: actions/checkout@v2 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.3.1 + env: + CIBW_BEFORE_ALL_LINUX: "yum install -y boost boost-thread boost-devel && python -m pip install --upgrade pip" + CIBW_ARCHS_LINUX: "auto64" + CIBW_SKIP: "*-musllinux_* cp36-*" +### At the moment, CIBW_TEST seems to not work (the gh-action just hangs with no output at all). Keeping this here +### in case we figure it out later. +# # Install pytest before running CIBW_TEST_COMMAND +# CIBW_TEST_REQUIRES: pytest +# CIBW_TEST_COMMAND: > +# # Run c++ unit tests +# make -C test runtests +# # Run python unit tests, but ignore googletest library +# pytest -m "not random" --ignore=test/googletest-1.8.1/ + + - uses: actions/upload-artifact@v2 + with: + name: confseq_manylinux_wheels + path: ./wheelhouse/*.whl + + build_macos_dist: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [macos-latest] + python-version: ["3.7", "3.8", "3.9", "3.10"] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install boost dependency + run: | + brew install boost + + - name: Build and upload macOS wheels + run: | + python -m pip install build + python -m build + + - uses: actions/upload-artifact@v2 + with: + name: confseq_macos_dist + path: ./dist/confseq-* + + publish: + name: Publish Python distributions to PyPI and TestPyPI + needs: [build_manylinux_wheels, build_macos_dist] + runs-on: ubuntu-latest + + steps: + - name: Download confseq_macos_dist artifact + uses: actions/download-artifact@v2 + with: + name: confseq_macos_dist + path: dist + - name: Download confsesq_manylinux_wheels artifact + uses: actions/download-artifact@v2 + with: + name: confseq_manylinux_wheels + path: dist + - name: Publish distribution to Test PyPI + if: github.event_name == 'release' && github.event.action == 'prereleased' + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + - name: Publish distribution to PyPI + if: github.event_name == 'release' && github.event.action == 'released' && github.repository_owner == 'gostevehoward' + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/quick-check-python-package.yml b/.github/workflows/check-python-package.yml similarity index 97% rename from .github/workflows/quick-check-python-package.yml rename to .github/workflows/check-python-package.yml index 3e36538..8179a4e 100644 --- a/.github/workflows/quick-check-python-package.yml +++ b/.github/workflows/check-python-package.yml @@ -1,7 +1,7 @@ # This workflow will install boost dependencies, lint, and run unit tests for the latest Ubuntu/macOS on Python 3.7--3.10. # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions -name: Check Python package +name: Install, lint, and test Python package on: pull_request: diff --git a/.github/workflows/cibuildwheels-manylinux.yml b/.github/workflows/cibuildwheels-manylinux.yml deleted file mode 100644 index 293f034..0000000 --- a/.github/workflows/cibuildwheels-manylinux.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Build manylinux wheels - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - - steps: - - uses: actions/checkout@v2 - - - name: Build wheels - uses: pypa/cibuildwheel@v2.3.1 - env: - CIBW_BEFORE_ALL_LINUX: "yum install -y boost boost-thread boost-devel && python -m pip install --upgrade pip" - CIBW_ARCHS_LINUX: "auto64" - CIBW_SKIP: "*-musllinux_* cp36-*" -### At the moment, CIBW_TEST seems to not work (the gh-action just hangs with no output at all). Keeping this here -### in case we figure it out later. -# # Install pytest before running CIBW_TEST_COMMAND -# CIBW_TEST_REQUIRES: pytest -# CIBW_TEST_COMMAND: > -# # Run c++ unit tests -# make -C test runtests -# # Run python unit tests, but ignore googletest library -# pytest -m "not random" --ignore=test/googletest-1.8.1/ - - - uses: actions/upload-artifact@v2 - with: - name: confseq_manylinux_wheels - path: ./wheelhouse/*.whl diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fd4b32..43926e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.15...3.19) -project(confseq VERSION "0.0.7") +project(confseq VERSION "0.0.8") # specify the C++ standard set(CMAKE_CXX_STANDARD 14) diff --git a/setup.py b/setup.py index 7302c19..7b0d3df 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ from setuptools import find_packages -__version__ = '0.0.7' +__version__ = '0.0.8' with open("README.md", "r") as fh: long_description = fh.read()