Skip to content

Commit

Permalink
Publish pre-built wheels to PyPI (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored Jan 10, 2023
1 parent 0d9f7a1 commit 9f75476
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 46 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build-wheels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: build-wheels

on:
push:
branches:
- wheel
tags:
- '*'

concurrency:
group: build-wheels-${{ github.ref }}
cancel-in-progress: true

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2

# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
# for a list of versions
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_SKIP: "cp27-* cp35-* *-win32 pp* *-musllinux*"
CIBW_BUILD_VERBOSITY: 3

- name: Display wheels
shell: bash
run: |
ls -lh ./wheelhouse/
ls -lh ./wheelhouse/*.whl
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse/*.whl

- name: Publish wheels to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
shell: bash
run: |
python3 -m pip install --upgrade pip
python3 -m pip install wheel twine setuptools
twine upload ./wheelhouse/*.whl
3 changes: 2 additions & 1 deletion .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-18.04]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
# refer to https://github.com/actions/checkout
Expand All @@ -25,6 +25,7 @@ jobs:
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
channels: conda-forge
activate-environment: kaldilm

- name: Install conda dependencies
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/publish_to_pypi.yml

This file was deleted.

23 changes: 14 additions & 9 deletions cmake/pybind11.cmake
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
# Copyright (c) 2020 Xiaomi Corporation (author: Fangjun Kuang)

function(download_pybind11)
if(CMAKE_VERSION VERSION_LESS 3.11)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
endif()

include(FetchContent)

set(pybind11_URL "https://github.com/pybind/pybind11/archive/v2.6.0.tar.gz")
set(pybind11_HASH "SHA256=90b705137b69ee3b5fc655eaca66d0dc9862ea1759226f7ccd3098425ae69571")
set(pybind11_URL "https://github.com/pybind/pybind11/archive/refs/tags/v2.10.2.tar.gz")
set(pybind11_HASH "SHA256=93bd1e625e43e03028a3ea7389bba5d3f9f2596abc074b068e70f4ef9b1314ae")

# If you don't have access to the Internet, please download it to your
# local drive and modify the following line according to your needs.
if(EXISTS "/star-fj/fangjun/download/github/pybind11-2.10.2.tar.gz")
set(pybind11_URL "file:///star-fj/fangjun/download/github/pybind11-2.10.2.tar.gz")
elseif(EXISTS "/Users/fangjun/Downloads/pybind11-2.10.2.tar.gz")
set(pybind11_URL "file:///Users/fangjun/Downloads/pybind11-2.10.2.tar.gz")
elseif(EXISTS "/tmp/pybind11-2.10.2.tar.gz")
set(pybind11_URL "file:///tmp/pybind11-2.10.2.tar.gz")
endif()

set(double_quotes "\"")
set(dollar "\$")
set(semicolon "\;")
FetchContent_Declare(pybind11
URL ${pybind11_URL}
URL_HASH ${pybind11_HASH}
PATCH_COMMAND
)

FetchContent_GetProperties(pybind11)
if(NOT pybind11_POPULATED)
message(STATUS "Downloading pybind11")
message(STATUS "Downloading pybind11 from ${pybind11_URL}")
FetchContent_Populate(pybind11)
endif()
message(STATUS "pybind11 is downloaded to ${pybind11_SOURCE_DIR}")
add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR} EXCLUDE_FROM_ALL)
endfunction()

download_pybind11()

0 comments on commit 9f75476

Please sign in to comment.