bpi-rs 0.2.0

Bilibili API client library for Rust
Documentation
version: '3'

vars:
  CARGO_TEST_ARGS: ":: -- --test-threads=1 --nocapture"

tasks:
  check:
    cmds:
      - cargo check

  fmt_check:
    cmds:
      - cargo fmt --check

  test_compile:
    desc: Compile all library tests without running legacy live tests.
    cmds:
      - cargo test --all-features --lib --no-run

  test_offline:
    desc: Run default offline library tests.
    cmds:
      - cargo test --all-features --lib

  check_all:
    desc: Safe default checks for the migration baseline.
    cmds:
      - cargo fmt --check
      - cargo clippy --all-targets --all-features --locked -- -D warnings
      - cargo check --all-features
      - cargo test --all-features --lib

  check_feature_matrix:
    desc: Check that no-default and single-feature library builds stay healthy.
    cmds:
      - cargo check --no-default-features --lib
      - cargo check --no-default-features --bin bpi-probe
      - cargo check --no-default-features --lib --features activity
      - cargo check --no-default-features --lib --features article
      - cargo check --no-default-features --lib --features audio
      - cargo check --no-default-features --lib --features bangumi
      - cargo check --no-default-features --lib --features cheese
      - cargo check --no-default-features --lib --features clientinfo
      - cargo check --no-default-features --lib --features comment
      - cargo check --no-default-features --lib --features creativecenter
      - cargo check --no-default-features --lib --features danmaku
      - cargo check --no-default-features --lib --features dynamic
      - cargo check --no-default-features --lib --features electric
      - cargo check --no-default-features --lib --features fav
      - cargo check --no-default-features --lib --features historytoview
      - cargo check --no-default-features --lib --features live
      - cargo check --no-default-features --lib --features login
      - cargo check --no-default-features --lib --features manga
      - cargo check --no-default-features --lib --features message
      - cargo check --no-default-features --lib --features misc
      - cargo check --no-default-features --lib --features note
      - cargo check --no-default-features --lib --features opus
      - cargo check --no-default-features --lib --features search
      - cargo check --no-default-features --lib --features user
      - cargo check --no-default-features --lib --features video
      - cargo check --no-default-features --lib --features video_ranking
      - cargo check --no-default-features --lib --features vip
      - cargo check --no-default-features --lib --features wallet
      - cargo check --no-default-features --lib --features web_widget

  lint_strict:
    desc: Run strict clippy for all targets and features.
    cmds:
      - cargo clippy --all-targets --all-features --locked -- -D warnings

  test_live_legacy:
    desc: Run ignored legacy live tests. Treat this as potentially mutating until each test is classified.
    preconditions:
      - sh: test "$BPI_LIVE_TEST" = "1"
        msg: Set BPI_LIVE_TEST=1 before running live Bilibili API tests.
      - sh: test "$BPI_MUTATING_TEST" = "1"
        msg: Set BPI_MUTATING_TEST=1 because legacy live tests are not yet classified as read-only.
    cmds:
      - cargo test --all-features --lib -- --ignored --test-threads=1 --nocapture

  test_live_mutating:
    desc: Alias for running ignored legacy live tests that may mutate account state.
    preconditions:
      - sh: test "$BPI_LIVE_TEST" = "1"
        msg: Set BPI_LIVE_TEST=1 before running live Bilibili API tests.
      - sh: test "$BPI_MUTATING_TEST" = "1"
        msg: Set BPI_MUTATING_TEST=1 before running mutating Bilibili API tests.
    cmds:
      - task: test_live_legacy

  test_activity:
    cmds:
      - cargo test --no-default-features --features activity activity{{.CARGO_TEST_ARGS}}

  test_article:
    cmds:
      - cargo test --no-default-features --features article article{{.CARGO_TEST_ARGS}}

  test_audio:
    cmds:
      - cargo test --no-default-features --features audio audio{{.CARGO_TEST_ARGS}}

  test_bangumi:
    cmds:
      - cargo test --no-default-features --features bangumi bangumi{{.CARGO_TEST_ARGS}}

  test_cheese:
    cmds:
      - cargo test --no-default-features --features cheese cheese{{.CARGO_TEST_ARGS}}

  test_clientinfo:
    cmds:
      - cargo test --no-default-features --features clientinfo clientinfo{{.CARGO_TEST_ARGS}}

  test_comment:
    cmds:
      - cargo test --no-default-features --features comment comment{{.CARGO_TEST_ARGS}}

  test_creativecenter:
    cmds:
      - cargo test --no-default-features --features creativecenter creativecenter{{.CARGO_TEST_ARGS}}

  test_danmaku:
    cmds:
      - cargo test --no-default-features --features danmaku danmaku{{.CARGO_TEST_ARGS}}

  test_dynamic:
    cmds:
      - cargo test --no-default-features --features dynamic dynamic{{.CARGO_TEST_ARGS}}

  test_electric:
    cmds:
      - cargo test --no-default-features --features electric electric{{.CARGO_TEST_ARGS}}

  test_fav:
    cmds:
      - cargo test --no-default-features --features fav fav{{.CARGO_TEST_ARGS}}

  test_historytoview:
    cmds:
      - cargo test --no-default-features --features historytoview historytoview{{.CARGO_TEST_ARGS}}

  test_live:
    cmds:
      - cargo test --no-default-features --features live live{{.CARGO_TEST_ARGS}}

  test_login:
    cmds:
      - cargo test --no-default-features --features login login{{.CARGO_TEST_ARGS}}

  test_manga:
    cmds:
      - cargo test --no-default-features --features manga manga{{.CARGO_TEST_ARGS}}

  test_message:
    cmds:
      - cargo test --no-default-features --features message message{{.CARGO_TEST_ARGS}}

  test_misc:
    cmds:
      - cargo test --no-default-features --features misc misc{{.CARGO_TEST_ARGS}}

  test_note:
    cmds:
      - cargo test --no-default-features --features note note{{.CARGO_TEST_ARGS}}

  test_opus:
    cmds:
      - cargo test --no-default-features --features opus opus{{.CARGO_TEST_ARGS}}

  test_search:
    cmds:
      - cargo test --no-default-features --features search search{{.CARGO_TEST_ARGS}}

  test_user:
    cmds:
      - cargo test --no-default-features --features user user{{.CARGO_TEST_ARGS}}

  test_video:
    cmds:
      - cargo test --no-default-features --features video video{{.CARGO_TEST_ARGS}}

  test_video_ranking:
    cmds:
      - cargo test --no-default-features --features video_ranking video_ranking{{.CARGO_TEST_ARGS}}

  test_vip:
    cmds:
      - cargo test --no-default-features --features vip vip{{.CARGO_TEST_ARGS}}

  test_wallet:
    cmds:
      - cargo test --no-default-features --features wallet wallet{{.CARGO_TEST_ARGS}}

  test_web_widget:
    cmds:
      - cargo test --no-default-features --features web_widget web_widget{{.CARGO_TEST_ARGS}}