Skip to content

Commit

Permalink
Merge pull request #135 from supermihi/speed-up-ci
Browse files Browse the repository at this point in the history
Improve CI
  • Loading branch information
supermihi authored Mar 16, 2024
2 parents 2c48070 + 381dbfd commit d78443f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 24 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,22 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-13, macos-14, windows-latest]
runs-on: ${{ matrix.os }}
env:
CIBW_SKIP: "*p36-* *p37-*"
CIBW_ARCHS: auto64
CIBW_ARCHS_MACOS: "x86_64 arm64"
MACOSX_DEPLOYMENT_TARGET: "10.14"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: cache built taglib on windows (very slow)
- name: cache native build artifacts
uses: actions/cache@v4
if: ${{ runner.os == 'Windows' }}
with:
path: build/taglib
key: taglib-windows-${{ hashFiles('build_taglib.py') }}
path: build
key: taglib-${{ matrix.os }}-${{ hashFiles('build_taglib.py') }}
- name: install pip dependencies (Linux)
if: ${{ runner.os == 'Linux' }}
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ a major upgrade of the underlying C++ Taglib library.
- [!123](https://github.com/supermihi/pytaglib/pull/123): upgrade to Taglib 2.0

Thanks to [Urs Fleisch](https://github.com/ufleisch) for help
- [#135](https://github.com/supermihi/pytaglib/pull/135): natively build arm64 wheels on macos-14 runner

## pytaglib 2.1.0 (2023-11-17)

Expand Down
18 changes: 8 additions & 10 deletions build_taglib.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
from argparse import ArgumentParser
from pathlib import Path

is_x64 = sys.maxsize > 2 ** 32
arch = "x64" if is_x64 else "x32"
system = platform.system()
python_version = platform.python_version()
here = Path(__file__).resolve().parent

taglib_version = "2.0"
Expand All @@ -22,20 +19,22 @@
utfcpp_version = "4.0.5"
utfcpp_release = f"https://github.com/nemtrif/utfcpp/archive/refs/tags/v{utfcpp_version}.tar.gz"

sys_identifier = f"{system}-{platform.machine()}-{sys.implementation.name}-{platform.python_version()}"

class Configuration:
def __init__(self):
self.build_path = here / "build"
self.tl_install_dir = self.build_path / "taglib" / f"{system}-{arch}-py{python_version}"
self.build_base = here / "build"
self.build_path = self.build_base / sys_identifier
self.tl_install_dir = self.build_path / "taglib"
self.clean = False

@property
def tl_download_dest(self):
return self.build_path / f"taglib-{taglib_version}.tar.gz"
return self.build_base / f"taglib-{taglib_version}.tar.gz"

@property
def utfcpp_download_dest(self):
return self.build_path / f"utfcpp-{utfcpp_version}.tar.gz"
return self.build_base / f"utfcpp-{utfcpp_version}.tar.gz"

@property
def tl_extract_dir(self):
Expand Down Expand Up @@ -115,8 +114,7 @@ def cmake_config(config: Configuration):
print("running cmake ...")
args = ["-DWITH_ZLIB=OFF"] # todo fix building wheels with zlib support
if system == "Windows":
cmake_arch = "x64" if is_x64 else "Win32"
args += ["-A", cmake_arch]
args += ["-A", "x64"]
elif system == "Linux":
args.append("-DCMAKE_POSITION_INDEPENDENT_CODE=ON")
args.append(f"-DCMAKE_INSTALL_PREFIX={config.tl_install_dir}")
Expand Down Expand Up @@ -165,7 +163,7 @@ def parse_args() -> Configuration:


def run():
print(f"building taglib on {system}, arch {arch}, for python {python_version} ...")
print(f"building taglib on {sys_identifier} ...")
config = parse_args()
tag_lib = (
config.tl_install_dir
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description = "cross-platform, Python audio metadata (\"tagging\") library based
authors = [
{ name = "Michael Helmling", email = "[email protected]" }
]
readme = "Readme.md"
readme = "README.md"
license = { text = "GPLv3+" }
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand Down Expand Up @@ -40,5 +40,5 @@ package-dir = { "" = "src" }
[tool.cibuildwheel]
test-extras = ["tests"]
test-command = "pytest {project}/tests"
before-build = "python build_taglib.py --clean"
before-build = "python build_taglib.py"
skip = "cp36-* cp37-*"
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@
from Cython.Build import cythonize
from setuptools import setup, Extension

is_x64 = sys.maxsize > 2 ** 32
arch = "x64" if is_x64 else "x32"
system = platform.system()
python_version = platform.python_version()
sys_identifier = f"{platform.system()}-{platform.machine()}-{sys.implementation.name}-{platform.python_version()}"
here = Path(__file__).resolve().parent
default_taglib_path = here / "build" / "taglib" / f"{system}-{arch}-py{python_version}"
default_taglib_path = here / "build" / sys_identifier / "taglib"

src = Path("src")

Expand Down

0 comments on commit d78443f

Please sign in to comment.