Skip to content

Bump Rust crate to 2.0.8 #73

Bump Rust crate to 2.0.8

Bump Rust crate to 2.0.8 #73

Workflow file for this run

name: Rust bindings
on:
push:
branches:
- main
release:
types: [published]
pull_request:
branches:
- "**"
permissions:
id-token: write
contents: read
jobs:
fuzz_targets:
name: Run fuzzers
runs-on: ubuntu-latest
env:
CARGO_PROFILE_RELEASE_LTO: false
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: Install cargo-fuzz
run: cargo +nightly install cargo-fuzz
- name: Cargo fuzz
run: |
cd rust-bindings
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=600 || exit 255"
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Rustfmt
run: cargo fmt -- --files-with-diff --check
- name: Clippy
run: cargo clippy
test:
name: Test (${{ 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-13-arm64]
intel: [macos-13]
cibw-archs-macos:
arm: arm64
intel: x86_64
- 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
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Tests
run: cargo test && cargo test --release
build_crate:
name: Build crate
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --release
- name: Prepare for publish
run: |
mkdir rust-bindings/cpp
cp -r src lib tests uint128_t python-bindings c-bindings CMakeLists.txt rust-bindings/cpp
- name: Publish to crates.io (dry run)
# We use `--allow-dirty` because the `cpp` folder is copied into the working directory.
# This is necessary because the `cpp` folder is not part of the crate otherwise.
run: cargo publish --dry-run -p chiapos --allow-dirty
- name: Upload crate artifacts
uses: actions/upload-artifact@v4
with:
name: crate
path: ./target/package/*-*.crate
- name: Set Env
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to crates.io
if: env.RELEASE == 'true'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.cargo_registry_token }}
# See comment above for why `--allow-dirty` is used.
run: cargo publish -p chiapos --allow-dirty