-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from Chia-Network/rust-bindings
Add Rust bindings
- Loading branch information
Showing
13 changed files
with
1,073 additions
and
2 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,113 @@ | ||
name: Rust bindings | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: [published] | ||
pull_request: | ||
branches: | ||
- "**" | ||
|
||
concurrency: | ||
# SHA is added to the end if on `main` to let all main workflows run | ||
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Build - ${{ matrix.os.name }} ${{ matrix.arch.name }} | ||
runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- name: macOS | ||
matrix: macos | ||
runs-on: | ||
arm: [macOS, ARM64] | ||
intel: [macos-latest] | ||
- name: Ubuntu | ||
matrix: ubuntu | ||
runs-on: | ||
arm: [Linux, ARM64] | ||
intel: [ubuntu-latest] | ||
- name: Windows | ||
matrix: windows | ||
runs-on: | ||
intel: [windows-latest] | ||
arch: | ||
- name: ARM | ||
matrix: arm | ||
- name: Intel | ||
matrix: intel | ||
exclude: | ||
- os: | ||
name: Windows | ||
matrix: windows | ||
runs-on: | ||
intel: [windows-latest] | ||
arch: | ||
name: ARM | ||
matrix: arm | ||
defaults: | ||
run: | ||
working-directory: ./rust-bindings | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set Env | ||
uses: Chia-Network/actions/setjobenv@main | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install Clang on Ubuntu ARM | ||
if: matrix.os.name == 'Ubuntu' && matrix.arch.name == 'ARM' | ||
run: sudo apt-get install -y clang | ||
|
||
- name: Set up Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt, clippy | ||
|
||
- name: Build | ||
run: cargo build --release | ||
|
||
- name: Test | ||
run: cargo test | ||
|
||
- name: Test (Release) | ||
run: cargo test --release | ||
|
||
- name: Check formatting | ||
run: cargo fmt -- --check | ||
|
||
- name: Check clippy | ||
run: cargo clippy --all-targets --all-features -- -D warnings | ||
|
||
- name: Create release | ||
continue-on-error: true | ||
if: env.RELEASE == 'true' | ||
env: | ||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
run: cargo publish | ||
|
||
fuzz_targets: | ||
name: Run Fuzzer | ||
runs-on: ubuntu-latest | ||
env: | ||
CARGO_PROFILE_RELEASE_LTO: false | ||
defaults: | ||
run: | ||
working-directory: ./rust-bindings | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dtolnay/rust-toolchain@nightly | ||
|
||
- name: cargo-fuzz | ||
run: cargo +nightly install cargo-fuzz | ||
|
||
- name: cargo fuzz | ||
run: | | ||
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=120 || exit 255" |
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,2 +1,9 @@ | ||
.mypy_cache | ||
*.egg-info | ||
*.whl | ||
.vscode | ||
/dist | ||
/venv | ||
/build | ||
/var | ||
__pycache__ |
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 @@ | ||
/target |
Oops, something went wrong.