-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move fennel_data_lib into a seperate pypi
- Loading branch information
1 parent
f6d0fd3
commit bbe720d
Showing
5 changed files
with
1,299 additions
and
1,045 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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
name: CI | ||
|
||
on: | ||
# These tests are quite cheap, run them on every PR | ||
pull_request: | ||
branches: [ main ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
linux: | ||
runs-on: ${{ matrix.platform.runner }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- runner: ubuntu-latest | ||
target: x86_64 | ||
- runner: ubuntu-latest | ||
target: x86 | ||
- runner: ubuntu-latest | ||
target: aarch64 | ||
- runner: ubuntu-latest | ||
target: armv7 | ||
- runner: ubuntu-latest | ||
target: s390x | ||
- runner: ubuntu-latest | ||
target: ppc64le | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: 'fennel-ai/server' | ||
token: ${{ secrets.SERVER_CHECKOUT }} | ||
path: 'server' | ||
ref: 'main' | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
args: --release --out dist --manifest-path server/fennel_data_lib/Cargo.toml --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: | ||
platform: | ||
- runner: macos-latest | ||
target: x86_64 | ||
- runner: macos-14 | ||
target: aarch64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: 'fennel-ai/server' | ||
token: ${{ secrets.SERVER_CHECKOUT }} | ||
path: 'server' | ||
ref: 'main' | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.10' | ||
- name: Build wheels | ||
uses: PyO3/maturin-action@v1 | ||
with: | ||
target: ${{ matrix.platform.target }} | ||
args: --release --out dist --manifest-path server/fennel_data_lib/Cargo.toml --find-interpreter | ||
sccache: 'true' | ||
- name: Upload wheels | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: wheels-macos-${{ matrix.platform.target }} | ||
path: dist | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
if: "startsWith(github.ref, 'refs/tags/')" | ||
needs: [linux, macos] | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
- name: Publish to PyPI | ||
uses: PyO3/maturin-action@v1 | ||
env: | ||
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_PACKAGR_ACCESS_TOKEN }} | ||
with: | ||
command: upload | ||
args: --non-interactive --skip-existing wheels-*/* |
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,89 +1,86 @@ | ||
name: Build, Test, and Publish | ||
name: Packagr Publish | ||
|
||
# Controls when the workflow will run | ||
on: | ||
# Triggers the workflow on push but only for the main branch | ||
push: | ||
branches: [ main ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
build-and-publish: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
name: Build, Test, and Publish Package | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
name: Run tests and publish latest version if succcessful | ||
steps: | ||
# Checkout the Python client repository | ||
- name: Check out client repository (Python) | ||
uses: actions/checkout@v2 | ||
|
||
# Checkout the Rust server repository | ||
- name: Check out server repository (Rust) | ||
#---------------------------------------------- | ||
# check-out repo and set-up python | ||
#---------------------------------------------- | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: 'fennel-ai/server' | ||
token: ${{ secrets.SERVER_CHECKOUT }} | ||
path: 'server' | ||
ref: 'main' | ||
|
||
# Set up Python environment | ||
- name: Set up Python | ||
- name: Set up python | ||
id: setup-python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.12 | ||
|
||
# Install Poetry | ||
#---------------------------------------------- | ||
# ----- install & configure poetry ----- | ||
#---------------------------------------------- | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
# Load cached Python virtual environment if it exists | ||
#---------------------------------------------- | ||
# load cached venv if cache exists | ||
#---------------------------------------------- | ||
- name: Load cached venv | ||
id: cached-poetry-dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: .venv | ||
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
# Install Python dependencies if the cache does not exist | ||
|
||
#---------------------------------------------- | ||
# install dependencies if cache does not exist | ||
#---------------------------------------------- | ||
- name: Install dependencies | ||
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
|
||
# Set up Rust toolchain | ||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
default: true | ||
|
||
# Install protobuf compiler (protoc) | ||
- name: Install protobuf compiler (protoc) | ||
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | ||
|
||
# Install Maturin to build the package | ||
- name: Install Maturin | ||
run: python -m pip install maturin | ||
|
||
# Build the package using Maturin | ||
- name: Build the package using Maturin | ||
run: maturin build --release --features "extension-module" --manifest-path ./server/fennel_data_lib/Cargo.toml --out dist | ||
|
||
# Install the built package | ||
- name: Install built package | ||
run: | | ||
source .venv/bin/activate | ||
python -m pip install dist/*.whl | ||
python -c "import fennel_data_lib" | ||
#---------------------------------------------- | ||
# install your root project, if required | ||
#---------------------------------------------- | ||
- name: Install library | ||
run: poetry install --no-interaction | ||
|
||
# Run Python tests | ||
# Run test suite | ||
- name: Run tests | ||
run: | | ||
source .venv/bin/activate | ||
pytest fennel --run_slow | ||
poetry run pytest . --run_slow | ||
poetry run python -m unittest discover fennel | ||
# Publish the package to PyPI if all tests pass | ||
- name: Publish to PyPI | ||
#---------------------------------------------- | ||
# publish to pypi - this is run only if the previous steps are successful | ||
#---------------------------------------------- | ||
- name: Publish to Pypi | ||
run: | | ||
rm -rf dist/* | ||
pip install setuptools wheel twine | ||
poetry build | ||
twine upload --repository pypi dist/* --verbose -u __token__ -p ${{ secrets.PYPI_PACKAGR_ACCESS_TOKEN }} | ||
|
||
|
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
Oops, something went wrong.