Skip to content

Commit 3d02b52

Browse files
authored
Publish pre-built wheels to PyPI (#55)
1 parent beba01f commit 3d02b52

9 files changed

+125
-64
lines changed

.github/workflows/build-wheels.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: build-wheels
2+
3+
on:
4+
push:
5+
branches:
6+
- wheel
7+
tags:
8+
- '*'
9+
10+
concurrency:
11+
group: build-wheels-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
build_wheels:
16+
name: Build wheels on ${{ matrix.os }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-latest, windows-latest, macos-latest]
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
26+
# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
27+
# for a list of versions
28+
- name: Build wheels
29+
uses: pypa/cibuildwheel@v2.11.4
30+
env:
31+
CIBW_SKIP: "cp27-* cp35-* *-win32 pp* *-musllinux*"
32+
CIBW_BUILD_VERBOSITY: 3
33+
34+
- name: Display wheels
35+
shell: bash
36+
run: |
37+
ls -lh ./wheelhouse/
38+
39+
ls -lh ./wheelhouse/*.whl
40+
41+
- uses: actions/upload-artifact@v2
42+
with:
43+
path: ./wheelhouse/*.whl
44+
45+
- name: Publish wheels to PyPI
46+
env:
47+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
48+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
49+
run: |
50+
python3 -m pip install --upgrade pip
51+
python3 -m pip install wheel twine setuptools
52+
53+
twine upload ./wheelhouse/*.whl

.github/workflows/build_conda_macos.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
os: [macos-10.15]
21-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
21+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
2222

2323
steps:
2424
# refer to https://github.com/actions/checkout
@@ -30,6 +30,7 @@ jobs:
3030
with:
3131
auto-update-conda: true
3232
python-version: ${{ matrix.python-version }}
33+
channels: conda-forge
3334
activate-environment: lilcom
3435

3536
- name: Display Python version

.github/workflows/build_conda_ubuntu.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
os: [ubuntu-18.04]
21-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
21+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
2222

2323
steps:
2424
# refer to https://github.com/actions/checkout
@@ -30,6 +30,7 @@ jobs:
3030
with:
3131
auto-update-conda: true
3232
python-version: ${{ matrix.python-version }}
33+
channels: conda-forge
3334
activate-environment: lilcom
3435

3536
- name: Display Python version

.github/workflows/build_conda_windows.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
os: [windows-2019]
21-
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
21+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
2222

2323
steps:
2424
# refer to https://github.com/actions/checkout
@@ -30,6 +30,7 @@ jobs:
3030
with:
3131
auto-update-conda: true
3232
python-version: ${{ matrix.python-version }}
33+
channels: conda-forge
3334
activate-environment: lilcom
3435

3536
- name: Display Python version

.github/workflows/publish_to_pypi.yml

-54
This file was deleted.
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: test-pip-install
2+
3+
on:
4+
push:
5+
branches:
6+
- nightly
7+
schedule:
8+
# minute (0-59)
9+
# hour (0-23)
10+
# day of the month (1-31)
11+
# month (1-12)
12+
# day of the week (0-6)
13+
# nightly test at 22:50 UTC time every day
14+
- cron: "50 22 * * *"
15+
16+
concurrency:
17+
group: test_pip_install-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
test_pip_install:
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
os: [ubuntu-latest, macos-latest, windows-latest]
30+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
31+
32+
steps:
33+
- uses: actions/checkout@v2
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Setup Python ${{ matrix.python-version }}
38+
uses: actions/setup-python@v2
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
42+
- name: Display Python version
43+
run: python -c "import sys; print(sys.version)"
44+
45+
- name: Install lilcom
46+
shell: bash
47+
run: |
48+
pip3 install --verbose lilcom
49+
50+
- name: Run test
51+
shell: bash
52+
run: |
53+
rm -rfv lilcom
54+
python3 -c "import lilcom; print(lilcom.__file__)"
55+
python3 -c "import lilcom_extension; print(lilcom_extension.__file__)"
56+
python3 ./test/test_lilcom.py
57+
python3 ./test/test_speed.py
58+
python3 ./test/test_header.py

CMakeLists.txt

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
22
project(lilcom)
33

44
# Remember to also change the line 3 of ./scripts/conda/lilcom/meta.yaml
5-
set(LILCOM_VERSION "1.5.1")
5+
set(LILCOM_VERSION "1.6")
66

77
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
88
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
@@ -61,12 +61,8 @@ pybind11_add_module(lilcom_extension
6161
)
6262

6363
if(UNIX AND NOT APPLE)
64-
target_link_libraries(lilcom_extension PRIVATE ${PYTHON_LIBRARY})
65-
6664
# Fix https://github.com/lhotse-speech/lhotse/issues/800
6765
target_link_libraries(lilcom_extension PUBLIC "-Wl,-rpath,${LILCOM_RPATH_ORIGIN}/../..")
68-
elseif(WIN32)
69-
target_link_libraries(lilcom_extension PRIVATE ${PYTHON_LIBRARIES})
7066
endif()
7167

7268
if(LILCOM_ENABLE_TESTS)

cmake/cmake_extension.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
from setuptools.command.build_ext import build_ext
1212

1313

14+
def is_for_pypi():
15+
ans = os.environ.get("LILCOM_IS_FOR_PYPI", None)
16+
return ans is not None
17+
18+
1419
def is_macos():
1520
return platform.system() == "Darwin"
1621

@@ -27,7 +32,7 @@ def finalize_options(self):
2732
_bdist_wheel.finalize_options(self)
2833
# In this case, the generated wheel has a name in the form
2934
# sherpa-xxx-pyxx-none-any.whl
30-
if not is_macos():
35+
if is_for_pypi() and not is_macos():
3136
self.root_is_pure = True
3237
else:
3338
# The generated wheel has a name ending with

scripts/conda/lilcom/meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package:
22
name: lilcom
3-
version: "1.5.1"
3+
version: "1.6"
44

55
source:
66
path: "{{ environ.get('LILCOM_ROOT_DIR') }}"

0 commit comments

Comments
 (0)