[runtime] Add pacer
Feature
#5139
This file contains hidden or 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
name: Fast | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
merge_group: | |
permissions: | |
contents: read | |
env: | |
CARGO_TERM_COLOR: always | |
UDEPS_VERSION: 0.1.57 | |
NIGHTLY_VERSION: nightly | |
jobs: | |
Lint: | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
flags: "--features commonware-runtime/iouring-storage" | |
- os: ubuntu-latest | |
flags: "--features commonware-runtime/iouring-network" | |
- os: ubuntu-latest | |
flags: "--features commonware-runtime/pacer" | |
- os: ubuntu-latest | |
flags: "" | |
- os: windows-latest | |
flags: "" | |
- os: macos-latest | |
flags: "" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
- name: Install nightly Rust toolchain | |
run: rustup toolchain install ${{ env.NIGHTLY_VERSION }} && rustup component add --toolchain ${{ env.NIGHTLY_VERSION }} rustfmt | |
- name: Run setup | |
uses: ./.github/actions/setup | |
- name: Install just | |
uses: taiki-e/install-action@0c5db7f7f897c03b771660e91d065338615679f4 # v2.60.0 | |
with: | |
tool: [email protected] | |
- name: Fmt | |
run: just check-fmt +${{ env.NIGHTLY_VERSION }} | |
- name: Lint | |
run: just clippy ${{ matrix.flags }} | |
- name: Check docs | |
run: just check-docs ${{ matrix.flags }} | |
Tests: | |
name: "Tests (os: ${{ matrix.os }}, flags: \"${{ matrix.flags }}\") (partition: ${{ matrix.partition }}/2)" | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 60 | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
partition: [1, 2] | |
flags: | |
- "--features commonware-runtime/iouring-storage" | |
- "--features commonware-runtime/iouring-network" | |
- "--features commonware-runtime/pacer" | |
- "--no-default-features" | |
- "" | |
exclude: | |
# Only run io_uring features on Ubuntu | |
- os: windows-latest | |
flags: "--features commonware-runtime/iouring-storage" | |
- os: macos-latest | |
flags: "--features commonware-runtime/iouring-storage" | |
- os: windows-latest | |
flags: "--features commonware-runtime/iouring-network" | |
- os: macos-latest | |
flags: "--features commonware-runtime/iouring-network" | |
# Only run pacer feature on Ubuntu | |
- os: windows-latest | |
flags: "--features commonware-runtime/pacer" | |
- os: macos-latest | |
flags: "--features commonware-runtime/pacer" | |
# Only run --no-default-features on Ubuntu | |
- os: windows-latest | |
flags: "--no-default-features" | |
- os: macos-latest | |
flags: "--no-default-features" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
- name: Run setup | |
uses: ./.github/actions/setup | |
- name: Install just & nextest | |
uses: taiki-e/install-action@0c5db7f7f897c03b771660e91d065338615679f4 # v2.60.0 | |
with: | |
tool: [email protected],[email protected] | |
- name: Run tests | |
run: just test ${{ matrix.flags }} --partition hash:${{matrix.partition}}/2 --verbose | |
- name: Run doc tests | |
run: just test-docs ${{ matrix.flags }} | |
Tests-Gate: | |
name: "Fast-Tests" | |
runs-on: ubuntu-latest | |
needs: Tests | |
if: always() | |
steps: | |
- name: Check test results | |
run: | | |
if [ "${{ needs.Tests.result }}" != "success" ]; then | |
echo "Tests failed or were cancelled" | |
exit 1 | |
fi | |
echo "All tests passed successfully!" | |
Dependencies: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
- name: Install nightly Rust toolchain | |
run: rustup toolchain install ${{ env.NIGHTLY_VERSION }} | |
- name: Get Rust version | |
id: rust-version | |
run: echo "rust_version=$(rustc +${{ env.NIGHTLY_VERSION }} --version)" >> "$GITHUB_OUTPUT" | |
- name: Run setup | |
uses: ./.github/actions/setup | |
- name: Install just & cargo-udeps | |
uses: taiki-e/install-action@0c5db7f7f897c03b771660e91d065338615679f4 # v2.60.0 | |
with: | |
tool: [email protected],cargo-udeps@${{ env.UDEPS_VERSION }} | |
- name: Check for unused dependencies | |
run: just udeps +${{ env.NIGHTLY_VERSION }} | |
Lock: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
- name: Run setup | |
uses: ./.github/actions/setup | |
- name: Build entire workspace | |
run: cargo build --workspace --all-targets | |
- name: Check Cargo.lock unchanged | |
run: | | |
if ! git diff --exit-code Cargo.lock; then | |
echo "ERROR: Cargo.lock was modified during build!" | |
echo "This suggests that the Cargo.lock file in the repository is not up to date." | |
echo "Please run 'cargo build' locally and commit the updated Cargo.lock." | |
exit 1 | |
fi | |
echo "✓ Cargo.lock remained unchanged after building everything" | |
WASM: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
- name: Run setup | |
uses: ./.github/actions/setup | |
- name: Add WASM target | |
run: rustup target add wasm32-unknown-unknown | |
- name: Build cryptography | |
run: cargo build --target wasm32-unknown-unknown --release --manifest-path cryptography/Cargo.toml && du -h target/wasm32-unknown-unknown/release/commonware_cryptography.wasm | |
- name: Build macros | |
run: cargo build --target wasm32-unknown-unknown --release --manifest-path macros/Cargo.toml # can't check size because it is a proc-macro | |
- name: Build utils | |
run: cargo build --target wasm32-unknown-unknown --release --manifest-path utils/Cargo.toml && du -h target/wasm32-unknown-unknown/release/commonware_utils.wasm | |
- name: Build runtime | |
run: cargo build --target wasm32-unknown-unknown --release --manifest-path runtime/Cargo.toml && du -h target/wasm32-unknown-unknown/release/commonware_runtime.wasm | |
- name: Build consensus | |
run: cargo build --target wasm32-unknown-unknown --release --manifest-path consensus/Cargo.toml && du -h target/wasm32-unknown-unknown/release/commonware_consensus.wasm | |
- name: Build storage | |
run: cargo build --target wasm32-unknown-unknown --release --manifest-path storage/Cargo.toml && du -h target/wasm32-unknown-unknown/release/commonware_storage.wasm | |
no_std: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
- name: Run setup | |
uses: ./.github/actions/setup | |
- name: Check no_std compatibility | |
run: ./.github/scripts/check_no_std.sh | |
Unsafe: | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
- name: Run setup | |
uses: ./.github/actions/setup | |
- name: Install miri | |
run: | | |
rustup toolchain install ${{ env.NIGHTLY_VERSION }} --component miri | |
rustup override set ${{ env.NIGHTLY_VERSION }} | |
cargo miri setup | |
- name: Install just | |
uses: taiki-e/install-action@0c5db7f7f897c03b771660e91d065338615679f4 # v2.60.0 | |
with: | |
tool: [email protected] | |
- name: Run miri tests for storage::index | |
run: | | |
cd storage | |
just miri index:: |