Python Rust Mixed Project Build Test
ActionsTags
(2)python-rust-mix-build
is a GitHub Action that checks if the Python-Rust mix project passes build or not.
Test case usage for python-rust-mix-build
.
name: Build Test
on: [push]
jobs:
Test:
runs-on: ubuntu-latest # multiple can be added
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Run Build Test
uses: d33p0st/python-rust-mix-build@v1
with:
python-version: 3.9 # set python version. default: 3.12
miniconda-version: # set miniconda version. default: "latest"
For this action to work on your Python-Rust mix project, make sure you have Cargo.toml
and pyproject.toml
intact and follows the proper rules.
For Example, the following entries should be there in your Cargo.toml
[lib]
crate-type = ["cdylib"]
[build-dependencies]
cc = "1.0"
Note: This will not work in pure rust or pure python projects. Make sure you are using
pyo3
crate in rust to create binaries that can be called from a python script or file. Additionaly,maturin
is being used to test the build which meanspyproject.toml
should have an entry about it.
A demo
pyproject.toml
andCargo.toml
is provided here.
python-rust-mix-build
has three inputs:
-
python-version
: specify the python version. Default is3.12
-
miniconda-version
: specify the miniconda version to use asmaturin
needs either venv or miniconda to work. Default is"latest"
-
replace
: Takes boolean values. Default isfalse
. This builds and pushes that built binary back to the repository.For this to work, add an addition line to your workflow file:
permissions: write-all
-
GH_TOKEN
: This takes GITHUB API TOKEN as input, ifpermissions: write-all
line is provided, The action will automatically get the GITHUB TOKEN from your account. However, If not provided,GH_TOKEN
needs to be set with proper permissions.
You need to pull auto-generated commits in case of using replace
input, Else your repo will mess up.
Feel free to submit any issues here.
Create any relevant pull requests here.
Python Rust Mixed Project Build Test is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.