Skip to content

Commit

Permalink
Add CI and CD for SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
iamalwaysuncomfortable authored Dec 12, 2023
2 parents 61ced55 + 44c8df9 commit 8645c77
Show file tree
Hide file tree
Showing 11 changed files with 527 additions and 287 deletions.
140 changes: 140 additions & 0 deletions .github/workflows/sdk-wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# This file is autogenerated by maturin v1.3.1
# To update, run
#
# maturin generate-ci --platform linux --platform macos --platform windows --manifest-path ./sdk/Cargo.toml --output .github/workflows/sdk-wheels.yml github
#
name: SDK Wheels

on:
push:
paths:
- 'sdk/**'
branches:
- main
- master
tags:
- '*'
pull_request:
paths:
- 'sdk/**'
workflow_dispatch:

permissions:
contents: read

jobs:
tests:
uses: ./.github/workflows/sdk.yml
linux:
needs: [tests]
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, x86]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter --manifest-path ./sdk/Cargo.toml --features openssl/vendored
manylinux: auto
before-script-linux: |
# If we're running on rhel centos, install needed packages.
if command -v yum &> /dev/null; then
yum update -y && yum install -y perl-core libatomic
# If we're running on i686 we need to symlink libatomic
# in order to build openssl with -latomic flag.
if [[ ! -d "/usr/lib64" ]]; then
ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so
fi
fi
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

windows:
needs: [tests]
runs-on: windows-latest
strategy:
matrix:
target: [x64, x86]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: ${{ matrix.target }}
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter --manifest-path ./sdk/Cargo.toml --features openssl/vendored
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

macos:
needs: [tests]
runs-on: macos-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist --find-interpreter --manifest-path ./sdk/Cargo.toml --features openssl/vendored
sccache: 'true'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist

sdist:
needs: [tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build sdist
uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist --manifest-path ./sdk/Cargo.toml
- 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: [linux, windows, macos, sdist]
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: --non-interactive --skip-existing *
48 changes: 48 additions & 0 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: SDK

on:
workflow_call:

jobs:
sdk_check:
name: Check
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sdk
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: fmt
run: cargo fmt --check
- name: clippy
run: cargo clippy -- -D warnings
- uses: jordemort/action-pyright@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: ./sdk
fail_on_error: true
sdk_test:
name: Build & Test
needs: [sdk_check]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sdk
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Build
uses: PyO3/maturin-action@v1
with:
args: --release --features openssl/vendored
working-directory: ./sdk
- name: Test
run: |
python -m venv .env
source .env/bin/activate
maturin develop --release --features openssl/vendored
python test.py
1 change: 1 addition & 0 deletions sdk/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.env/
target/
Loading

0 comments on commit 8645c77

Please sign in to comment.