-
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.
feat(rust): Added PYO3 rust bindings and updated CI/CD.
BREAKING CHANGE: Rust is required.
- Loading branch information
1 parent
9040d00
commit 7d28848
Showing
24 changed files
with
3,171 additions
and
2,263 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,5 @@ | ||
[target.x86_64-apple-darwin] | ||
rustflags = [ | ||
"-C", "link-arg=-undefined", | ||
"-C", "link-arg=dynamic_lookup", | ||
] |
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,184 @@ | ||
name: Version, build, publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
|
||
semantic_release_next_version: | ||
name: Next version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: npm | ||
node-version: 16 | ||
- run: npm install | ||
- run: npx semantic-release --dry-run | ||
id: semantic_release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: semantic-release | ||
path: | | ||
magna/__init__.py | ||
CHANGELOG.md | ||
retention-days: 1 | ||
outputs: | ||
version: ${{ steps.semantic_release.outputs.version }} | ||
|
||
docs_build: | ||
name: Build docs | ||
runs-on: ubuntu-latest | ||
needs: ['semantic_release_next_version'] | ||
steps: | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: semantic-release | ||
- name: Install package requirements | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install . | ||
- name: Install Sphinx requirements | ||
working-directory: docs | ||
run: python -m pip install -r requirements.txt | ||
- name: Build documentation | ||
working-directory: docs | ||
run: | | ||
make html | ||
touch build/html/.nojekyll | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: docs_build | ||
path: docs/build/html/ | ||
retention-days: 1 | ||
|
||
# Update the GitHub pages branch | ||
docs_deploy: | ||
name: Deploy docs | ||
runs-on: ubuntu-latest | ||
needs: ['docs_build'] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: gh-pages | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: docs_build | ||
- name: Upload documentation | ||
run: | | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "GitHub Action" | ||
git add --all | ||
git diff-index --quiet HEAD || git commit -m "docs update" -a | ||
git push | ||
test_rust: | ||
name: Build Rust | ||
needs: semantic_release_next_version | ||
if: needs.semantic_release_next_version.outputs.version != '' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --release --all-features | ||
|
||
build_python_wheels: | ||
name: Python ${{ matrix.pyver }}@${{ matrix.os }}.whl | ||
needs: semantic_release_next_version | ||
if: needs.semantic_release_next_version.outputs.version != '' | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04, macos-11] | ||
pyver: [cp38, cp39, cp310, cp311] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: pypa/cibuildwheel@v2.10.0 | ||
env: | ||
CIBW_BUILD: ${{matrix.pyver}}-* | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: pypi | ||
path: wheelhouse/*.whl | ||
retention-days: 1 | ||
|
||
build_python_dist: | ||
name: Python build *.tar.gz | ||
runs-on: ubuntu-latest | ||
needs: semantic_release_next_version | ||
if: needs.semantic_release_next_version.outputs.version != '' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build sdist | ||
run: pipx run build --sdist | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: pypi | ||
path: dist/*.tar.gz | ||
retention-days: 1 | ||
|
||
test_python_dist: | ||
name: Python test *.tar.gz | ||
runs-on: ubuntu-latest | ||
needs: build_python_dist | ||
steps: | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: pypi | ||
path: dist | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- run: python -m pip install dist/*.tar.gz | ||
- run: python -m unittest discover ./test | ||
|
||
semantic_release_publish: | ||
name: Publish to GitHub | ||
needs: [test_rust, test_python_dist, build_python_wheels] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
cache: npm | ||
node-version: 16 | ||
- run: npm install | ||
- run: npx semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
upload_pypi: | ||
name: Publish to PyPI | ||
needs: [test_rust, test_python_dist, build_python_wheels] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: pypi | ||
path: dist | ||
|
||
- uses: pypa/gh-action-pypi-publish@v1.5 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -139,3 +139,8 @@ node_modules/ | |
|
||
# Local script for running docs | ||
docs.sh | ||
|
||
|
||
# Added by cargo | ||
|
||
/target |
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.