Skip to content

Commit

Permalink
Automatically build and upload PyPI packages on release
Browse files Browse the repository at this point in the history
Using Github Actions
  • Loading branch information
dralley committed Feb 17, 2020
1 parent 4ab6b56 commit afad48b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/python_build_and_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Python package build and publish

on: [push]
# release:
# types: [published]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install scikit-build twine
- name: Build Python sdist
run: python3 setup.py sdist
- name: Build manylinux Python wheels
uses: RalfG/python-wheels-manylinux-build@v0.2.1-manylinux2014_x86_64
with:
python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38'
build-requirements: 'scikit-build'
system-packages: 'make cmake bzip2-devel expat-devel file-devel glib2-devel libcurl-devel libmodulemd2-devel libxml2-devel openssl-devel sqlite-devel zchunk-devel zlib-devel xz-devel rpm-devel'
- name: Publish wheels to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload dist/*.tar.gz
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[build-system]
requires = ["setuptools", "wheel", "scikit-build"]
build-backend = "setuptools.build_meta"
9 changes: 2 additions & 7 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ if (NOT SKBUILD)
endif (NOT SKBUILD)

EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_lib(True))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
INCLUDE_DIRECTORIES (${PYTHON_INCLUDE_DIR})
INCLUDE_DIRECTORIES (${PYTHON_INCLUDE_PATH})

MESSAGE(STATUS "Python install dir is ${PYTHON_INSTALL_DIR}")
Expand Down Expand Up @@ -71,14 +72,8 @@ TARGET_LINK_LIBRARIES(_createrepo_c
${CURL_LIBRARY}
)

IF (SKBUILD)
find_package(PythonExtensions REQUIRED)
python_extension_module(_createrepo_c)
ELSE ()
TARGET_LINK_LIBRARIES(_createrepo_c ${PYTHON_LIBRARY})
ENDIF ()

IF (NOT SKBUILD)
TARGET_LINK_LIBRARIES(_createrepo_c ${PYTHON_LIBRARY})
FILE(COPY createrepo_c/__init__.py DESTINATION createrepo_c)
ENDIF()

Expand Down

0 comments on commit afad48b

Please sign in to comment.