-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix source distribution build and upgrade CI baselines (#83)
Summary: Source distributions never had the right version file -- they'd always fail. `bindings/python/.../version.py` is always written out when building an sdist, so try to use it if it's available. Add a CI baseline to try using the sdist/install with KenLM Also move to Jammy for baseline Linux images since most Focal ones are being deprecate and upgrade GHA components depending on old Node versions. v4 of these actions breaks artifact storage with dup names/doesn't merge automatically; fix this. Contents of `dist` post-upload by wheel builder/sdist becomes ``` -rw-r--r-- 1 runner docker 60364 Feb 28 18:47 flashlight-text-0.0.6.dev336.tar.gz -rw-r--r-- 1 runner docker 10395[8](https://github.com/flashlight/text/actions/runs/8085500728/job/22093301914#step:3:9)5 Feb 28 18:47 flashlight_text-0.0.6.dev336-cp312-cp312-macosx_10_[9](https://github.com/flashlight/text/actions/runs/8085500728/job/22093301914#step:3:10)_x86_64.whl -rw-r--r-- 1 runner docker 1304785 Feb 28 18:47 flashlight_text-0.0.6.dev336-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -rw-r--r-- 1 runner docker 1683721 Feb 28 18:47 flashlight_text-0.0.6.dev336-cp312-cp312-musllinux_1_1_x86_64.whl -rw-r--r-- 1 runner docker 496932 Feb 28 18:47 flashlight_text-0.0.6.dev336-cp312-cp312-win_amd64.whl ``` ### Test Plan (required) CI + local test ```bash pipx run build --sdist # move tarball out of git repo where commands to fetch hashes failed cd ${SOURCE_DIST_DIR} # after untarring USE_KENLM=0 pip install -v . ``` ### Checklist - [x] Test coverage - [x] Tests pass - [x] Code formatted - [x] Rebased on latest matter - [x] Code documented Pull Request resolved: #83 Reviewed By: bwasti Differential Revision: D54318442 Pulled By: jacobkahn fbshipit-source-id: a63d5af096178eee83049120a6248bb1bbc698a8
- Loading branch information
1 parent
25494cf
commit bbe9e3c
Showing
5 changed files
with
95 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ macos_env: &macos_env | |
|
||
linux_env: &linux_env | ||
machine: | ||
image: ubuntu-2004:202201-02 | ||
image: ubuntu-2204:current | ||
|
||
orbs: | ||
win: circleci/[email protected] | ||
|
@@ -29,24 +29,39 @@ commands: | |
equal: ["ON", << parameters.use_kenlm >>] | ||
steps: | ||
- run: | ||
name: "Install KenLM Build Dependencies" | ||
name: "Install Build Dependencies (KenLM)" | ||
# TODO: remove boost once https://github.com/kpu/kenlm/pull/418 is merged | ||
command: | | ||
sudo apt -y install libboost-program-options-dev libboost-system-dev libboost-thread-dev \ | ||
libboost-test-dev liblzma-dev libbz2-dev zlib1g-dev | ||
install_macos_build_dependencies: | ||
parameters: | ||
use_kenlm: | ||
type: string | ||
steps: | ||
- run: | ||
name: "Install Build Dependencies" | ||
# TODO: remove boost once https://github.com/kpu/kenlm/pull/418 is merged | ||
command: | | ||
brew install cmake googletest boost zlib bzip2 lzip | ||
command: brew install googletest cmake | ||
- when: | ||
condition: | ||
equal: ["ON", << parameters.use_kenlm >>] | ||
steps: | ||
- run: | ||
name: "Install Build Dependencies (KenLM)" | ||
# TODO: remove boost once https://github.com/kpu/kenlm/pull/418 is merged | ||
command: brew install boost zlib bzip2 lzip | ||
install_msvc_build_dependencies: | ||
parameters: | ||
use_kenlm: | ||
type: string | ||
steps: | ||
- run: | ||
name: "Install Build Dependencies" | ||
command: | | ||
choco install cmake python3 -y | ||
choco install python3 cmake -y | ||
- run: | ||
name: "Install Build Dependencies" | ||
command: choco install cmake -y | ||
# windows needs a path modification | ||
- run: | ||
name: "Set PATH to find CMake" | ||
|
@@ -148,26 +163,33 @@ commands: | |
type: string | ||
default: "ON" | ||
steps: | ||
- run: | ||
name: "Install Python bindings dependencies" | ||
command: pip install wheel numpy cmake | ||
- when: | ||
condition: | ||
equal: ["ON", << parameters.use_kenlm >>] | ||
steps: | ||
- run: | ||
name: "Install KenLM" | ||
command: | | ||
pip install git+https://github.com/kpu/kenlm.git | ||
pip install -v git+https://github.com/kpu/kenlm.git | ||
- run: | ||
name: "Install Python bindings build dependencies" | ||
command: | | ||
pip install setuptools wheel | ||
- run: | ||
name: "Install Python Bindings" | ||
command: USE_KENLM=<< parameters.use_kenlm >> pip install -v . | ||
# Because of KenLM, use --no-build-isolation | ||
command: | | ||
USE_KENLM=<< parameters.use_kenlm >> pip install -v . --no-build-isolation | ||
run_python_tests: | ||
parameters: | ||
use_kenlm: | ||
type: string | ||
default: "ON" | ||
steps: | ||
- run: | ||
name: "Install test dependencies" | ||
command: | | ||
pip install -r bindings/python/test/requirements.txt | ||
- run: | ||
name: "Run Python Binding Tests" | ||
command: | | ||
|
@@ -224,7 +246,7 @@ commands: | |
name: Compute wheel version | ||
command: | | ||
pip install packaging | ||
echo "$(python bindings/python/compute_version.py)" > BUILD_VERSION.txt | ||
python bindings/python/compute_version.py > BUILD_VERSION.txt | ||
echo "Building version $(cat BUILD_VERSION.txt)" | ||
- run: | ||
name: Build wheels | ||
|
@@ -333,7 +355,8 @@ jobs: | |
shell: /bin/bash -eux -o pipefail | ||
steps: | ||
- checkout | ||
- install_macos_build_dependencies | ||
- install_macos_build_dependencies: | ||
use_kenlm: << parameters.use_kenlm >> | ||
- when: | ||
condition: | ||
and: | ||
|
@@ -360,7 +383,8 @@ jobs: | |
shell: /bin/bash -eux -o pipefail | ||
steps: | ||
- checkout | ||
- install_macos_build_dependencies | ||
- install_macos_build_dependencies: | ||
use_kenlm: << parameters.use_kenlm >> | ||
- setup_python_virtualenv: | ||
platform: "macos" | ||
- install_python_bindings: | ||
|
@@ -382,7 +406,8 @@ jobs: | |
size: 2xlarge | ||
steps: | ||
- checkout | ||
- install_msvc_build_dependencies | ||
- install_msvc_build_dependencies: | ||
use_kenlm: "OFF" | ||
- build_flashlight_text: | ||
platform: "windows" | ||
use_kenlm: "OFF" | ||
|
@@ -397,7 +422,8 @@ jobs: | |
shell: bash.exe | ||
steps: | ||
- checkout | ||
- install_msvc_build_dependencies | ||
- install_msvc_build_dependencies: | ||
use_kenlm: << parameters.use_kenlm >> | ||
- setup_python_virtualenv: | ||
platform: "windows" | ||
- install_python_bindings: | ||
|
@@ -479,14 +505,14 @@ workflows: | |
jobs: | ||
- ubuntu_20_gcc_9: | ||
build_shared_libs: "ON" | ||
name: "Ubuntu 20.04 (<< matrix.resource_class >>) gcc-9 kenlm=<< matrix.use_kenlm >> standalone=<< matrix.build_standalone >>" | ||
name: "Ubuntu 22.04 (<< matrix.resource_class >>) gcc-9 kenlm=<< matrix.use_kenlm >> standalone=<< matrix.build_standalone >>" | ||
matrix: | ||
parameters: | ||
resource_class: [xlarge, arm.xlarge] # x64, arm64 | ||
use_kenlm: ["ON", "OFF"] | ||
build_standalone: ["ON", "OFF"] | ||
- ubuntu_20_gcc_9: | ||
name: "Ubuntu 20.04 (xlarge) gcc-9 static + KenLM" | ||
name: "Ubuntu 22.04 (xlarge) gcc-9 static + KenLM" | ||
build_shared_libs: "OFF" | ||
resource_class: xlarge | ||
use_kenlm: "ON" | ||
|
@@ -502,7 +528,7 @@ workflows: | |
parameters: | ||
resource_class: [xlarge, arm.xlarge] | ||
use_kenlm: ["ON", "OFF"] | ||
name: "Ubuntu 20.04 (<< matrix.resource_class >>) gcc-9 Python kenlm=<< matrix.use_kenlm >>" | ||
name: "Ubuntu 22.04 (<< matrix.resource_class >>) gcc-9 Python kenlm=<< matrix.use_kenlm >>" | ||
- macos_clang: | ||
matrix: | ||
parameters: | ||
|
@@ -527,12 +553,12 @@ workflows: | |
build-wheels: | ||
jobs: | ||
- linux_arm64_wheels: | ||
name: "Build Python Wheels | Build wheels on ubuntu-20.04 arm64" | ||
name: "Build Python Wheels | Build wheels on ubuntu-22.04 arm64" | ||
- macos_arm64_wheels: | ||
name: "Build Python Wheels | Build wheels on macOS-14 arm64" | ||
- upload_wheels_pypi: | ||
requires: | ||
- "Build Python Wheels | Build wheels on ubuntu-20.04 arm64" | ||
- "Build Python Wheels | Build wheels on ubuntu-22.04 arm64" | ||
- "Build Python Wheels | Build wheels on macOS-14 arm64" | ||
filters: | ||
branches: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.0.6 | ||
0.0.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters