Merge pull request #20 from Oxen-AI/fix/python-deps #33
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 is autogenerated by maturin v0.14.17 | |
# To update, run | |
# | |
# maturin generate-ci github | |
# | |
name: CI | |
on: | |
push: | |
branches: | |
- main | |
- master | |
tags: | |
- '*' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: "Build on ${{ matrix.platform.name }} with Python ${{ matrix.python.version }}" | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
matrix: | |
python: [ | |
# { | |
# name: "cp37-cp37m", | |
# version: "3.7" | |
# }, | |
# { | |
# name: "cp38-cp38", | |
# version: "3.8" | |
# }, | |
# { | |
# name: "cp39-cp39", | |
# version: "3.9" | |
# }, | |
{ | |
name: "cp310-cp310", | |
version: "3.10" | |
}, | |
] | |
rust: [stable] | |
platform: [ | |
# { | |
# os: "ubuntu-latest", | |
# python-architecture: "x64", | |
# rust-target: "x86_64-unknown-linux-gnu", | |
# name: "Linux x64" | |
# }, | |
{ | |
os: "ubuntu-latest", | |
python-architecture: "x64", | |
rust-target: "x86_64-unknown-linux-gnu", | |
name: "Linux sdist" | |
}, | |
{ | |
os: "macos-13", | |
python-architecture: "x64", | |
rust-target: "aarch64-apple-darwin", | |
name: "macOS arm64" | |
}, | |
{ | |
os: "macos-13", | |
python-architecture: "x64", | |
rust-target: "x86_64-apple-darwin", | |
name: "macOS x64" | |
}, | |
# { | |
# os: "windows-latest", | |
# python-architecture: "x86", | |
# rust-target: "i686-pc-windows-msvc", | |
# name: "Windows x86" | |
# }, | |
{ | |
os: "windows-latest", | |
python-architecture: "x64", | |
rust-target: "x86_64-pc-windows-msvc", | |
name: "Windows x64" | |
}, | |
] | |
fail-fast: false | |
env: | |
CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-${{ matrix.platform.python-architecture }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.platform.python-architecture }}-cargo-${{ matrix.rust }}- | |
- name: Install Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python.version }} | |
architecture: ${{ matrix.platform.python-architecture }} | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
target: ${{ matrix.platform.rust-target }} | |
default: true | |
profile: minimal | |
override: true | |
- name: Install CLang | |
uses: KyleMayes/install-llvm-action@v1 | |
with: | |
version: "15.0" | |
directory: ${{ runner.temp }}/llvm | |
- name: Set LIBCLANG_PATH | |
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> ${GITHUB_ENV} | |
if: runner.os == 'Windows' | |
- name: Install dependencies | |
run: pip install maturin pygithub | |
- name: Build package Linux | |
env: | |
PY_VERSION: ${{ matrix.python.name }} | |
run: cd oxen && maturin build --out dist --release --interpreter ${PY_LOCATION}/bin/python | |
if: runner.os == 'Linux' | |
- name: Build package macOS x86 | |
env: | |
PY_LOCATION: ${{ env.pythonLocation }} | |
CXXFLAGS: "-fno-aligned-allocation" | |
CPLUS_INCLUDE_PATH: ${{ runner.temp }}/llvm/include/c++/v1/ | |
run: cd oxen && maturin build --out dist --release --interpreter ${PY_LOCATION}/bin/python | |
if: matrix.platform.rust-target == 'x86_64-apple-darwin' | |
- name: Build package macOS arm64 | |
env: | |
PY_LOCATION: ${{ env.pythonLocation }} | |
run: cd oxen && maturin build --out dist --release --interpreter ${PY_LOCATION}/bin/python | |
if: matrix.platform.rust-target == 'aarch64-apple-darwin' | |
- name: Build package Windows | |
env: | |
PY_LOCATION: ${{ env.pythonLocation }} | |
run: cd oxen && maturin build --out dist --release --interpreter ${env:PY_LOCATION}\python.exe | |
if: runner.os == 'Windows' | |
- name: Build package sdist | |
env: | |
PY_LOCATION: ${{ env.pythonLocation }} | |
run: cd oxen && maturin build --out dist | |
if: matrix.platform.name == 'Linux sdist' | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: oxen/dist | |
# sdist: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Build sdist | |
# uses: PyO3/maturin-action@v1 | |
# with: | |
# command: sdist | |
# args: --out dist | |
# working-directory: oxen | |
# - name: Upload sdist | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: wheels | |
# path: dist | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/')" | |
needs: [build] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- name: Publish to PyPI | |
uses: PyO3/maturin-action@v1 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
with: | |
command: upload | |
args: --skip-existing * |