chore(deps): bump tokio-metrics from 0.4.7 to 0.4.9 #6392
Workflow file for this run
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
| on: [push, pull_request] | |
| name: Continuous integration | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dsherret/rust-toolchain-file@v1 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: check-${{ runner.os }} | |
| - run: | | |
| make check | |
| make check-migrate | |
| make check-dirty-rpc-doc | |
| cargo-shear: | |
| name: Cargo Shear | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dsherret/rust-toolchain-file@v1 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: shear-${{ runner.os }} | |
| - uses: cargo-bins/cargo-binstall@main | |
| - run: | | |
| cargo binstall --no-confirm cargo-shear --force --locked --version 1.1.9 | |
| cargo shear | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dsherret/rust-toolchain-file@v1 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: test-${{ runner.os }} | |
| - uses: taiki-e/install-action@v2 | |
| with: | |
| tool: nextest | |
| - name: Run tests | |
| run: | | |
| RUST_BACKTRACE=full RUST_LOG=trace,fnn=trace,fnn::cch::actor::tracker=off,fnn::fiber::gossip=off,tentacle=off,tokio_yamux=off,tentacle_secio=off cargo nextest run --no-fail-fast | |
| env: | |
| RUST_TEST_THREADS: 2 | |
| fmt: | |
| name: Rustfmt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dsherret/rust-toolchain-file@v1 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: fmt-${{ runner.os }} | |
| - run: cargo fmt --all -- --check | |
| clippy: | |
| name: Clippy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dsherret/rust-toolchain-file@v1 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: clippy-${{ runner.os }} | |
| - run: | | |
| rustup target add wasm32-unknown-unknown | |
| make clippy | |
| typos: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check for typos | |
| uses: crate-ci/typos@v1.39.0 | |
| - name: Typos info | |
| if: failure() | |
| run: | | |
| echo 'To fix typos, please run `cargo install typos && typos -w`' | |
| echo 'To check for a diff, run `typos`' | |
| echo 'You can find typos here: https://crates.io/crates/typos' | |
| echo 'if you use VSCode, you can also install `Typos Spell Checker' | |
| echo 'You can find the extension here: https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode' | |
| coverage: | |
| name: Code Coverage | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dsherret/rust-toolchain-file@v1 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: coverage-${{ runner.os }} | |
| - name: Install Grcov | |
| run: make coverage-install-tools | |
| - name: Generate Code Coverage Report of Unit Tests | |
| run: | | |
| make coverage-run-unittests | |
| make coverage-collect-data | |
| - name: Upload Code Coverage Report of Unit Tests | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: coverage-report.info | |
| env_vars: OS,RUST_TOOLCHAIN | |
| fail_ci_if_error: false | |
| flags: unittests | |
| verbose: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| build: | |
| name: Build | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| profile: [dev, release] | |
| if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dsherret/rust-toolchain-file@v1 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: build-${{ matrix.os }}-${{ matrix.profile }} | |
| - name: Install Dependencies (Windows) | |
| if: contains(matrix.os, 'windows') | |
| run: | | |
| vcpkg integrate install | |
| vcpkg install openssl:x64-windows-static-md | |
| - name: Build with profile | |
| run: cargo build --locked --verbose --profile ${{ matrix.profile }} | |
| benchmark: | |
| name: Benchmark | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 90 | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - uses: dsherret/rust-toolchain-file@v1 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Setup Dependencies | |
| uses: ./.github/actions/setup-dependencies | |
| with: | |
| ckb-version: '0.202.0' | |
| cache-prefix: 'benchmark' | |
| - name: Cache build artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ./tests/deploy/udt-init/target | |
| ./tests/perf/target | |
| key: build-artifacts-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| build-artifacts-${{ runner.os }}- | |
| - name: Build rust code | |
| run: | | |
| cd ./tests/deploy/udt-init && cargo build --locked && cd - | |
| cd ./tests/perf/ && cargo build --release --locked && cd - | |
| - name: Run baseline benchmark | |
| run: | | |
| echo "Comparing against: origin/${{ github.base_ref }}" | |
| git checkout origin/${{ github.base_ref }} | |
| export ON_GITHUB_ACTION=y | |
| CKB_LOG=warn TEST_ENV=release ./tests/nodes/start.sh > baseline.log 2>&1 & | |
| ./tests/nodes/wait.sh | |
| cd ./tests/perf/ | |
| cargo run --bin run-test --release integration | |
| cargo run --bin run-test --release benchmark 90 30 base | |
| cd - | |
| git stash | |
| - name: Run current benchmark | |
| run: | | |
| echo "Running benchmark on current PR commit: ${{ github.sha }}" | |
| git checkout ${{ github.sha }} | |
| pkill -f 'fnn|ckb run|npm' || true | |
| rm -rf ./tests/nodes/.ports | |
| export ON_GITHUB_ACTION=y | |
| REMOVE_OLD_STATE=y CKB_LOG=warn TEST_ENV=release ./tests/nodes/start.sh > current.log 2>&1 & | |
| ./tests/nodes/wait.sh | |
| cd ./tests/perf/ | |
| cargo run --bin run-test --release integration | |
| cargo run --bin run-test --release benchmark 90 30 compare | |
| cd - | |
| - name: Upload benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: benchmark-results | |
| path: | | |
| ./baseline.log | |
| ./current.log | |
| ./tests/perf/comparison_report.txt | |
| ./tests/perf/baseline.json | |
| ./tests/perf/current.json | |
| - name: Check benchmark result | |
| run: | | |
| echo "Check benchmark result on current PR commit: ${{ github.sha }}" | |
| if [ -f "./tests/perf/comparison_report.txt" ]; then | |
| if grep -q "Performance regression detected" "./tests/perf/comparison_report.txt"; then | |
| echo "❌ Performance regression detected! Failing the workflow." | |
| exit 1 | |
| else | |
| echo "✅ No performance regression detected." | |
| fi | |
| else | |
| echo "⚠️ Comparison report not found at ./tests/perf/comparison_report.txt" | |
| echo "This might indicate a benchmark execution failure." | |
| exit 1 | |
| fi | |
| payment-benchmark: | |
| name: Payment Benchmark | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| if: false # temporarily disabled | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: dsherret/rust-toolchain-file@v1 | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: payment-bench-${{ runner.os }} | |
| - name: Install jq | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y jq | |
| - name: Run payment benchmarks baseline | |
| run: | | |
| echo "Running payment benchmarks baseline: origin/${{ github.base_ref }}" | |
| git checkout origin/${{ github.base_ref }} | |
| cargo bench -p fnn --features bench --bench payment_benchmarks -- find_path_200n_2000c --save-baseline base | |
| rm -rf /tmp/criterion-baseline | |
| mkdir -p /tmp/criterion-baseline | |
| cp -R target/criterion /tmp/criterion-baseline | |
| - name: Run payment benchmarks current | |
| run: | | |
| echo "Running payment benchmarks on current PR commit: ${{ github.sha }}" | |
| git checkout ${{ github.sha }} | |
| cargo bench -p fnn --features bench --bench payment_benchmarks | |
| rm -rf /tmp/criterion-current | |
| mkdir -p /tmp/criterion-current | |
| cp -R target/criterion /tmp/criterion-current | |
| - name: Check payment benchmark regression | |
| run: | | |
| set -euo pipefail | |
| base_dir=/tmp/criterion-baseline | |
| cur_dir=/tmp/criterion-current | |
| max_reg=0 | |
| worst_case="" | |
| while IFS= read -r base; do | |
| rel=${base#"$base_dir"/} | |
| cur=${rel%/base/estimates.json}/new/estimates.json | |
| cur="$cur_dir/$cur" | |
| if [[ ! -f "$cur" ]]; then | |
| echo "Missing current estimate for $rel" | |
| exit 1 | |
| fi | |
| base_mean=$(jq -r '.mean.point_estimate' "$base") | |
| cur_mean=$(jq -r '.mean.point_estimate' "$cur") | |
| if [[ "$base_mean" == "0" ]]; then | |
| continue | |
| fi | |
| reg=$(awk -v b="$base_mean" -v c="$cur_mean" 'BEGIN { printf "%.6f", ((c-b)/b)*100 }') | |
| dir="flat" | |
| if awk -v r="$reg" 'BEGIN { exit !(r > 0.5) }'; then | |
| dir="down" | |
| elif awk -v r="$reg" 'BEGIN { exit !(r < -0.5) }'; then | |
| dir="up" | |
| fi | |
| if [[ "$dir" == "down" ]]; then | |
| emoji="🔻" | |
| elif [[ "$dir" == "up" ]]; then | |
| emoji="👍" | |
| else | |
| emoji="🟰" | |
| fi | |
| echo "$emoji Result: $rel baseline=$base_mean current=$cur_mean change=${reg}% ($dir)" | |
| if awk -v r="$reg" 'BEGIN { exit !(r > 5.0) }'; then | |
| echo "🚨 Regression > 5%: $rel (baseline=$base_mean current=$cur_mean, ${reg}% )" | |
| if awk -v r="$reg" -v m="$max_reg" 'BEGIN { exit !(r > m) }'; then | |
| max_reg=$reg | |
| worst_case=$rel | |
| fi | |
| fi | |
| done < <(find "$base_dir" -path "*/base/estimates.json" -type f | sort) | |
| if awk -v m="$max_reg" 'BEGIN { exit !(m > 5.0) }'; then | |
| echo "❌ Payment benchmark regression detected: $worst_case (${max_reg}%)" | |
| exit 1 | |
| fi | |
| echo "✅ Payment benchmark regression within 5% threshold" | |
| - name: Upload payment benchmark results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: payment-benchmark-results | |
| path: | | |
| /tmp/criterion-baseline | |
| /tmp/criterion-current |