From e9ece6719566a6f69abe84ed0bc73ca9ab7684fd Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:06:53 +0100 Subject: [PATCH 01/25] Update code so it works on mac ARM Initial version of a build.sh for GitHub actions --- README.md | 7 ++++++- src/lib.rs | 5 +++-- tools/build.sh | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100755 tools/build.sh diff --git a/README.md b/README.md index 14ca2db..d072cf7 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,9 @@ Currently, this only provides text phonemization functions, not invoking full TT On Linux, espeak is statically linked into the built wheel, but there is a runtime dependency on espeak-ng-data. This can be satisfied by `sudo apt install espeak-ng-data` (or the equivalent for your distro). -On Mac the data and necessary shared library can be installed with `brew tap bplevin36/espeak-ng && brew install espeak-ng --without-pcaudiolib --without-waywardgeek-sonic`. You will need to have XCode tools and GNU autotools installed (if they aren't already). +On Mac the data and necessary shared library can be installed with `brew tap bplevin36/espeak-ng && brew install bplevin36/espeak-ng/espeak-ng --without-pcaudiolib --without-waywardgeek-sonic`. You will need to have XCode tools and GNU autotools installed (if they aren't already). + +On macOS under ARM you will need to set `export DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib` for the example to work, due to a failure at import to find the dynamic link as ARM homebrew lib directories aren't in the standard search path. ## Usage Example ``` @@ -26,6 +28,7 @@ On Mac the data and necessary shared library can be installed with `brew tap bpl ## Building Requires Rust (and cargo) as well as GNU autotools and python packages [`maturin`](https://github.com/PyO3/maturin) and `twine` +On Mac GNU autotools can be installed with `brew install libtool automake autoconf` 1. Clone (including submodules) 2. Build espeak-ng in-tree with: @@ -39,3 +42,5 @@ Requires Rust (and cargo) as well as GNU autotools and python packages [`maturin 3. Build wheels with `RUSTFLAGS='-L espeak-ng/src/.libs' maturin build --release` (on Linux this requires the [maturin docker container](https://hub.docker.com/r/konstin2/maturin)) 4. Install to local python with `pip install target/wheels/.whl` 5. Publish to PyPi using `twine` + +tools/build.sh will automate 1-3 for you if you have the correct tools configured, it is designed to work in a GitHub Action. \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 0c1e914..01db6e5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -36,7 +36,8 @@ fn ensure_initialized() -> PyResult<()> { } let try_paths = [ "/usr/lib/x86_64-linux-gnu/espeak-ng-data", // linux apt install location - "/usr/local/Cellar/espeak-ng/1.50/share/espeak-ng-data", // mac brew install location + "/opt/homebrew/Cellar/espeak-ng/1.50/share/espeak-ng-data", // mac ARM brew install location + "/usr/local/Cellar/espeak-ng/1.50/share/espeak-ng-data", // mac x64 brew install location "/usr/local/share/espeak-ng-data", // source install locations "/usr/share/espeak-ng-data", ]; @@ -50,7 +51,7 @@ fn ensure_initialized() -> PyResult<()> { #[cfg(target_os = "macos")] let msg = r#"Error while initializing espeak. If it's not installed, try running: - `brew install anarchivist/espeak-ng/espeak-ng --without-pcaudiolib --without-waywardgeek-sonic`"#; + `brew tap bplevin36/espeak-ng && brew install bplevin36/espeak-ng/espeak-ng --without-pcaudiolib --without-waywardgeek-sonic`"#; #[cfg(target_os = "linux")] let msg = r#"Error while initializing espeak. If you haven't installed the data files, run: `sudo apt install espeak-ng-data`"#; diff --git a/tools/build.sh b/tools/build.sh new file mode 100755 index 0000000..9e31450 --- /dev/null +++ b/tools/build.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e +SCRIPT_DIR=$(cd $(dirname $0); pwd) +PARENT_DIR=$(dirname $SCRIPT_DIR) + + +cd $PARENT_DIR/espeak-ng +touch ChangeLog.md +./autogen.sh +./configure --without-klatt --without-speechplayer --without-mbrola --without-sonic --without-async +make + +cd $PARENT_DIR +RUSTFLAGS='-L espeak-ng/src/.libs' maturin build --release From ba9ded49272d22b7d6d6a159023e1fa01f59bd10 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:34:27 +0100 Subject: [PATCH 02/25] GHA try 1 --- .github/workflows/build.yml | 129 ++++++++++++++++++++++++++++++++++++ pyproject.toml | 2 +- tools/build.sh | 4 -- 3 files changed, 130 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..dd9d04f --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,129 @@ +# This file is autogenerated by maturin v1.7.4 +# To update, run +# +# maturin generate-ci github --platform linux --platform macos +# +# manual edits: +# - to limit the number of ubuntu variants +# - do the rust build step +# - to add the RUSTFLAGS environment variable +# - to specify python version + +name: CI + +on: + push: + branches: + - main + - master + - paulan/new_builds + tags: + - '*' + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + linux: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + python-version: [3.9] + platform: + - runner: ubuntu-latest + target: x86_64 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Build bindings + run: | + tools/build.sh + - name: Build wheels + uses: PyO3/maturin-action@v1 + env: + RUSTFLAGS: -L espeak-ng/src/.libs + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + manylinux: auto + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-linux-${{ matrix.platform.target }} + path: dist + +# macos: +# runs-on: ${{ matrix.platform.runner }} +# strategy: +# matrix: +# python-version: [3.9] +# platform: +# - runner: macos-12 +# target: x86_64 +# - runner: macos-14 +# target: aarch64 +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/setup-python@v5 +# with: +# python-version: ${{ matrix.python-version }} +# - name: Build wheels +# uses: PyO3/maturin-action@v1 +# env: +# RUSTFLAGS: -L espeak-ng/src/.libs +# with: +# target: ${{ matrix.platform.target }} +# args: --release --out dist --find-interpreter +# sccache: 'true' +# - name: Upload wheels +# uses: actions/upload-artifact@v4 +# with: +# name: wheels-macos-${{ matrix.platform.target }} +# path: dist + +# sdist: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v4 +# - name: Build sdist +# uses: PyO3/maturin-action@v1 +# with: +# command: sdist +# args: --out dist +# - name: Upload sdist +# uses: actions/upload-artifact@v4 +# with: +# name: wheels-sdist +# path: dist + +# release: +# name: Release +# runs-on: ubuntu-latest +# if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} +# needs: [linux, macos, sdist] +# permissions: +# # Use to sign the release artifacts +# id-token: write +# # Used to upload release artifacts +# contents: write +# # Used to generate artifact attestation +# attestations: write +# steps: +# - uses: actions/download-artifact@v4 +# - name: Generate artifact attestation +# uses: actions/attest-build-provenance@v1 +# with: +# subject-path: 'wheels-*/*' +# - name: Publish to PyPI +# if: "startsWith(github.ref, 'refs/tags/')" +# uses: PyO3/maturin-action@v1 +# env: +# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} +# with: +# command: upload +# args: --non-interactive --skip-existing wheels-*/* diff --git a/pyproject.toml b/pyproject.toml index f1c43e4..d316afe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["maturin>=0.10,<0.11"] +requires = ["maturin>=1,<2"] build-backend = "maturin" [project] diff --git a/tools/build.sh b/tools/build.sh index 9e31450..2efe8f7 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -3,12 +3,8 @@ set -e SCRIPT_DIR=$(cd $(dirname $0); pwd) PARENT_DIR=$(dirname $SCRIPT_DIR) - cd $PARENT_DIR/espeak-ng touch ChangeLog.md ./autogen.sh ./configure --without-klatt --without-speechplayer --without-mbrola --without-sonic --without-async make - -cd $PARENT_DIR -RUSTFLAGS='-L espeak-ng/src/.libs' maturin build --release From 7f9d31ebd01b697749c09940796e2ff9a365c8f7 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:36:05 +0100 Subject: [PATCH 03/25] debug 1 --- tools/build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/build.sh b/tools/build.sh index 2efe8f7..7628c09 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -3,7 +3,9 @@ set -e SCRIPT_DIR=$(cd $(dirname $0); pwd) PARENT_DIR=$(dirname $SCRIPT_DIR) +echo $PARENT_DIR cd $PARENT_DIR/espeak-ng +ls touch ChangeLog.md ./autogen.sh ./configure --without-klatt --without-speechplayer --without-mbrola --without-sonic --without-async From 2a16c5b70b97968c640a50fc99957396f0c1064e Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:39:56 +0100 Subject: [PATCH 04/25] don't forget git submodules --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd9d04f..6f10c5f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,6 +36,8 @@ jobs: target: x86_64 steps: - uses: actions/checkout@v4 + with: + submodules: true - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} From ac1bebcb3931b04c2ca9682c89e7235d95ecb366 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:49:29 +0100 Subject: [PATCH 05/25] Add some mac to see if it's better --- .github/workflows/build.yml | 61 ++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f10c5f..20db24e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -59,34 +59,39 @@ jobs: name: wheels-linux-${{ matrix.platform.target }} path: dist -# macos: -# runs-on: ${{ matrix.platform.runner }} -# strategy: -# matrix: -# python-version: [3.9] -# platform: -# - runner: macos-12 -# target: x86_64 -# - runner: macos-14 -# target: aarch64 -# steps: -# - uses: actions/checkout@v4 -# - uses: actions/setup-python@v5 -# with: -# python-version: ${{ matrix.python-version }} -# - name: Build wheels -# uses: PyO3/maturin-action@v1 -# env: -# RUSTFLAGS: -L espeak-ng/src/.libs -# with: -# target: ${{ matrix.platform.target }} -# args: --release --out dist --find-interpreter -# sccache: 'true' -# - name: Upload wheels -# uses: actions/upload-artifact@v4 -# with: -# name: wheels-macos-${{ matrix.platform.target }} -# path: dist + macos: + runs-on: ${{ matrix.platform.runner }} + strategy: + matrix: + python-version: [3.9] + platform: + - runner: macos-12 + target: x86_64 + # - runner: macos-14 + # target: aarch64 + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Build bindings + run: | + tools/build.sh + - name: Build wheels + uses: PyO3/maturin-action@v1 + env: + RUSTFLAGS: -L espeak-ng/src/.libs + with: + target: ${{ matrix.platform.target }} + args: --release --out dist --find-interpreter + sccache: 'true' + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: wheels-macos-${{ matrix.platform.target }} + path: dist # sdist: # runs-on: ubuntu-latest From 045a83de0b95bbb37e55ad2554cab60593d0d5da Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:52:25 +0100 Subject: [PATCH 06/25] debugit --- tools/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build.sh b/tools/build.sh index 7628c09..6c8d148 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -5,8 +5,8 @@ PARENT_DIR=$(dirname $SCRIPT_DIR) echo $PARENT_DIR cd $PARENT_DIR/espeak-ng -ls touch ChangeLog.md +ls ./autogen.sh ./configure --without-klatt --without-speechplayer --without-mbrola --without-sonic --without-async make From b2e0a252eec519eb3c857c7819c568abce6789f5 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:00:43 +0100 Subject: [PATCH 07/25] debug2 --- tools/build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/build.sh b/tools/build.sh index 6c8d148..cdf3fee 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -5,7 +5,8 @@ PARENT_DIR=$(dirname $SCRIPT_DIR) echo $PARENT_DIR cd $PARENT_DIR/espeak-ng -touch ChangeLog.md +pwd +touch $PARENT_DIR/espeak-ng/ChangeLog.md ls ./autogen.sh ./configure --without-klatt --without-speechplayer --without-mbrola --without-sonic --without-async From 1e26920e62d50dea8ec91ce01e80112af822f331 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:05:20 +0100 Subject: [PATCH 08/25] Another way to affect changelog --- tools/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/build.sh b/tools/build.sh index cdf3fee..6c7623f 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -5,8 +5,8 @@ PARENT_DIR=$(dirname $SCRIPT_DIR) echo $PARENT_DIR cd $PARENT_DIR/espeak-ng -pwd -touch $PARENT_DIR/espeak-ng/ChangeLog.md +rm CHANGELOG.md +echo "Hi" > ChangeLog.md ls ./autogen.sh ./configure --without-klatt --without-speechplayer --without-mbrola --without-sonic --without-async From c3a93f9195250b29a0c8fcafce245ad8bcfffb56 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:10:16 +0100 Subject: [PATCH 09/25] Remove python version, add macos ARM --- .github/workflows/build.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 20db24e..fcf8118 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,6 @@ jobs: runs-on: ${{ matrix.platform.runner }} strategy: matrix: - python-version: [3.9] platform: - runner: ubuntu-latest target: x86_64 @@ -39,8 +38,6 @@ jobs: with: submodules: true - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - name: Build bindings run: | tools/build.sh @@ -63,19 +60,16 @@ jobs: runs-on: ${{ matrix.platform.runner }} strategy: matrix: - python-version: [3.9] platform: - runner: macos-12 target: x86_64 - # - runner: macos-14 - # target: aarch64 + - runner: macos-14 + target: aarch64 steps: - uses: actions/checkout@v4 with: submodules: true - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - name: Build bindings run: | tools/build.sh From c875a1fc5c46759f185c0b223cc5377ba41beaca Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:13:33 +0100 Subject: [PATCH 10/25] Fix up the fix up for autotools --- tools/build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/build.sh b/tools/build.sh index 6c7623f..d9bafe4 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -6,7 +6,8 @@ PARENT_DIR=$(dirname $SCRIPT_DIR) echo $PARENT_DIR cd $PARENT_DIR/espeak-ng rm CHANGELOG.md -echo "Hi" > ChangeLog.md +echo "Changelog dummy" > ChangeLog.md +echo "No news" > NEWS ls ./autogen.sh ./configure --without-klatt --without-speechplayer --without-mbrola --without-sonic --without-async From 7834d14aec5231c381798875cf13e65705ee092a Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:20:46 +0100 Subject: [PATCH 11/25] macos specific build hacks --- tools/build.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/build.sh b/tools/build.sh index d9bafe4..f604cba 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -5,9 +5,11 @@ PARENT_DIR=$(dirname $SCRIPT_DIR) echo $PARENT_DIR cd $PARENT_DIR/espeak-ng -rm CHANGELOG.md -echo "Changelog dummy" > ChangeLog.md -echo "No news" > NEWS +if [[ "$(uname)" == "Darwin" ]]; then + brew install automake libtool autoconf + rm CHANGELOG.md + echo "Changelog dummy" > ChangeLog.md +fi ls ./autogen.sh ./configure --without-klatt --without-speechplayer --without-mbrola --without-sonic --without-async From 26b113c866b6f574e3a494733d096e116bb81966 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:29:57 +0100 Subject: [PATCH 12/25] limit python issues --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fcf8118..12a0770 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,6 +30,7 @@ jobs: runs-on: ${{ matrix.platform.runner }} strategy: matrix: + python-version: [3.9] platform: - runner: ubuntu-latest target: x86_64 @@ -38,6 +39,8 @@ jobs: with: submodules: true - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - name: Build bindings run: | tools/build.sh @@ -60,6 +63,7 @@ jobs: runs-on: ${{ matrix.platform.runner }} strategy: matrix: + python-version: [3.9] platform: - runner: macos-12 target: x86_64 @@ -70,6 +74,8 @@ jobs: with: submodules: true - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - name: Build bindings run: | tools/build.sh From d379d2cee35a4f3ed385299f822fd01e338bc853 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 18:34:49 +0100 Subject: [PATCH 13/25] Mac Intel on macos-13 runner --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 12a0770..4ee90d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,7 +65,7 @@ jobs: matrix: python-version: [3.9] platform: - - runner: macos-12 + - runner: macos-13 target: x86_64 - runner: macos-14 target: aarch64 From 5917637f7d4a96157b3b4a50abf34d8f96319a5f Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 20:36:18 +0100 Subject: [PATCH 14/25] Set an ubuntu version focal and jammy etc change things --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4ee90d2..4a680fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: matrix: python-version: [3.9] platform: - - runner: ubuntu-latest + - runner: ubuntu-20.04 target: x86_64 steps: - uses: actions/checkout@v4 From c1c8a1623bff13a0a1ed82baf56f49025240b8a9 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 20:53:46 +0100 Subject: [PATCH 15/25] Specify python versions --- .github/workflows/build.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4a680fb..fa08730 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ # - to limit the number of ubuntu variants # - do the rust build step # - to add the RUSTFLAGS environment variable -# - to specify python version +# - to specify python version used by maturin name: CI @@ -30,7 +30,6 @@ jobs: runs-on: ${{ matrix.platform.runner }} strategy: matrix: - python-version: [3.9] platform: - runner: ubuntu-20.04 target: x86_64 @@ -39,8 +38,6 @@ jobs: with: submodules: true - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - name: Build bindings run: | tools/build.sh @@ -50,7 +47,7 @@ jobs: RUSTFLAGS: -L espeak-ng/src/.libs with: target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter + args: --release --out dist --interpreter python3.9 --interpreter python3.11 sccache: 'true' manylinux: auto - name: Upload wheels @@ -63,7 +60,6 @@ jobs: runs-on: ${{ matrix.platform.runner }} strategy: matrix: - python-version: [3.9] platform: - runner: macos-13 target: x86_64 @@ -74,8 +70,6 @@ jobs: with: submodules: true - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - name: Build bindings run: | tools/build.sh @@ -85,7 +79,7 @@ jobs: RUSTFLAGS: -L espeak-ng/src/.libs with: target: ${{ matrix.platform.target }} - args: --release --out dist --find-interpreter + args: --release --out dist --interpreter python3.9 --interpreter python3.11 sccache: 'true' - name: Upload wheels uses: actions/upload-artifact@v4 From 664cec2f9802a65e32e62cf4402630d7ffec463e Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 21:18:57 +0100 Subject: [PATCH 16/25] Fix linux python and add path --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa08730..9e69c51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,7 +47,8 @@ jobs: RUSTFLAGS: -L espeak-ng/src/.libs with: target: ${{ matrix.platform.target }} - args: --release --out dist --interpreter python3.9 --interpreter python3.11 + # only CPython and PyPy (which fail) so specify the full path to the CPythons + args: --release --out dist --interpreter /usr/local/bin/python3.9 --interpreter /usr/local/bin/python3.11 sccache: 'true' manylinux: auto - name: Upload wheels @@ -79,6 +80,7 @@ jobs: RUSTFLAGS: -L espeak-ng/src/.libs with: target: ${{ matrix.platform.target }} + # only CPython, and in different locations, so just specify the executable without path args: --release --out dist --interpreter python3.9 --interpreter python3.11 sccache: 'true' - name: Upload wheels From 5dd4cee7543cfa515aed523977fcbde958bf2613 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 21:31:11 +0100 Subject: [PATCH 17/25] Per arch python versions --- .github/workflows/build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9e69c51..50b03e7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,11 +61,14 @@ jobs: runs-on: ${{ matrix.platform.runner }} strategy: matrix: - platform: + # Fix up the python versions that maturin detects, as some break + platform: - runner: macos-13 target: x86_64 + python_args: --interpreter /usr/local/bin/python3.9 --interpreter /usr/local/bin/python3.11 - runner: macos-14 target: aarch64 + python_args: --interpreter python3.9 --interpreter python3.11 steps: - uses: actions/checkout@v4 with: @@ -80,8 +83,7 @@ jobs: RUSTFLAGS: -L espeak-ng/src/.libs with: target: ${{ matrix.platform.target }} - # only CPython, and in different locations, so just specify the executable without path - args: --release --out dist --interpreter python3.9 --interpreter python3.11 + args: --release --out dist ${{ matrix.platform.python_args }} sccache: 'true' - name: Upload wheels uses: actions/upload-artifact@v4 From b23b7c4c44665f779d73a3b9a762b513fb9e267b Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 21:36:30 +0100 Subject: [PATCH 18/25] try again --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50b03e7..f0fb2c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,7 +65,7 @@ jobs: platform: - runner: macos-13 target: x86_64 - python_args: --interpreter /usr/local/bin/python3.9 --interpreter /usr/local/bin/python3.11 + python_args: --interpreter Users/runner/hostedtoolcache/Python/3.9.20/x64/bin/python3.9 --interpreter /usr/local/bin/python3.11 - runner: macos-14 target: aarch64 python_args: --interpreter python3.9 --interpreter python3.11 From e0f3220e1374f335b616a337d141cb37683f5dfa Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 21:39:17 +0100 Subject: [PATCH 19/25] and again --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0fb2c2..f37b7c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,7 +65,7 @@ jobs: platform: - runner: macos-13 target: x86_64 - python_args: --interpreter Users/runner/hostedtoolcache/Python/3.9.20/x64/bin/python3.9 --interpreter /usr/local/bin/python3.11 + python_args: --interpreter /Users/runner/hostedtoolcache/Python/3.9.20/x64/bin/python3.9 --interpreter /usr/local/bin/python3.11 - runner: macos-14 target: aarch64 python_args: --interpreter python3.9 --interpreter python3.11 From 18d4df0c97e33a7baaa61fe7e925c1cd36927dd3 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Fri, 4 Oct 2024 21:45:19 +0100 Subject: [PATCH 20/25] Return sdist and special branch tagging --- .github/workflows/build.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f37b7c2..834bc1e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,6 @@ on: branches: - main - master - - paulan/new_builds tags: - '*' pull_request: @@ -91,21 +90,6 @@ jobs: name: wheels-macos-${{ matrix.platform.target }} path: dist -# sdist: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - name: Build sdist -# uses: PyO3/maturin-action@v1 -# with: -# command: sdist -# args: --out dist -# - name: Upload sdist -# uses: actions/upload-artifact@v4 -# with: -# name: wheels-sdist -# path: dist - # release: # name: Release # runs-on: ubuntu-latest From 6275820bb73961e2cbace48ce29947993d80de77 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:03:02 +0100 Subject: [PATCH 21/25] Fix up triggers and Ubuntu version --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 834bc1e..d2b4bd7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,12 +14,11 @@ name: CI on: push: branches: - - main - master tags: - '*' pull_request: - workflow_dispatch: + workflow_call: permissions: contents: read @@ -30,7 +29,7 @@ jobs: strategy: matrix: platform: - - runner: ubuntu-20.04 + - runner: ubuntu-22.04 target: x86_64 steps: - uses: actions/checkout@v4 From 43886f967bc18938d2ed9d17cba9f1d8ce6cc781 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:37:24 +0100 Subject: [PATCH 22/25] Update configure settings for build --- tools/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build.sh b/tools/build.sh index f604cba..f78fcb4 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -12,5 +12,5 @@ if [[ "$(uname)" == "Darwin" ]]; then fi ls ./autogen.sh -./configure --without-klatt --without-speechplayer --without-mbrola --without-sonic --without-async +./configure --without-klatt --without-pcaudiolib --without-mbrola --without-sonic --without-async make From d8aa2bbb2a29d2ed77a4f9ea6827566d5ba3cefc Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:49:57 +0100 Subject: [PATCH 23/25] Try and fix ubuntu by C gcc flag --- tools/build.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/build.sh b/tools/build.sh index f78fcb4..ecf31a6 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -13,4 +13,8 @@ fi ls ./autogen.sh ./configure --without-klatt --without-pcaudiolib --without-mbrola --without-sonic --without-async + +# Fix error on Ubuntu 22.04+ +# See https://stackoverflow.com/questions/76060903/gcc-multiple-definition-of-error-on-ubuntu-22-04-after-updating-from-ubuntu-2 +export CFLAGS="-fcommon" make From 1b6fd613cbfdea3d283a941c01af5b8314180f51 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:52:06 +0100 Subject: [PATCH 24/25] Try again --- tools/build.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/build.sh b/tools/build.sh index ecf31a6..b6bae24 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -11,10 +11,11 @@ if [[ "$(uname)" == "Darwin" ]]; then echo "Changelog dummy" > ChangeLog.md fi ls -./autogen.sh -./configure --without-klatt --without-pcaudiolib --without-mbrola --without-sonic --without-async # Fix error on Ubuntu 22.04+ # See https://stackoverflow.com/questions/76060903/gcc-multiple-definition-of-error-on-ubuntu-22-04-after-updating-from-ubuntu-2 export CFLAGS="-fcommon" + +./autogen.sh +./configure --without-klatt --without-pcaudiolib --without-mbrola --without-sonic --without-async make From 2dd7e40fbe80f46f0a5f20527efa42da557ee616 Mon Sep 17 00:00:00 2001 From: Paul Annetts <5033948+paulannetts@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:31:33 +0100 Subject: [PATCH 25/25] Use publish flow to match other pypis --- .github/workflows/build.yml | 29 ----------------------------- .github/workflows/publish.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2b4bd7..081a5a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,8 +15,6 @@ on: push: branches: - master - tags: - - '*' pull_request: workflow_call: @@ -88,30 +86,3 @@ jobs: with: name: wheels-macos-${{ matrix.platform.target }} path: dist - -# release: -# name: Release -# runs-on: ubuntu-latest -# if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} -# needs: [linux, macos, sdist] -# permissions: -# # Use to sign the release artifacts -# id-token: write -# # Used to upload release artifacts -# contents: write -# # Used to generate artifact attestation -# attestations: write -# steps: -# - uses: actions/download-artifact@v4 -# - name: Generate artifact attestation -# uses: actions/attest-build-provenance@v1 -# with: -# subject-path: 'wheels-*/*' -# - name: Publish to PyPI -# if: "startsWith(github.ref, 'refs/tags/')" -# uses: PyO3/maturin-action@v1 -# env: -# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} -# with: -# command: upload -# args: --non-interactive --skip-existing wheels-*/* diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..fc5944e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,31 @@ +name: Publish Wheels + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + run-build-workflow: + uses: ./.github/workflows/build.yml + + pypi-publish: + name: Publish to PyPi + needs: run-build-workflow + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: wheels-* + merge-multiple: true + path: dist/ + - name: List artifacts downloaded + run: ls -R dist + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1.8