Skip to content

Commit

Permalink
Merge branch 'main' into stubtest
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky committed Sep 5, 2024
2 parents e4c8b02 + fcfae36 commit 49577bd
Show file tree
Hide file tree
Showing 44 changed files with 416 additions and 299 deletions.
71 changes: 0 additions & 71 deletions .github/workflows/build-crate-and-npm.yml

This file was deleted.

104 changes: 104 additions & 0 deletions .github/workflows/build-crate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Rust crate

on:
push:
branches:
- main
tags:
- "**"
pull_request:
branches:
- "**"

jobs:
build_crate:
name: Build crate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy

- name: Fmt
run: cargo fmt --all -- --files-with-diff --check

- name: Clippy
run: cargo clippy --workspace --all-features --all-targets

- name: Tests (debug)
run: cargo test --workspace --all-features

- name: Tests (release)
run: cargo test --workspace --all-features --release

- name: Build (release)
run: cargo build --workspace --all-features --release

- name: Install cargo-workspaces
run: cargo install cargo-workspaces --locked

- name: Publish (dry run)
run: cargo ws publish --publish-as-is --dry-run

- name: Upload crate artifacts
uses: actions/upload-artifact@v4
with:
name: crate
path: ./target/package/*-*.crate

- name: Publish (crates.io)
if: startsWith(github.event.ref, 'refs/tags')
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.cargo_registry_token }}
run: cargo ws publish --publish-as-is

fuzz_tests:
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: Fuzz (chia-consensus)
run: |
cd crates/chia-consensus
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
- name: Fuzz (chia-bls)
env:
# We disable leak reports here because blspy appears to be allocating
# memory that's not freed. It might be a false positive since python is
# not unloaded before exiting.
LSAN_OPTIONS: detect_leaks=0
run: |
cd crates/chia-bls
python -m pip install blspy
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=10 || exit 255"
- name: Fuzz (clvm-utils)
run: |
cd crates/clvm-utils
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
- name: Fuzz (chia-protocol)
run: |
cd crates/chia-protocol
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
- name: Fuzz (chia-puzzles)
run: |
cd crates/chia-puzzles
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
- name: Fuzz (clvm-traits)
run: |
cd crates/clvm-traits
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
43 changes: 43 additions & 0 deletions .github/workflows/build-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: NPM package

on:
push:
branches:
- main
tags:
- "**"
pull_request:
branches:
- "**"

jobs:
build_npm:
name: Build npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable

- name: Install wasm-pack
run: cargo install wasm-pack --locked

- name: WASM build and pack
run: |
cd wasm
wasm-pack build
wasm-pack pack
- name: Upload NPM pkg artifacts
uses: actions/upload-artifact@v4
with:
name: npm-pkg
path: ./wasm/pkg/*-*.tgz

- name: Publish (npmjs.com)
if: startsWith(github.event.ref, 'refs/tags')
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.node_auth_token }}
package: wasm/pkg/package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build - check - upload
name: Python wheels

on:
push:
Expand Down Expand Up @@ -216,23 +216,6 @@ jobs:
python wheel/generate_type_stubs.py
git diff --exit-code
build-tools:
name: build chia-tools
runs-on: ubuntu-latest
steps:
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: cargo build
run: |
cd crates/chia-tools
cargo build
build-sdist:
name: sdist - ${{ matrix.os.name }} ${{ matrix.python.major-dot-minor }} ${{ matrix.arch.name }}
runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
Expand Down Expand Up @@ -307,49 +290,6 @@ jobs:
run: |
cargo clippy --workspace --all-features --all-targets
fuzz_targets:
runs-on: ubuntu-latest
env:
CARGO_PROFILE_RELEASE_LTO: false
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- name: cargo-fuzz
run: cargo +nightly install cargo-fuzz
- name: cargo fuzz (chia-consensus)
run: |
cd crates/chia-consensus
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
- name: cargo fuzz (chia-bls)
env:
# we disable leak reports here because blspy appears to be allocating
# memory that's not freed. It might be a false positive since python is
# not unloaded before exiting
LSAN_OPTIONS: detect_leaks=0
run: |
cd crates/chia-bls
python -m pip install blspy
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=10 || exit 255"
- name: cargo fuzz (clvm-utils)
run: |
cd crates/clvm-utils
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
- name: cargo fuzz (chia-protocol)
run: |
cd crates/chia-protocol
cargo +nightly fuzz build
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
- name: cargo fuzz (chia-puzzles)
run: |
cd crates/chia-puzzles
cargo +nightly fuzz build
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
- name: cargo fuzz (clvm-traits)
run: |
cd crates/clvm-traits
cargo +nightly fuzz build
cargo fuzz list | xargs -I "%" sh -c "cargo +nightly fuzz run % -- -max_total_time=20 || exit 255"
unit_tests:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/check-commit-signing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 🚨 Check commit signing

on:
push:
branches:
- long_lived/**
- main
- release/**
pull_request:
branches:
- "**"

concurrency:
group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }}
cancel-in-progress: true

jobs:
check-commit-signing:
name: Check commit signing
runs-on: [ubuntu-latest]
timeout-minutes: 5

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: chia-network/actions/check-commit-signing@main
14 changes: 0 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,6 @@ repos:
entry: cargo clippy --workspace --all-features --all-targets
language: system
pass_filenames: false
- id: build
name: build
description: run cargo build on the workspace
stages: [pre-push]
entry: cargo build --all-features --workspace
language: system
pass_filenames: false
- id: benchmarks
name: build benchmarks
description: run cargo bench on the workspace
stages: [pre-push]
entry: cargo bench --no-run --workspace --profile dev
language: system
pass_filenames: false
- id: tests
name: run tests
description: run cargo test on the workspace
Expand Down
Loading

0 comments on commit 49577bd

Please sign in to comment.