From 64b73fd3916b01cfaafa6d653cd96d1584bc4aa8 Mon Sep 17 00:00:00 2001 From: Alexander Temerev Date: Mon, 11 Mar 2024 13:11:57 +0100 Subject: [PATCH] [BBPBGLIB-1125] GH forkflow for building a wheel (#121) ## Context Build and upload a PyPI wheel ## Scope New Github actions workflow ## Testing Should see if it works with Github actions ## Review * [X] PR description is complete * [X] Coding style (imports, function length, New functions, classes or files) are good * [N/A] Unit/Scientific test added * [N/A] Updated Readme, in-code, developer documentation --------- Co-authored-by: WeinaJi Co-authored-by: Jorge Blanco Alonso <41900536+jorblancoa@users.noreply.github.com> Co-authored-by: Erik Heeren --- .github/workflows/publish_wheels.yml | 40 ++++++++++++++++++++++++++++ pyproject.toml | 5 ++-- 2 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish_wheels.yml diff --git a/.github/workflows/publish_wheels.yml b/.github/workflows/publish_wheels.yml new file mode 100644 index 00000000..e9e5483e --- /dev/null +++ b/.github/workflows/publish_wheels.yml @@ -0,0 +1,40 @@ +name: Neurodamus Wheels + +on: [pull_request, push, workflow_dispatch] + +jobs: + wheel: + runs-on: ubuntu-22.04 + strategy: + matrix: + python_version: [3.11] + steps: + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python_version }} + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 500 + fetch-tags: true + - name: Build Wheel + run: | + cd $GITHUB_WORKSPACE + python${{ matrix.python_version }} -m pip install --upgrade build + # build wheel + python${{ matrix.python_version }} -m build . + - name: Test Wheel + run: | + cd $GITHUB_WORKSPACE + pip3 install tox + DIST_FILE=`ls dist/*whl` && tox --installpkg=$DIST_FILE -e ${{ matrix.python_version }} + - name: Upload Wheel + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + env: + PYPI_URL: ${{ secrets.PYPI_URL }} + PYPI_USER: ${{ secrets.PYPI_USER }} + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + run: | + pip3 install twine + python${{ matrix.python_version }} -m twine upload --username $PYPI_USER --password $PYPI_TOKEN dist/* diff --git a/pyproject.toml b/pyproject.toml index 39140d52..da80065c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ dependencies = [ "libsonata", "psutil" ] +requires-python=">=3.9" [project.optional-dependencies] plotting=['matplotlib'] # only for Neurodamus HL API @@ -39,14 +40,12 @@ Tracker = "https://github.com/BlueBrain/neurodamus/issues" exclude=["tests"] [tool.setuptools_scm] +local_scheme = "no-local-version" [tool.pytest.ini_options] addopts = "--verbose" markers = ["slow: marks tests as slow"] -[tool.distutils.bdist_wheel] -universal = 1 - [tool.flake8] exclude = [".*", "__pycache__", ".eggs", "*.egg", "build", "dist", "docs", "venv", "*.egg-info", "_benchmarks", "core"] extend-ignore = ["E127", "E221", "E226", "E701", "W503", "W504", "E731", "PT001", "PT023"]